[Mesa-dev] [PATCH 2/4] clover: use PIPE_SHADER_CAP_SUPPORTED_IRS to discover IR

Timothy Arceri tarceri at itsqueeze.com
Fri Feb 9 11:15:34 UTC 2018



On 09/02/18 21:54, Pierre Moreau wrote:
> On 2018-02-09 — 12:06, Timothy Arceri wrote:
>> PIPE_SHADER_CAP_PREFERRED_IR was conflicting with PIPE_SHADER_IR_NIR
>> for compute shaders, so we let clover pick the one it wants to use.
>> ---
>>   src/gallium/state_trackers/clover/core/device.cpp | 11 +++++++++--
>>   1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
>> index 9dd7eed3f1..71cf4bf60a 100644
>> --- a/src/gallium/state_trackers/clover/core/device.cpp
>> +++ b/src/gallium/state_trackers/clover/core/device.cpp
>> @@ -243,8 +243,15 @@ device::vendor_name() const {
>>   
>>   enum pipe_shader_ir
>>   device::ir_format() const {
>> -   return (enum pipe_shader_ir) pipe->get_shader_param(
>> -      pipe, PIPE_SHADER_COMPUTE, PIPE_SHADER_CAP_PREFERRED_IR);
>> +   int supported_irs =
>> +      pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
>> +                             PIPE_SHADER_CAP_SUPPORTED_IRS);
>> +
>> +   if (supported_irs & (1 << PIPE_SHADER_IR_NATIVE)) {
>> +      return PIPE_SHADER_IR_NATIVE;
>> +   }
>> +
>> +   return PIPE_SHADER_IR_TGSI;
> 
> This looks fine, but I was wondering whether we should instead:
> * check that TGSI is in supported_irs before returning it, else throw an
>    exception;

I'm happy to add the following above the return:

assert(supported_irs & (1 << PIPE_SHADER_IR_TGSI));

> or
> * swap TGSI and NATIVE (so check for TGSI, if not found return NATIVE), which
>    would match the existing behaviour (see for example
>    https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/clover/core/program.cpp#n54).

That would break radeonsi and r600 as it would always return TGSI IR as 
its supported by the drivers.


> 
>>   }
>>   
>>   std::string
>> -- 
>> 2.14.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list