nir: improve divergence analysis for loads with non-uniform resources
authorRhys Perry <pendingchaos02@gmail.com>
Fri, 22 May 2020 12:39:06 +0000 (13:39 +0100)
committerRhys Perry <pendingchaos02@gmail.com>
Tue, 8 Dec 2020 13:02:27 +0000 (13:02 +0000)
commitd1283083eac00c6466a0f066df732699b7074c6f
treee929ec93cec7a85910fc6711effb94e4754643c8
parentb1619109ca91f5b9b4f29d75479241ec82c31549
nir: improve divergence analysis for loads with non-uniform resources

If ACCESS_NON_UNIFORM is not specified, we can assume the resource is
uniform. This requires nir_lower_non_uniform_access to remove that flag.

A few Detroit: Become Human shaders use a index sourced from a fragment
input which is expected to be uniform.

shader-db (Navi):
Totals from 8 (0.01% of 127638) affected shaders:
SGPRs: 224 -> 384 (+71.43%)
VGPRs: 208 -> 112 (-46.15%)
CodeSize: 5360 -> 5344 (-0.30%); split: -1.49%, +1.19%
Instrs: 1036 -> 1028 (-0.77%); split: -1.93%, +1.16%
VMEM: 1320 -> 608 (-53.94%)
SMEM: 384 -> 336 (-12.50%); split: +14.58%, -27.08%
VClause: 24 -> 16 (-33.33%)
SClause: 48 -> 56 (+16.67%)
PreSGPRs: 124 -> 216 (+74.19%)
PreVGPRs: 168 -> 88 (-47.62%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5201>
src/compiler/nir/nir_divergence_analysis.c