agx: rework libagx I/O lowering

that would otherwise fight with other driver I/O lowering.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29607>
This commit is contained in:
Alyssa Rosenzweig 2024-05-27 17:40:15 -04:00 committed by Marge Bot
parent 5f72234745
commit a9a6af50a7
3 changed files with 16 additions and 10 deletions

View file

@ -3230,8 +3230,7 @@ agx_link_libagx(nir_shader *nir, const nir_shader *libagx)
NIR_PASS(_, nir, nir_remove_dead_variables,
nir_var_function_temp | nir_var_shader_temp, NULL);
NIR_PASS(_, nir, nir_lower_vars_to_explicit_types,
nir_var_shader_temp | nir_var_function_temp | nir_var_mem_shared |
nir_var_mem_global,
nir_var_shader_temp | nir_var_function_temp,
glsl_get_cl_type_size_align);
}
@ -3291,10 +3290,6 @@ agx_preprocess_nir(nir_shader *nir, const nir_shader *libagx)
NIR_PASS(_, nir, nir_opt_deref);
NIR_PASS(_, nir, nir_lower_vars_to_ssa);
NIR_PASS(_, nir, nir_lower_explicit_io,
nir_var_shader_temp | nir_var_function_temp | nir_var_mem_shared |
nir_var_mem_global,
nir_address_format_62bit_generic);
/* We're lowered away all variables. Remove them all for smaller shaders. */
NIR_PASS(_, nir, nir_remove_dead_variables, nir_var_all, NULL);

View file

@ -1149,8 +1149,7 @@ link_libagx(nir_shader *nir, const nir_shader *libagx)
NIR_PASS(_, nir, nir_lower_indirect_derefs, nir_var_function_temp, 64);
NIR_PASS(_, nir, nir_opt_dce);
NIR_PASS(_, nir, nir_lower_vars_to_explicit_types,
nir_var_shader_temp | nir_var_function_temp | nir_var_mem_shared |
nir_var_mem_global,
nir_var_shader_temp | nir_var_function_temp | nir_var_mem_shared,
glsl_get_cl_type_size_align);
NIR_PASS(_, nir, nir_opt_deref);
NIR_PASS(_, nir, nir_lower_vars_to_ssa);

View file

@ -2562,8 +2562,20 @@ agx_build_meta_shader_internal(struct agx_context *ctx,
builder(&b, data);
struct agx_device *dev = agx_device(ctx->base.screen);
if (!prolog)
agx_preprocess_nir(b.shader, dev->libagx);
if (!prolog) {
/* We need to link libagx and assign shared before preprocessing, matching
* what the driver would otherwise produce.
*/
agx_link_libagx(b.shader, dev->libagx);
NIR_PASS(_, b.shader, nir_lower_vars_to_explicit_types,
nir_var_mem_shared, glsl_get_cl_type_size_align);
NIR_PASS(_, b.shader, nir_lower_explicit_io, nir_var_mem_shared,
nir_address_format_62bit_generic);
agx_preprocess_nir(b.shader, NULL);
}
struct agx_compiled_shader *shader = agx_compile_nir(
dev, b.shader, NULL, PIPE_SHADER_COMPUTE, internal_kernel,