Skip to content

nir+ir3: address calculation optimizations (2nd approach)

Rob Clark requested to merge robclark/mesa:wip/addr-calc-v2 into master

Alternative approach to !2141 (closed)

This introduces an amul instruction to be used in address calculation, rather than directly using imul. For drivers that don't set has_imul24, these will be converted to imul. Drivers that do have imul24 should call the new nir_lower_amul() pass which will lower the amuls to either imul24 or imul depending on whether signed 24b math is sufficient to construct an offset.

Still needs some patch cleanup.. but I think overall I like this better than !2141 (closed), and it does handle more cases (with slightly better shader-db numbers as a result). It would be a bit nicer if (a) register access was also intrinsics, and (b) we had a generic(ish) way to identify offset and block-id parameters to intrinsics. (Or maybe if the src parameter orders were better aligned.)

total instructions in shared programs: 8693021 -> 8666432 (-0.31%)
instructions in affected programs: 171704 -> 145115 (-15.49%)
helped: 746
HURT: 0

total full in shared programs: 364087 -> 364007 (-0.02%)
full in affected programs: 815 -> 735 (-9.82%)
helped: 89
HURT: 3
Edited by Rob Clark

Merge request reports