[Mesa-dev] [PATCH 01/11] radeonsi/nir: gather some compute info in si_nir_scan_shader()

Marek Olšák maraeo at gmail.com
Tue Feb 6 15:28:47 UTC 2018


On Fri, Feb 2, 2018 at 5:03 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> ---
>  src/gallium/drivers/radeonsi/si_shader_nir.c | 30 +++++++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
> index 128be585cd..28b031d935 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_nir.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
> @@ -86,6 +86,27 @@ static void scan_instruction(struct tgsi_shader_info *info,
>                 case nir_intrinsic_load_invocation_id:
>                         info->uses_invocationid = true;
>                         break;
> +               case nir_intrinsic_load_num_work_groups:
> +                       info->uses_grid_size = true;
> +                       break;
> +               case nir_intrinsic_load_local_group_size:
> +                       /* The block size is translated to IMM with a fixed block size. */
> +                       if (info->properties[TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH] == 0)
> +                               info->uses_block_size = true;
> +                       break;
> +               case nir_intrinsic_load_local_invocation_id:
> +               case nir_intrinsic_load_work_group_id: {
> +                       unsigned mask = nir_ssa_def_components_read(&intr->dest.ssa);
> +                       while (mask) {
> +                               unsigned i = u_bit_scan(&mask);
> +
> +                               if (intr->intrinsic == nir_intrinsic_load_work_group_id)
> +                                       info->uses_block_id[i] = true;
> +                               else
> +                                       info->uses_thread_id[i] = true;
> +                       }
> +                       break;
> +               }
>                 case nir_intrinsic_load_vertex_id:
>                         info->uses_vertexid = 1;
>                         break;
> @@ -226,7 +247,8 @@ void si_nir_scan_shader(const struct nir_shader *nir,
>                nir->info.stage == MESA_SHADER_GEOMETRY ||
>                nir->info.stage == MESA_SHADER_TESS_CTRL ||
>                nir->info.stage == MESA_SHADER_TESS_EVAL ||
> -              nir->info.stage == MESA_SHADER_FRAGMENT);
> +              nir->info.stage == MESA_SHADER_FRAGMENT ||
> +              nir->info.stage == MESA_SHADER_COMPUTE);

You can just remove this tautological assertion.

Marek


More information about the mesa-dev mailing list