lima/gpir: Do all lowerings before rsched
authorConnor Abbott <cwabbott0@gmail.com>
Sun, 1 Sep 2019 17:33:06 +0000 (19:33 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Mon, 9 Sep 2019 10:39:20 +0000 (17:39 +0700)
commitee8cc90e553b56e8fbab5ecbaa5b1476221401d1
tree3235da426f084811c4b46012c66b6a512ecb1957
parentae5ac26dfa13de84c09f897c828cf621729ce622
lima/gpir: Do all lowerings before rsched

The scheduler assumes that load nodes are always duplicated so that they
can always be scheduled eventually and therefore they never need to be
spilled. But some lowerings were running after the pre-RA scheduler,
whereas duplication has to happen before then since it's needed for the
scheduler to do a better job reducing register pressure. This meant
that lowerings were introducing multiple uses of a load instruction,
which broke the scheduler's expectation and resulted in infinite loops
in situations where the only nodes available to spill were load nodes.
Spilling load nodes would be silly, so we want to fix the lowerings
rather than the scheduler. Just do all lowerings before the pre-RA
scheduler, which also helps with reducing pressure since the scheduler
can more accurately compute the pressure.

Fixes lima/mesa#104.

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com>
src/gallium/drivers/lima/ir/gp/gpir.h
src/gallium/drivers/lima/ir/gp/lower.c
src/gallium/drivers/lima/ir/gp/nir.c