nir/schedule: Add an option for a fallback scheduling algorithm
authorNeil Roberts <nroberts@igalia.com>
Fri, 17 Jul 2020 09:00:53 +0000 (11:00 +0200)
committerNeil Roberts <nroberts@igalia.com>
Fri, 24 Jul 2020 10:26:26 +0000 (12:26 +0200)
commit56846a2b682dc702e80ac2bbc187c8e3f5a0cb58
tree8b663fff5c35b837bdf41e4f6f57faeacd6df690
parent08f1746fad7cdcd58a2b94ae523274670eb7e67e
nir/schedule: Add an option for a fallback scheduling algorithm

The current scheduling algorithm favors parallelism a bit too
aggressively and sometimes generates shaders that fail register
allocation. This happens even if the threshold is set to zero to force
it to always use the CSR instruction choosing algorithm.

This patch adds an option to use an even more aggressive fallback that
just always picks the instruction with the shortest maximum delay in the
hope that that will generate the least register pressure. The intention
is to use this as a last resort after register allocation fails in order
to at least have a working shader.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Acked-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5953>
src/compiler/nir/nir_schedule.c
src/compiler/nir/nir_schedule.h