Skip to content

lima/ppir: rework liveness data structures to bitset

Erico Nunes requested to merge enunes/mesa:lima-ppir-optimize-liveness into master

This is an incremental patchset to optimize the data structures in ppir regalloc so it is less of a bottleneck in complicated shaders.

This was motivated by the reported slow loading time in gtk4 applications due to some extremely complicated shaders compiled at startup. These are 16 shaders that spill a total of 158 times therefore causing 158 invocations of regalloc/liveness. According to perf, just compiling those shaders, regalloc was taking roughly 50% of the total time. This patchset brings regalloc down to ~20% of the total (still a lot of spill iterations so makes sense to be significant). In measured time just to compile the shaders sequentially, this brings it down from 4.8s to 2.8s. This mostly affects complicated shaders with lots of spills though, simple shaders likely don't see a significant difference.

The algorithm is exactly the same, this is just a data structure rework. There are no changes in deqp and piglit. In shader-db I see a minor positive change in very few and specific shaders, and apparently the reason is we were adding the 'internal' conflicts to live_out, which was unnecessary as live_out represented the next instruction's live set. Anyway live_out doesn't exist anymore now.

More information in the commit logs.

Merge request reports