Re: [Mesa-dev] [PATCH v10 09/20] clover: Track flags per module section

2019-01-30 Thread Pierre Moreau
On 2019-01-20 — 16:59, Pierre Moreau wrote:
[snip]
> > Is this patch being used at all in this series?
> 
> Not in this one, but it will be in the next merge request which adds support
> for SPIR-V as a second main IR in clover alongside LLVM IR.
> I’ll drop this patch from this series and add it to the next one, with the
> modifications you discussed.

Actually, that’s a fail on my end: I forgot to use it in the LLVM code; I’ll
spin a new version where it is actually used.

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


Re: [Mesa-dev] [PATCH v10 09/20] clover: Track flags per module section

2019-01-20 Thread Pierre Moreau
On 2019-01-18 — 16:04, Francisco Jerez wrote:
[snip]
> > diff --git a/src/gallium/state_trackers/clover/core/module.hpp 
> > b/src/gallium/state_trackers/clover/core/module.hpp
> > index 2ddd26426fb..ff7e9b6234a 100644
> > --- a/src/gallium/state_trackers/clover/core/module.hpp
> > +++ b/src/gallium/state_trackers/clover/core/module.hpp
> > @@ -41,14 +41,19 @@ namespace clover {
> >  data_local,
> >  data_private
> >   };
> > + enum class flags_t {
> 
> You probably want the type to be "enum flags" for consistency with the
> other enums defined here.

For consistency, that would be better indeed.
Would it make sense to convert the other enums to scoped enums? The advantages
would be the scoping and the better type checking, but that’s about it.

> > +none,
> > +allow_link_options
> 
> And explicitly define allow_link_options = 1u, assuming that this is
> going to be a bit-mask with multiple flags.

I’ll need to have another look at which other flags could go here, but you’re
right, we probably want to support multiple flags being set.

> Is this patch being used at all in this series?

Not in this one, but it will be in the next merge request which adds support
for SPIR-V as a second main IR in clover alongside LLVM IR.
I’ll drop this patch from this series and add it to the next one, with the
modifications you discussed.

Pierre


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


Re: [Mesa-dev] [PATCH v10 09/20] clover: Track flags per module section

2019-01-18 Thread Francisco Jerez
Pierre Moreau  writes:

> One flag that needs to be tracked is whether a library is allowed to
> received mathematics optimisations or not, as the authorisation is given
> when creating the library while the optimisations are specified when
> creating the executable.
>
> Reviewed-by: Aaron Watry 
>
> Changes since:
> * v3: drop the modification to the tgsi backend, as already dropped
>   (Aaron Watry)
>
> Signed-off-by: Pierre Moreau 
> ---
>  src/gallium/state_trackers/clover/core/module.cpp   |  1 +
>  src/gallium/state_trackers/clover/core/module.hpp   | 13 +
>  .../state_trackers/clover/llvm/codegen/bitcode.cpp  |  3 ++-
>  .../state_trackers/clover/llvm/codegen/common.cpp   |  2 +-
>  4 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/core/module.cpp 
> b/src/gallium/state_trackers/clover/core/module.cpp
> index a6c5b98d8e0..0e11506d0d7 100644
> --- a/src/gallium/state_trackers/clover/core/module.cpp
> +++ b/src/gallium/state_trackers/clover/core/module.cpp
> @@ -163,6 +163,7 @@ namespace {
>proc(S , QT ) {
>   _proc(s, x.id);
>   _proc(s, x.type);
> + _proc(s, x.flags);
>   _proc(s, x.size);
>   _proc(s, x.data);
>}
> diff --git a/src/gallium/state_trackers/clover/core/module.hpp 
> b/src/gallium/state_trackers/clover/core/module.hpp
> index 2ddd26426fb..ff7e9b6234a 100644
> --- a/src/gallium/state_trackers/clover/core/module.hpp
> +++ b/src/gallium/state_trackers/clover/core/module.hpp
> @@ -41,14 +41,19 @@ namespace clover {
>  data_local,
>  data_private
>   };
> + enum class flags_t {

You probably want the type to be "enum flags" for consistency with the
other enums defined here.

> +none,
> +allow_link_options

And explicitly define allow_link_options = 1u, assuming that this is
going to be a bit-mask with multiple flags.

Is this patch being used at all in this series?

> + };
>  
> - section(resource_id id, enum type type, size_t size,
> - const std::vector ) :
> - id(id), type(type), size(size), data(data) { }
> - section() : id(0), type(text_intermediate), size(0), data() { }
> + section(resource_id id, enum type type, flags_t flags,
> + size_t size, const std::vector ) :
> + id(id), type(type), flags(flags), size(size), data(data) { }
> + section() : id(0), type(text_intermediate), flags(flags_t::none), 
> size(0), data() { }
>  
>   resource_id id;
>   type type;
> + flags_t flags;
>   size_t size;
>   std::vector data;
>};
> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
> b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> index 40bb426218d..8e9d4c7e85c 100644
> --- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> @@ -84,7 +84,8 @@ clover::llvm::build_module_library(const ::llvm::Module 
> ,
> enum module::section::type section_type) {
> module m;
> const auto code = emit_code(mod);
> -   m.secs.emplace_back(0, section_type, code.size(), code);
> +   m.secs.emplace_back(0, section_type, module::section::flags_t::none,
> +   code.size(), code);
> return m;
>  }
>  
> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp 
> b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> index ca5f78940d2..a278e675003 100644
> --- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> @@ -178,7 +178,7 @@ namespace {
> make_text_section(const std::vector ) {
>const pipe_llvm_program_header header { uint32_t(code.size()) };
>module::section text { 0, module::section::text_executable,
> - header.num_bytes, {} };
> + module::section::flags_t::none, 
> header.num_bytes, {} };
>  
>text.data.insert(text.data.end(), reinterpret_cast *>(),
> reinterpret_cast() + 
> sizeof(header));
> -- 
> 2.20.1


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


[Mesa-dev] [PATCH v10 09/20] clover: Track flags per module section

2019-01-08 Thread Pierre Moreau
One flag that needs to be tracked is whether a library is allowed to
received mathematics optimisations or not, as the authorisation is given
when creating the library while the optimisations are specified when
creating the executable.

Reviewed-by: Aaron Watry 

Changes since:
* v3: drop the modification to the tgsi backend, as already dropped
  (Aaron Watry)

Signed-off-by: Pierre Moreau 
---
 src/gallium/state_trackers/clover/core/module.cpp   |  1 +
 src/gallium/state_trackers/clover/core/module.hpp   | 13 +
 .../state_trackers/clover/llvm/codegen/bitcode.cpp  |  3 ++-
 .../state_trackers/clover/llvm/codegen/common.cpp   |  2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/clover/core/module.cpp 
b/src/gallium/state_trackers/clover/core/module.cpp
index a6c5b98d8e0..0e11506d0d7 100644
--- a/src/gallium/state_trackers/clover/core/module.cpp
+++ b/src/gallium/state_trackers/clover/core/module.cpp
@@ -163,6 +163,7 @@ namespace {
   proc(S , QT ) {
  _proc(s, x.id);
  _proc(s, x.type);
+ _proc(s, x.flags);
  _proc(s, x.size);
  _proc(s, x.data);
   }
diff --git a/src/gallium/state_trackers/clover/core/module.hpp 
b/src/gallium/state_trackers/clover/core/module.hpp
index 2ddd26426fb..ff7e9b6234a 100644
--- a/src/gallium/state_trackers/clover/core/module.hpp
+++ b/src/gallium/state_trackers/clover/core/module.hpp
@@ -41,14 +41,19 @@ namespace clover {
 data_local,
 data_private
  };
+ enum class flags_t {
+none,
+allow_link_options
+ };
 
- section(resource_id id, enum type type, size_t size,
- const std::vector ) :
- id(id), type(type), size(size), data(data) { }
- section() : id(0), type(text_intermediate), size(0), data() { }
+ section(resource_id id, enum type type, flags_t flags,
+ size_t size, const std::vector ) :
+ id(id), type(type), flags(flags), size(size), data(data) { }
+ section() : id(0), type(text_intermediate), flags(flags_t::none), 
size(0), data() { }
 
  resource_id id;
  type type;
+ flags_t flags;
  size_t size;
  std::vector data;
   };
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
index 40bb426218d..8e9d4c7e85c 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
@@ -84,7 +84,8 @@ clover::llvm::build_module_library(const ::llvm::Module ,
enum module::section::type section_type) {
module m;
const auto code = emit_code(mod);
-   m.secs.emplace_back(0, section_type, code.size(), code);
+   m.secs.emplace_back(0, section_type, module::section::flags_t::none,
+   code.size(), code);
return m;
 }
 
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp 
b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
index ca5f78940d2..a278e675003 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
@@ -178,7 +178,7 @@ namespace {
make_text_section(const std::vector ) {
   const pipe_llvm_program_header header { uint32_t(code.size()) };
   module::section text { 0, module::section::text_executable,
- header.num_bytes, {} };
+ module::section::flags_t::none, header.num_bytes, 
{} };
 
   text.data.insert(text.data.end(), reinterpret_cast(),
reinterpret_cast() + 
sizeof(header));
-- 
2.20.1

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