[Mesa-dev,3/5] clover: Add device_version to llvm::[compile|link]_program

Submitted by Aaron Watry on July 22, 2017, 4:19 a.m.

Details

Message ID 20170722041951.14304-4-awatry@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Aaron Watry July 22, 2017, 4:19 a.m.
We'll be using it to select the default language version soon.

Signed-off-by: Aaron Watry <awatry@gmail.com>
---
 src/gallium/state_trackers/clover/core/program.cpp    | 6 ++++--
 src/gallium/state_trackers/clover/llvm/invocation.cpp | 6 +++++-
 src/gallium/state_trackers/clover/llvm/invocation.hpp | 2 ++
 3 files changed, 11 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp
index ae4b50a879..56c25b19bb 100644
--- a/src/gallium/state_trackers/clover/core/program.cpp
+++ b/src/gallium/state_trackers/clover/core/program.cpp
@@ -54,7 +54,8 @@  program::compile(const ref_vector<device> &devs, const std::string &opts,
             const module m = (dev.ir_format() == PIPE_SHADER_IR_TGSI ?
                               tgsi::compile_program(_source, log) :
                               llvm::compile_program(_source, headers,
-                                                    dev.ir_target(), opts, log));
+                                                    dev.ir_target(), opts,
+                                                    dev.device_version(), log));
             _builds[&dev] = { m, opts, log };
          } catch (...) {
             _builds[&dev] = { module(), opts, log };
@@ -79,7 +80,8 @@  program::link(const ref_vector<device> &devs, const std::string &opts,
          const module m = (dev.ir_format() == PIPE_SHADER_IR_TGSI ?
                            tgsi::link_program(ms) :
                            llvm::link_program(ms, dev.ir_format(),
-                                              dev.ir_target(), opts, log));
+                                              dev.ir_target(), opts,
+                                              dev.device_version(), log));
          _builds[&dev] = { m, opts, log };
       } catch (...) {
          _builds[&dev] = { module(), opts, log };
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index 6412377faa..364aaf1517 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -96,6 +96,7 @@  namespace {
    std::unique_ptr<clang::CompilerInstance>
    create_compiler_instance(const target &target,
                             const std::vector<std::string> &opts,
+                            const std::string &device_version,
                             std::string &r_log) {
       std::unique_ptr<clang::CompilerInstance> c { new clang::CompilerInstance };
       clang::TextDiagnosticBuffer *diag_buffer = new clang::TextDiagnosticBuffer;
@@ -203,6 +204,7 @@  clover::llvm::compile_program(const std::string &source,
                               const header_map &headers,
                               const std::string &target,
                               const std::string &opts,
+                              const std::string &device_version,
                               std::string &r_log) {
    if (has_flag(debug::clc))
       debug::log(".cl", "// Options: " + opts + '\n' + source);
@@ -270,7 +272,9 @@  namespace {
 module
 clover::llvm::link_program(const std::vector<module> &modules,
                            enum pipe_shader_ir ir, const std::string &target,
-                           const std::string &opts, std::string &r_log) {
+                           const std::string &opts,
+                           const std::string &device_version,
+                           std::string &r_log) {
    std::vector<std::string> options = tokenize(opts + " input.cl");
    const bool create_library = count("-create-library", options);
    erase_if(equals("-create-library"), options);
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.hpp b/src/gallium/state_trackers/clover/llvm/invocation.hpp
index 5b3530c382..959ef755b1 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.hpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.hpp
@@ -34,12 +34,14 @@  namespace clover {
                              const header_map &headers,
                              const std::string &target,
                              const std::string &opts,
+                             const std::string &device_version,
                              std::string &r_log);
 
       module link_program(const std::vector<module> &modules,
                           enum pipe_shader_ir ir,
                           const std::string &target,
                           const std::string &opts,
+                          const std::string &device_version,
                           std::string &r_log);
    }
 }