elk: Call nir_opt_algebraic_late in elk_postprocess_nir

Make sure that lowering undone in elk_nir_optimize are reapplied.

No shader-db or fossil-db changes on any Intel platform. This is most
likely to impact either Gfx8 on ANV or Gfx7.5 on HASVK. I don't
fossil-db test either of those platforms.

I tried doing a similar thing here as is done in BRW (previous commit),
but that caused a couple Haswell shaders to fall off a performance
cliff:

total spills in shared programs: 8247 -> 8311 (0.78%)
spills in affected programs: 6 -> 70 (1066.67%)
helped: 0 / HURT: 2

total fills in shared programs: 8558 -> 8910 (4.11%)
fills in affected programs: 6 -> 358 (5866.67%)
helped: 0 / HURT: 2

Fixes: 442daeb54a ("nir/opt_algebraic: use fcanonicalize")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
(cherry picked from commit df704bd38e)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
Ian Romanick 2026-01-22 18:28:39 -08:00 committed by Eric Engestrom
parent 1f65b768a1
commit 0710d042db
2 changed files with 6 additions and 2 deletions

View file

@ -4504,7 +4504,7 @@
"description": "elk: Call nir_opt_algebraic_late in elk_postprocess_nir",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "442daeb54a2e43bd450ebbb37fc05001f4acd08f",
"notes": null

View file

@ -1601,8 +1601,12 @@ elk_postprocess_nir(nir_shader *nir, const struct elk_compiler *compiler,
};
OPT(nir_lower_subgroups, &subgroups_options);
if (OPT(nir_lower_int64))
if (OPT(nir_lower_int64)) {
elk_nir_optimize(nir, is_scalar, devinfo);
/* elk_nir_optimize undoes late lowerings. */
OPT(nir_opt_algebraic_late);
}
}
/* Do this only after the last opt_gcm. GCM will undo this lowering. */