Skip to content

aco: Spilling Fixes and VGPR Spilling

Daniel Schürmann requested to merge daniel-schuermann/mesa:cssa into master

This series fixes a bunch of issues with Spilling on SSA.

  • An algorithm to lower to CSSA before spilling is added
  • various bug fixes which affect correctness of spilling
  • VGPR spilling is added (this seems still to have some bug as flickering appears in games if the register pressure is forced to something very low)

aco: Lower to CSSA

Converting to 'Conventional SSA Form' ensures correctness w.r.t. spilling of phi nodes. Previously, it was possible that phi operands have intersecting live-ranges, and thus, couldn't get spilled to the same spilling slot. For this reason, ACO tried to avoid to spill phis, even if it was beneficial. This patch implements a conversion pass which is currently only called if spilling is necessary. This lowering pass not only detects intersecting live range of phi operands, but also tries to insert the copies at beneficial points, i.e. not into empty blocks and at LCA's if multiple operands share the same value.

When called on all shaders, it creates the following shader stats:

  • 57559 shaders in 28980 tests
  • Totals:
  • SGPRS: 2895271 -> 2895071 (-0.01 %)
  • VGPRS: 1981304 -> 1982188 (0.04 %)
  • Spilled SGPRs: 868 -> 868 (0.00 %)
  • Spilled VGPRs: 0 -> 0 (0.00 %)
  • Private memory VGPRs: 0 -> 0 (0.00 %)
  • Scratch size: 10348 -> 10348 (0.00 %) dwords per thread
  • Code Size: 114455544 -> 114461580 (0.01 %) bytes
  • LDS: 933 -> 933 (0.00 %) blocks
  • Max Waves: 378759 -> 378728 (-0.01 %)

When called only on shaders which need spilling, there is basically no difference:

  • Code Size: 114455544 -> 114457064 (0.00 %) bytes
Edited by Daniel Schürmann

Merge request reports