aco: call nir_copy_prop() and nir_opt_dce() before instruction selection

Totals from 1037 (1.31% of 79395) affected shaders: (Navi21)

MaxWaves: 18760 -> 18960 (+1.07%)
Instrs: 4865258 -> 4860063 (-0.11%); split: -0.11%, +0.00%
CodeSize: 27094112 -> 27089224 (-0.02%); split: -0.06%, +0.04%
VGPRs: 68816 -> 68000 (-1.19%)
SpillVGPRs: 2140 -> 2105 (-1.64%)
Scratch: 4237312 -> 4234240 (-0.07%)
Latency: 55894512 -> 55748035 (-0.26%); split: -0.31%, +0.05%
InvThroughput: 11611286 -> 11372897 (-2.05%); split: -2.09%, +0.03%
VClause: 145331 -> 145285 (-0.03%); split: -0.04%, +0.01%
SClause: 150339 -> 150338 (-0.00%)
Copies: 472476 -> 468470 (-0.85%); split: -0.88%, +0.03%
Branches: 206562 -> 206067 (-0.24%); split: -0.24%, +0.00%
PreVGPRs: 61747 -> 61361 (-0.63%)
VALU: 3116434 -> 3112660 (-0.12%); split: -0.13%, +0.00%
SALU: 723154 -> 722887 (-0.04%); split: -0.04%, +0.01%
VMEM: 238656 -> 238586 (-0.03%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30786>
This commit is contained in:
Daniel Schürmann 2024-08-22 11:58:42 +02:00 committed by Marge Bot
parent e030ab4bf2
commit 14de650d58
2 changed files with 14 additions and 1 deletions

View file

@ -252,7 +252,10 @@ void
setup_nir(isel_context* ctx, nir_shader* nir)
{
nir_convert_to_lcssa(nir, true, false);
nir_lower_phis_to_scalar(nir, true);
if (nir_lower_phis_to_scalar(nir, true)) {
nir_copy_prop(nir);
nir_opt_dce(nir);
}
nir_function_impl* func = nir_shader_get_entrypoint(nir);
nir_index_ssa_defs(func);

View file

@ -299,6 +299,8 @@ BEGIN_TEST(isel.cf.unreachable_continue.uniform_break)
nb->cursor = nir_after_phis(nir_loop_first_block(loop));
nir_builder_instr_insert(nb, &phi[0]->instr);
nir_builder_instr_insert(nb, &phi[1]->instr);
nir_unit_test_amd(nb, &phi[0]->def);
nir_unit_test_amd(nb, &phi[1]->def);
finish_isel_test();
END_TEST
@ -368,6 +370,8 @@ BEGIN_TEST(isel.cf.unreachable_continue.divergent_break)
nb->cursor = nir_after_phis(nir_loop_first_block(loop));
nir_builder_instr_insert(nb, &phi[0]->instr);
nir_builder_instr_insert(nb, &phi[1]->instr);
nir_unit_test_amd(nb, &phi[0]->def);
nir_unit_test_amd(nb, &phi[1]->def);
finish_isel_test();
END_TEST
@ -536,6 +540,8 @@ BEGIN_TEST(isel.cf.unreachable_continue.mixed_break)
nb->cursor = nir_after_phis(nir_loop_first_block(loop));
nir_builder_instr_insert(nb, &phi[0]->instr);
nir_builder_instr_insert(nb, &phi[1]->instr);
nir_unit_test_amd(nb, &phi[0]->def);
nir_unit_test_amd(nb, &phi[1]->def);
finish_isel_test();
END_TEST
@ -648,6 +654,8 @@ BEGIN_TEST(isel.cf.unreachable_continue.nested_mixed_break)
nb->cursor = nir_after_phis(nir_loop_first_block(loop));
nir_builder_instr_insert(nb, &phi[0]->instr);
nir_builder_instr_insert(nb, &phi[1]->instr);
nir_unit_test_amd(nb, &phi[0]->def);
nir_unit_test_amd(nb, &phi[1]->def);
finish_isel_test();
END_TEST
@ -833,6 +841,7 @@ BEGIN_TEST(isel.cf.hidden_continue)
nb->cursor = nir_after_phis(nir_loop_first_block(loop));
nir_builder_instr_insert(nb, &phi->instr);
nir_unit_test_amd(nb, &phi->def);
finish_isel_test();
END_TEST
@ -876,6 +885,7 @@ BEGIN_TEST(isel.cf.hidden_break)
nir_def_init(&phi->instr, &phi->def, 1, 32);
nir_phi_instr_add_src(phi, block, brk);
nir_builder_instr_insert(nb, &phi->instr);
nir_unit_test_amd(nb, &phi->def);
finish_isel_test();
END_TEST