Re: [Mesa-dev] [PATCH 2/5] clover: Pass device to llvm::create_compiler_instance

2018-03-01 Thread Jan Vesely
On Thu, 2018-03-01 at 13:39 -0600, Aaron Watry wrote:
> We'll be using dev.device_clc_version to select the default language version
> soon along with the existing ir_target field.
> 
> Signed-off-by: Aaron Watry 
> Cc: Pierre Moreau 
> Cc: Jan Vesely 
> 
> v4: Pass the device down instead of device_clc_version as a separate field
> v3: Revise to acknowledge that we now have the device in compile/link_program
> instead of the string values.
> 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
> ---
>  src/gallium/state_trackers/clover/llvm/invocation.cpp | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
> b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> index c8c0311a3a..42aabfb9a3 100644
> --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> @@ -94,7 +94,7 @@ namespace {
> }
>  
> std::unique_ptr
> -   create_compiler_instance(const target ,
> +   create_compiler_instance(const device ,
>  const std::vector ,
>  std::string _log) {
>std::unique_ptr c { new 
> clang::CompilerInstance };
> @@ -108,6 +108,9 @@ namespace {
>const std::vector copts =
>   map(std::mem_fn(::string::c_str), opts);
>  
> +  const target  = dev.ir_target();
> +  const std::string _clc_version = dev.device_clc_version();

This variable does not seem to be used until patch 5. Am I missing
something? Better not introduce it early.
Other than that:
Reviewed-by: Jan Vesely 

Jan

> +
>if (!clang::CompilerInvocation::CreateFromArgs(
>   c->getInvocation(), copts.data(), copts.data() + copts.size(), 
> diag))
>   throw invalid_build_options_error();
> @@ -208,8 +211,7 @@ clover::llvm::compile_program(const std::string ,
>debug::log(".cl", "// Options: " + opts + '\n' + source);
>  
> auto ctx = create_context(r_log);
> -   auto c = create_compiler_instance(dev.ir_target(),
> - tokenize(opts + " input.cl"), r_log);
> +   auto c = create_compiler_instance(dev, tokenize(opts + " input.cl"), 
> r_log);
> auto mod = compile(*ctx, *c, "input.cl", source, headers, dev.ir_target(),
>opts, r_log);
>  
> @@ -276,7 +278,7 @@ clover::llvm::link_program(const std::vector 
> ,
> erase_if(equals("-create-library"), options);
>  
> auto ctx = create_context(r_log);
> -   auto c = create_compiler_instance(dev.ir_target(), options, r_log);
> +   auto c = create_compiler_instance(dev, options, r_log);
> auto mod = link(*ctx, *c, modules, r_log);
>  
> optimize(*mod, c->getCodeGenOpts().OptimizationLevel, !create_library);


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/5] clover: Pass device to llvm::create_compiler_instance

2018-03-01 Thread Aaron Watry
We'll be using dev.device_clc_version to select the default language version
soon along with the existing ir_target field.

Signed-off-by: Aaron Watry 
Cc: Pierre Moreau 
Cc: Jan Vesely 

v4: Pass the device down instead of device_clc_version as a separate field
v3: Revise to acknowledge that we now have the device in compile/link_program
instead of the string values.
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
---
 src/gallium/state_trackers/clover/llvm/invocation.cpp | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index c8c0311a3a..42aabfb9a3 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -94,7 +94,7 @@ namespace {
}
 
std::unique_ptr
-   create_compiler_instance(const target ,
+   create_compiler_instance(const device ,
 const std::vector ,
 std::string _log) {
   std::unique_ptr c { new clang::CompilerInstance 
};
@@ -108,6 +108,9 @@ namespace {
   const std::vector copts =
  map(std::mem_fn(::string::c_str), opts);
 
+  const target  = dev.ir_target();
+  const std::string _clc_version = dev.device_clc_version();
+
   if (!clang::CompilerInvocation::CreateFromArgs(
  c->getInvocation(), copts.data(), copts.data() + copts.size(), 
diag))
  throw invalid_build_options_error();
@@ -208,8 +211,7 @@ clover::llvm::compile_program(const std::string ,
   debug::log(".cl", "// Options: " + opts + '\n' + source);
 
auto ctx = create_context(r_log);
-   auto c = create_compiler_instance(dev.ir_target(),
- tokenize(opts + " input.cl"), r_log);
+   auto c = create_compiler_instance(dev, tokenize(opts + " input.cl"), r_log);
auto mod = compile(*ctx, *c, "input.cl", source, headers, dev.ir_target(),
   opts, r_log);
 
@@ -276,7 +278,7 @@ clover::llvm::link_program(const std::vector 
,
erase_if(equals("-create-library"), options);
 
auto ctx = create_context(r_log);
-   auto c = create_compiler_instance(dev.ir_target(), options, r_log);
+   auto c = create_compiler_instance(dev, options, r_log);
auto mod = link(*ctx, *c, modules, r_log);
 
optimize(*mod, c->getCodeGenOpts().OptimizationLevel, !create_library);
-- 
2.14.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev