broadcom/compiler: do not rebuild the interference graph after each spill
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 14 Feb 2022 10:56:05 +0000 (11:56 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 18 Feb 2022 08:38:19 +0000 (08:38 +0000)
commitf3c3228522e7bde9f8b84593f12d57ae9c391002
treed6c9d2a45183f5082fde0fe9ad6d0e872eee6b45
parent59caaa7fb3cf205e4c4c67e8dc05c04d5b20ca91
broadcom/compiler: do not rebuild the interference graph after each spill

Instead, we only recompute liveness and we add new nodes and
interferences to the graph manually (we also need to patch
register classes in some cases).

To assist in this process, we also add an ip counter to our
instructions that we also recompute after each spill, which we use
to identify registers that cross thrsw boundries introduced with
TMU spills and fills and adjust their register classes accordingly
(removing their capacity to use accumulators).

This significantly reduces the CPU cost of spills. Using
shaders/closed/gputest/piano/7.shader_test as reference:

Compile time up to the first successful compile strategy in main is
~24s and with this change it is ~11s. With this speed up, we can now
try all 2-thread compile strategies (including the fallback scheduler)
in only ~15s.

A full shader-db run results in:
Total CPU time (seconds): 9904.67 -> 9087.98 (-8.25%)

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15041>
src/broadcom/compiler/nir_to_vir.c
src/broadcom/compiler/v3d_compiler.h
src/broadcom/compiler/vir.c
src/broadcom/compiler/vir_register_allocate.c