[Mesa-dev] [PATCH 3/8] clover: Add device_clc_version to llvm::[compile|link]_program
Jan Vesely
jan.vesely at rutgers.edu
Fri Aug 4 18:22:28 UTC 2017
On Sun, 2017-07-30 at 20:26 -0500, Aaron Watry wrote:
> We'll be using it to select the default language version soon.
>
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> Cc: Pierre Moreau <pierre.morrow at free.fr>
> Cc: Jan Vesely <jan.vesely at rutgers.edu>
>
> v2: (Pierre) Move changes to create_compiler_instance invocation to correct
> patch to prevent temporary build breakage.
> (Jan) Use device_clc_version instead of device_version for compile/link
> ---
This patch looks redundant wrt changes in 5/8. Why not just add device
parameter right away instead of adding version and then changing it
later.
Jan
> src/gallium/state_trackers/clover/core/program.cpp | 6 ++++--
> src/gallium/state_trackers/clover/llvm/invocation.cpp | 10 +++++++---
> src/gallium/state_trackers/clover/llvm/invocation.hpp | 2 ++
> 3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp
> index ae4b50a879..f0f0f38548 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_clc_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_clc_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..7c8d0e738d 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,13 +204,14 @@ 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);
>
> auto ctx = create_context(r_log);
> auto c = create_compiler_instance(target, tokenize(opts + " input.cl"),
> - r_log);
> + device_version, r_log);
> auto mod = compile(*ctx, *c, "input.cl", source, headers, target, opts,
> r_log);
>
> @@ -270,13 +272,15 @@ 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);
>
> auto ctx = create_context(r_log);
> - auto c = create_compiler_instance(target, options, r_log);
> + auto c = create_compiler_instance(target, options, device_version, r_log);
> auto mod = link(*ctx, *c, modules, r_log);
>
> optimize(*mod, c->getCodeGenOpts().OptimizationLevel, !create_library);
> 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);
> }
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170804/5a13b3f5/attachment.sig>
More information about the mesa-dev
mailing list