treewide: replace calls to nir_opt_trivial_continues() with nir_opt_loop()

Totals from 850 (1.11% of 76636) affected shaders: (RADV, GFX11)
MaxWaves: 18134 -> 18130 (-0.02%)
Instrs: 3011298 -> 3008585 (-0.09%); split: -0.17%, +0.08%
CodeSize: 15836804 -> 15841972 (+0.03%); split: -0.09%, +0.12%
VGPRs: 63580 -> 63604 (+0.04%)
SpillSGPRs: 966 -> 1148 (+18.84%); split: -0.83%, +19.67%
Latency: 36102291 -> 30186144 (-16.39%); split: -16.41%, +0.02%
InvThroughput: 9058100 -> 7011821 (-22.59%); split: -22.61%, +0.02%
VClause: 65369 -> 65364 (-0.01%); split: -0.03%, +0.02%
SClause: 100309 -> 100305 (-0.00%); split: -0.04%, +0.04%
Copies: 335658 -> 336472 (+0.24%); split: -0.70%, +0.94%
Branches: 110806 -> 108945 (-1.68%); split: -1.94%, +0.26%
PreSGPRs: 73476 -> 73934 (+0.62%); split: -0.25%, +0.87%
PreVGPRs: 58809 -> 58840 (+0.05%); split: -0.01%, +0.06%

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24940>
This commit is contained in:
Daniel Schürmann 2023-08-08 12:27:41 +02:00 committed by Marge Bot
parent 9808ef0349
commit a3ed36da1a
19 changed files with 32 additions and 32 deletions

View file

