agx: Clean up after lowering address arithmetic
This avoids creating silly preambles that don't actually do anything except push a constant that we could've inlined for cheaper anyway, since nir_opt_preamble's cost model is sensitive to e.g. constant folding. This avoids a pointless preamble in split-hell. As a nice bonus, this also improves compile-time on address-heavy shaders. With a release build, CPU time in dEQP-GLES31.functional.ssbo.* reduces from 12.87s to 10.77... a 16% improvement is nothing to sneeze at. shader-db results are mostly noise. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21430>
This commit is contained in:
committed by
Marge Bot
parent
4b1f4b86ea
commit
445ca949cd
@@ -1907,8 +1907,19 @@ agx_optimize_nir(nir_shader *nir, unsigned *preamble_size)
|
||||
{
|
||||
agx_optimize_loop_nir(nir);
|
||||
|
||||
NIR_PASS_V(nir, agx_nir_lower_address);
|
||||
NIR_PASS_V(nir, nir_lower_int64);
|
||||
bool progress = false;
|
||||
NIR_PASS(progress, nir, agx_nir_lower_address);
|
||||
|
||||
/* If address lowering made progress, clean up before forming preambles.
|
||||
* Otherwise the optimized preambles might just be constants! Do it before
|
||||
* lowering int64 too, to avoid lowering constant int64 arithmetic.
|
||||
*/
|
||||
if (progress) {
|
||||
NIR_PASS_V(nir, nir_opt_constant_folding);
|
||||
NIR_PASS_V(nir, nir_opt_dce);
|
||||
}
|
||||
|
||||
NIR_PASS(progress, nir, nir_lower_int64);
|
||||
|
||||
if (likely(!(agx_debug & AGX_DBG_NOPREAMBLE)))
|
||||
NIR_PASS_V(nir, agx_nir_opt_preamble, preamble_size);
|
||||
|
||||
Reference in New Issue
Block a user