On 2018-01-23 — 14:03, Francisco Jerez wrote:
> Pierre Moreau <pierre.mor...@free.fr> writes:
> 
> > Signed-off-by: Pierre Moreau <pierre.mor...@free.fr>
> > ---
> >  src/gallium/state_trackers/clover/core/device.cpp | 11 +++++++++++
> >  src/gallium/state_trackers/clover/core/device.hpp |  3 +++
> >  2 files changed, 14 insertions(+)
> >
> > diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
> > b/src/gallium/state_trackers/clover/core/device.cpp
> > index 9dd7eed3f1..7eaa0ca2cb 100644
> > --- a/src/gallium/state_trackers/clover/core/device.cpp
> > +++ b/src/gallium/state_trackers/clover/core/device.cpp
> > @@ -247,6 +247,12 @@ device::ir_format() const {
> >        pipe, PIPE_SHADER_COMPUTE, PIPE_SHADER_CAP_PREFERRED_IR);
> >  }
> >  
> > +cl_uint
> > +device::supported_irs() const {
> > +   return (enum pipe_shader_ir) pipe->get_shader_param(
> > +      pipe, PIPE_SHADER_COMPUTE, PIPE_SHADER_CAP_SUPPORTED_IRS);
> > +}
> > +
> 
> I don't think we need this as a public method of clover::device, the
> bitmask can be a local variable definition within supports_ir below.

If we need to iterate over those IRs until we find one that suits us (for
example, one to each we can convert from LLVM IR or SPIR-V), then that function
could be of some use, but that’s pretty much the only one I can think of, and
it shouldn’t happen that often, making the overhead of calling the function
multiple times through supports_ir() relatively small.
I’ll follow your suggestion.

> 
> >  std::string
> >  device::ir_target() const {
> >     std::vector<char> target = get_compute_param<char>(
> > @@ -268,3 +274,8 @@ std::string
> >  device::device_clc_version() const {
> >      return "1.1";
> >  }
> > +
> > +bool
> > +device::supports_ir(cl_uint ir) const {
> > +   return supported_irs() & (1 << ir);
> > +}
> > diff --git a/src/gallium/state_trackers/clover/core/device.hpp 
> > b/src/gallium/state_trackers/clover/core/device.hpp
> > index 85cd031676..eed644e919 100644
> > --- a/src/gallium/state_trackers/clover/core/device.hpp
> > +++ b/src/gallium/state_trackers/clover/core/device.hpp
> > @@ -80,9 +80,12 @@ namespace clover {
> >        std::string device_version() const;
> >        std::string device_clc_version() const;
> >        enum pipe_shader_ir ir_format() const;
> > +      cl_uint supported_irs() const;
> >        std::string ir_target() const;
> >        enum pipe_endian endianness() const;
> >  
> > +      bool supports_ir(cl_uint ir) const;
> 
> The argument of this method is a pipe_shader_ir enumerant, we should
> declare it as such.

This is true. I thought I had changed that already, but apparently not.

> 
> > +
> >        friend class command_queue;
> >        friend class root_resource;
> >        friend class hard_event;
> > -- 
> > 2.16.0



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

Reply via email to