Skip to content

lima/ppir: remove nir_legacy

Erico Nunes requested to merge enunes/mesa:lima-ppir-unlegacy into main

Worked on this a few weeks ago, still needs to be entirely finished. Reached a point where there were no test regressions and /almost/ the same instruction count as we get with nir_legacy. The main difference are the shaders with nir_intrinsic_legacy_{fsat,fneg,fabs} which are less trivial to optimize at that stage. I think it is because this is when they become registers with load_reg store_reg etc so non trivial to optimize here. At this point once again started wondering about reworking a significant portion of ppir and finally setting up a backend optimization loop. That might take too long, maybe we want to merge this anyway with little impact if we can unblock more mesa progress by reducing dependency on nir_legacy? cc @alyssa if still interested in moving forward with removing the remaining users of the nir_legacy stuff some time soon.

Update: this should be good to review now. This now also includes folding for the other modifiers that we did not do previously as well.

Update 2: I did a new iteration of this allowing more cases to go through folding and the results are now a bit better. For most of the register cases we could actually proceed with folding so the register intrinsics don't actually affect it much anymore. For the dest folding case specifically with successors in other blocks unfortunately we can't really since we currently don't track and therefore can't easily update all the sources that consume the dest modifier in the other blocks. The worst cases here are large spilling shaders where adding the 1 extra instruction from the dest modifier in another block completely changes spilling behavior. Updated stats below:

total instructions in shared programs: 28132 -> 28041 (-0.32%)
instructions in affected programs: 5919 -> 5828 (-1.54%)
helped: 58
HURT: 10
helped stats (abs) min: 1 max: 6 x̄: 2.16 x̃: 1
helped stats (rel) min: 0.60% max: 15.38% x̄: 4.77% x̃: 4.64%
HURT stats (abs)   min: 1 max: 10 x̄: 3.40 x̃: 2
HURT stats (rel)   min: 0.62% max: 4.33% x̄: 1.70% x̃: 1.87%
95% mean confidence interval for instructions value: -2.01 -0.67
95% mean confidence interval for instructions %-change: -4.70% -2.95%
Instructions are helped.
Edited by Erico Nunes

Merge request reports

Loading