Skip to content

v3d/compiler: allow to batch spills

Iago Toral requested to merge itoral/mesa:v3d_spill_batching into master

Some shaders that need to spill hundreds of registers can take very long times to compile as each allocation attempt spills a single register and restarts the allocation process. We can significantly cut down these times if we allow the compiler to spill in batches, which should be possible if we are spilling uniforms, which is in fact the kind of spills that we do first because they have lower cost than TMU spills.

Doing this could cause us to slightly over spill in some cases (depending on the chosen batch size) leading to slightly worse performance, so for now we keep this behavior under an environment variable so we can decide to enable it in specific scenarios such as regular CTS runs where some tests take many minutes to compile and this change can make a huge difference.

In the future, we may want to enable this behavior by default, since it can be argued that after a certain number of spills, performance is no longer relevant and shifting focus to reducing compile times instead may be the smart thing to go for. Before we consider this though, we probably want to see if there are if any real world shaders outside of CTS that require enough spilling to fall in this category.

With this we can take this CTS test from 35 minutes down to less than 3 minutes: dEQP-VK.ssbo.layout.random.all_shared_buffer.5

Merge request reports