[Mesa-dev] [PATCH 03/13] gallium/compute: Add PIPE_COMPUTE_CAP_IR_TARGET v2

Tom Stellard tstellar at gmail.com
Sun May 27 06:59:44 PDT 2012


On Sun, May 27, 2012 at 02:25:05PM +0200, Francisco Jerez wrote:
> Tom Stellard <tstellar at gmail.com> writes:
> 
> > From: Francisco Jerez <currojerez at riseup.net>
> >
> > v2: Tom Stellard
> >   - Update CAP description
> > ---
> >  src/gallium/docs/source/screen.rst   |    5 +++++
> >  src/gallium/include/pipe/p_defines.h |    1 +
> >  2 files changed, 6 insertions(+), 0 deletions(-)
> >
> > diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> > index 2bddf1b..3a113c9 100644
> > --- a/src/gallium/docs/source/screen.rst
> > +++ b/src/gallium/docs/source/screen.rst
> > @@ -206,6 +206,11 @@ PIPE_COMPUTE_CAP_*
> >  Compute-specific capabilities. They can be queried using
> >  pipe_screen::get_compute_param.
> >  
> > +* ``PIPE_COMPUTE_CAP_IR_TARGET``: A description of the target as a target
> > +  triple specification of the form ``processor-manufacturer-os`` that will
> > +  be passed on to the compiler.  If a driver accepts compute programs in
> > +  the common TGSI representation, then it should specify ``tgsi`` as the
> > +  processor.  Value type: null-terminated string.
> 
> This param doesn't even make sense for drivers that aren't using LLVM as
> IR, do you think it's going to be useful to force them to return "tgsi"
> here?

We have to pass a triple to Clang somehow and since clover is passing
the value of this CAP directly to Clang I thought it would be necessary
for drivers using TGSI to return the TGSI triple here.

The other way to handle this would be to have TGSI drivers return an
empty string here and then let clover pass the TGSI triple
for targets with a preferred IR of PIPE_SHADER_IR_TGSI, for example:

std::string _cl_device_id::ir_target() const {

   std::vector<char> target;
   if (ir_format() == PIPE_SHADER_IR_TGSI) {
      target = "TGSI--";
   } else {
      target = get_compute_param<char>(pipe, PIPE_COMPUTE_CAP_IR_TARGET);
   }
   return { target.data() };
}

Would you prefer to do it this way?

-Tom

> 
> >  * ``PIPE_COMPUTE_CAP_GRID_DIMENSION``: Number of supported dimensions
> >    for grid and block coordinates.  Value type: ``uint64_t``.
> >  * ``PIPE_COMPUTE_CAP_MAX_GRID_SIZE``: Maximum grid size in block
> > diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> > index d0819e2..585cab2 100644
> > --- a/src/gallium/include/pipe/p_defines.h
> > +++ b/src/gallium/include/pipe/p_defines.h
> > @@ -546,6 +546,7 @@ enum pipe_shader_ir
> >   */
> >  enum pipe_compute_cap
> >  {
> > +   PIPE_COMPUTE_CAP_IR_TARGET,
> >     PIPE_COMPUTE_CAP_GRID_DIMENSION,
> >     PIPE_COMPUTE_CAP_MAX_GRID_SIZE,
> >     PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE,





More information about the mesa-dev mailing list