@ -202,9 +202,9 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively)
NIR_LOOP_PASS(progress, skip, shader, nir_copy_prop);
NIR_LOOP_PASS(progress, skip, shader, nir_opt_remove_phis);
NIR_LOOP_PASS(progress, skip, shader, nir_opt_dce);
bool trivial_continues_progress = false;
NIR_LOOP_PASS(trivial_continues_progress, skip, shader, nir_opt_trivial_continues);
if (trivial_continues_progress) {
bool opt_loop_progress = false;
NIR_LOOP_PASS(opt_loop_progress, skip, shader, nir_opt_loop);
if (opt_loop_progress) {
progress = true;
NIR_LOOP_PASS(progress, skip, shader, nir_copy_prop);
NIR_LOOP_PASS(progress, skip, shader, nir_opt_remove_phis);

View file

@ -2095,7 +2095,7 @@ v3d_optimize_nir(struct v3d_compile *c, struct nir_shader *s)
NIR_PASS(progress, s, nir_opt_idiv_const, 32);
NIR_PASS(progress, s, nir_lower_alu);
if (nir_opt_trivial_continues(s)) {
if (nir_opt_loop(s)) {
progress = true;
NIR_PASS(progress, s, nir_copy_prop);
NIR_PASS(progress, s, nir_opt_dce);

View file

@ -76,7 +76,7 @@ gl_nir_opts(nir_shader *nir)
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_remove_phis);
NIR_PASS(progress, nir, nir_opt_dce);
if (nir_opt_trivial_continues(nir)) {
if (nir_opt_loop(nir)) {
progress = true;
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_dce);

View file

@ -177,9 +177,9 @@ ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s)
}
progress |= OPT(s, nir_opt_dead_cf);
if (OPT(s, nir_opt_trivial_continues)) {
if (OPT(s, nir_opt_loop)) {
progress |= true;
/* If nir_opt_trivial_continues makes progress, then we need to clean
/* If nir_opt_loop makes progress, then we need to clean
* things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
* to make progress.
*/

View file

@ -3344,7 +3344,7 @@ ntt_optimize_nir(struct nir_shader *s, struct pipe_screen *screen,
NIR_PASS(progress, s, nir_opt_load_store_vectorize, &vectorize_opts);
NIR_PASS(progress, s, nir_opt_shrink_stores, true);
NIR_PASS(progress, s, nir_opt_shrink_vectors);
NIR_PASS(progress, s, nir_opt_trivial_continues);
NIR_PASS(progress, s, nir_opt_loop);
NIR_PASS(progress, s, nir_opt_vectorize, ntt_should_vectorize_instr, NULL);
NIR_PASS(progress, s, nir_opt_undef);
NIR_PASS(progress, s, nir_opt_loop_unroll);

View file

@ -2380,7 +2380,7 @@ ttn_optimize_nir(nir_shader *nir)
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_remove_phis);
NIR_PASS(progress, nir, nir_opt_dce);
if (nir_opt_trivial_continues(nir)) {
if (nir_opt_loop(nir)) {
progress = true;
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_dce);

View file

@ -157,9 +157,9 @@ etna_optimize_loop(nir_shader *s)
progress |= OPT(s, nir_opt_algebraic);
progress |= OPT(s, nir_opt_constant_folding);
progress |= OPT(s, nir_opt_dead_cf);
if (OPT(s, nir_opt_trivial_continues)) {
if (OPT(s, nir_opt_loop)) {
progress = true;
/* If nir_opt_trivial_continues makes progress, then we need to clean
/* If nir_opt_loop makes progress, then we need to clean
* things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
* to make progress.
*/

View file

@ -87,9 +87,9 @@ ir2_optimize_loop(nir_shader *s)
progress |= OPT(s, nir_opt_algebraic);
progress |= OPT(s, nir_opt_constant_folding);
progress |= OPT(s, nir_opt_dead_cf);
if (OPT(s, nir_opt_trivial_continues)) {
if (OPT(s, nir_opt_loop)) {
progress |= true;
/* If nir_opt_trivial_continues makes progress, then we need to clean
/* If nir_opt_loop makes progress, then we need to clean
* things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
* to make progress.
*/

View file

@ -214,7 +214,7 @@ i915_optimize_nir(struct nir_shader *s)
NIR_PASS(progress, s, nir_opt_constant_folding);
NIR_PASS(progress, s, nir_opt_shrink_stores, true);
NIR_PASS(progress, s, nir_opt_shrink_vectors);
NIR_PASS(progress, s, nir_opt_trivial_continues);
NIR_PASS(progress, s, nir_opt_loop);
NIR_PASS(progress, s, nir_opt_undef);
NIR_PASS(progress, s, nir_opt_loop_unroll);

View file

@ -97,7 +97,7 @@ r300_optimize_nir(struct nir_shader *s, struct pipe_screen *screen)
NIR_PASS(progress, s, nir_opt_load_store_vectorize, &vectorize_opts);
NIR_PASS(progress, s, nir_opt_shrink_stores, true);
NIR_PASS(progress, s, nir_opt_shrink_vectors);
NIR_PASS(progress, s, nir_opt_trivial_continues);
NIR_PASS(progress, s, nir_opt_loop);
NIR_PASS(progress, s, nir_opt_vectorize, r300_should_vectorize_instr, NULL);
NIR_PASS(progress, s, nir_opt_undef);
if(!progress)

View file

@ -647,7 +647,7 @@ optimize_once(nir_shader *shader)
NIR_PASS(progress, shader, nir_opt_copy_prop_vars);
NIR_PASS(progress, shader, nir_opt_remove_phis);
if (nir_opt_trivial_continues(shader)) {
if (nir_opt_loop(shader)) {
progress = true;
NIR_PASS(progress, shader, nir_copy_prop);
NIR_PASS(progress, shader, nir_opt_dce);

View file

@ -91,7 +91,7 @@ void si_nir_opts(struct si_screen *sscreen, struct nir_shader *nir, bool first)
NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
NIR_PASS(progress, nir, nir_opt_dead_write_vars);
NIR_PASS(lower_alu_to_scalar, nir, nir_opt_trivial_continues);
NIR_PASS(lower_alu_to_scalar, nir, nir_opt_loop);
/* (Constant) copy propagation is needed for txf with offsets. */
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_remove_phis);

View file

@ -235,11 +235,11 @@ optimize(nir_shader *nir)
NIR_PASS(progress, nir, nir_opt_constant_folding);
NIR_PASS(progress, nir, nir_opt_remove_phis);
bool trivial_continues = false;
NIR_PASS(trivial_continues, nir, nir_opt_trivial_continues);
progress |= trivial_continues;
if (trivial_continues) {
/* If nir_opt_trivial_continues makes progress, then we need to clean
bool loop = false;
NIR_PASS(loop, nir, nir_opt_loop);
progress |= loop;
if (loop) {
/* If nir_opt_loop makes progress, then we need to clean
* things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
* to make progress.
*/

View file

@ -709,8 +709,8 @@ brw_nir_optimize(nir_shader *nir, bool is_scalar,
}
OPT(nir_opt_dead_cf);
if (OPT(nir_opt_trivial_continues)) {
/* If nir_opt_trivial_continues makes progress, then we need to clean
if (OPT(nir_opt_loop)) {
/* If nir_opt_loop makes progress, then we need to clean
* things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
* to make progress.
*/

View file

@ -1114,7 +1114,7 @@ dxil_spirv_nir_passes(nir_shader *nir,
NIR_PASS(progress, nir, nir_opt_undef);
NIR_PASS(progress, nir, nir_opt_constant_folding);
NIR_PASS(progress, nir, nir_opt_cse);
if (nir_opt_trivial_continues(nir)) {
if (nir_opt_loop(nir)) {
progress = true;
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_dce);

View file

@ -3304,7 +3304,7 @@ Converter::run()
progress = false;
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_remove_phis);
NIR_PASS(progress, nir, nir_opt_trivial_continues);
NIR_PASS(progress, nir, nir_opt_loop);
NIR_PASS(progress, nir, nir_opt_cse);
NIR_PASS(progress, nir, nir_opt_algebraic);
NIR_PASS(progress, nir, nir_opt_constant_folding);

View file

@ -116,10 +116,10 @@ optimize_nir(nir_shader *nir, const struct nak_compiler *nak, bool allow_copies)
}
OPT(nir, nir_opt_dead_cf);
if (OPT(nir, nir_opt_trivial_continues)) {
/* If nir_opt_trivial_continues makes progress, then we need to clean
* things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
* to make progress.
if (OPT(nir, nir_opt_loop)) {
/* If nir_opt_loop makes progress, then we need to clean things up
* if we want any hope of nir_opt_if or nir_opt_loop_unroll to make
* progress.
*/
OPT(nir, nir_copy_prop);
OPT(nir, nir_opt_dce);

View file

@ -149,7 +149,7 @@ nvk_cg_optimize_nir(nir_shader *nir)
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_remove_phis);
NIR_PASS(progress, nir, nir_opt_dce);
if (nir_opt_trivial_continues(nir)) {
if (nir_opt_loop(nir)) {
progress = true;
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_remove_phis);

View file

@ -264,7 +264,7 @@ panvk_per_arch(shader_create)(struct panvk_device *dev, gl_shader_stage stage,
NIR_PASS_V(nir, nir_opt_copy_prop_vars);
NIR_PASS_V(nir, nir_opt_combine_stores, nir_var_all);
NIR_PASS_V(nir, nir_opt_trivial_continues);
NIR_PASS_V(nir, nir_opt_loop);
/* Do texture lowering here. Yes, it's a duplication of the texture
* lowering in bifrost_compile. However, we need to lower texture stuff