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

Aaron Watry awatry at gmail.com
Sat Jul 22 04:19:49 UTC 2017


We'll be using it to select the default language version soon.

Signed-off-by: Aaron Watry <awatry at 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(-)

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);
    }
 }
-- 
2.11.0



More information about the mesa-dev mailing list