[Mesa-dev] [PATCH] r600/radeonsi/clover: use PIPE_SHADER_CAP_SUPPORTED_IRS with clover

Jan Vesely jan.vesely at rutgers.edu
Thu Feb 8 17:08:54 UTC 2018


On Thu, 2018-02-08 at 10:57 +1100, Timothy Arceri wrote:
> PIPE_SHADER_CAP_PREFERRED_IR was conlicting with PIPE_SHADER_IR_NIR
> for compute shaders, so we let clover pick the one it wants to use.
> 
> This change indirectly enables NIR support for compute shaders
> on radeonsi.
> ---
>  src/gallium/drivers/r600/r600_pipe.c              |  6 +-----
>  src/gallium/drivers/radeonsi/si_get.c             |  3 ---
>  src/gallium/state_trackers/clover/core/device.cpp | 11 +++++++++--
>  3 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 6c021e568d..287fe497ca 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -595,11 +595,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen,
>  	case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
>  		return 16;
>          case PIPE_SHADER_CAP_PREFERRED_IR:
> -		if (shader == PIPE_SHADER_COMPUTE) {
> -			return PIPE_SHADER_IR_NATIVE;
> -		} else {
> -			return PIPE_SHADER_IR_TGSI;
> -		}
> +		return PIPE_SHADER_IR_TGSI;

This change kills OpenCL on EG/NI. The code below needs to be changed
to include PIPE_SHADER_IR_NATIVE in supported bitmask for
PIPE_SHADER_COMPUTE.

Jan

>  	case PIPE_SHADER_CAP_SUPPORTED_IRS:
>  		if (rscreen->b.family >= CHIP_CEDAR)
>  			return (1 << PIPE_SHADER_IR_TGSI);
> diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c
> index 9a205c07f8..14d7ca5ba6 100644
> --- a/src/gallium/drivers/radeonsi/si_get.c
> +++ b/src/gallium/drivers/radeonsi/si_get.c
> @@ -389,9 +389,6 @@ static int si_get_shader_param(struct pipe_screen* pscreen,
>  		break;
>  	case PIPE_SHADER_COMPUTE:
>  		switch (param) {
> -		case PIPE_SHADER_CAP_PREFERRED_IR:
> -			return PIPE_SHADER_IR_NATIVE;
> -
>  		case PIPE_SHADER_CAP_SUPPORTED_IRS: {
>  			int ir = 1 << PIPE_SHADER_IR_NATIVE;
>  
> 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;
>  }
>  
>  std::string
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180208/eb35c870/attachment.sig>


More information about the mesa-dev mailing list