agx: optimize scratch access
so we can use designated initializers and other fun features. all affected shaders are in gfxbench: total instructions in shared programs: 2750549 -> 2750497 (<.01%) instructions in affected programs: 10832 -> 10780 (-0.48%) helped: 4 HURT: 2 Inconclusive result (value mean confidence interval includes 0). total alu in shared programs: 2278478 -> 2278760 (0.01%) alu in affected programs: 7040 -> 7322 (4.01%) helped: 2 HURT: 4 Alu are HURT. total fscib in shared programs: 2276985 -> 2277267 (0.01%) fscib in affected programs: 7040 -> 7322 (4.01%) helped: 2 HURT: 4 Fscib are HURT. total bytes in shared programs: 19922466 -> 19922734 (<.01%) bytes in affected programs: 71412 -> 71680 (0.38%) helped: 4 HURT: 2 Inconclusive result (value mean confidence interval includes 0). total regs in shared programs: 865070 -> 865086 (<.01%) regs in affected programs: 142 -> 158 (11.27%) helped: 0 HURT: 2 total uniforms in shared programs: 2120930 -> 2121034 (<.01%) uniforms in affected programs: 244 -> 348 (42.62%) helped: 0 HURT: 2 total scratch in shared programs: 11576 -> 11600 (0.21%) scratch in affected programs: 2744 -> 2768 (0.87%) helped: 0 HURT: 2 total spills in shared programs: 958 -> 868 (-9.39%) spills in affected programs: 958 -> 868 (-9.39%) helped: 6 HURT: 0 total fills in shared programs: 732 -> 626 (-14.48%) fills in affected programs: 732 -> 626 (-14.48%) helped: 4 HURT: 2 Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32529>
This commit is contained in:
committed by
Marge Bot
parent
923e6361d1
commit
b7f2d480da
@@ -3692,8 +3692,7 @@ agx_preprocess_nir(nir_shader *nir, const nir_shader *libagx)
|
||||
|
||||
/* Lower large arrays to scratch and small arrays to csel */
|
||||
NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 256,
|
||||
glsl_get_natural_size_align_bytes,
|
||||
glsl_get_natural_size_align_bytes);
|
||||
glsl_get_natural_size_align_bytes, glsl_get_word_size_align_bytes);
|
||||
NIR_PASS(_, nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0);
|
||||
NIR_PASS(_, nir, nir_split_var_copies);
|
||||
NIR_PASS(_, nir, nir_lower_global_vars_to_local);
|
||||
@@ -3801,6 +3800,13 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key,
|
||||
};
|
||||
NIR_PASS(_, nir, nir_lower_mem_access_bit_sizes, &lower_mem_access_options);
|
||||
|
||||
/* Optimize scratch access */
|
||||
NIR_PASS(_, nir, nir_lower_scratch_to_var);
|
||||
NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 256,
|
||||
glsl_get_natural_size_align_bytes,
|
||||
glsl_get_natural_size_align_bytes);
|
||||
NIR_PASS(_, nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0);
|
||||
|
||||
/* Cleanup 8-bit math before lowering */
|
||||
bool progress;
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user