From 5716700bbf9f88839a32eee1fd6f669e6d89b015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Thu, 15 Jun 2023 13:57:48 +0200 Subject: [PATCH] r300: disable ntt regalloc for vertex shaders We have much better regalloc in the backend, and additionally having a close to ssa form means some optimizations can be more effective. RV370: total instructions in shared programs: 82500 -> 81645 (-1.04%) instructions in affected programs: 32147 -> 31292 (-2.66%) helped: 396 HURT: 1 total temps in shared programs: 12355 -> 12465 (0.89%) temps in affected programs: 368 -> 478 (29.89%) helped: 5 HURT: 96 GAINED: shaders/trine/vp-237.shader_test VS GAINED: shaders/trine/vp-79.shader_test VS RV530: total instructions in shared programs: 130706 -> 129684 (-0.78%) instructions in affected programs: 40902 -> 39880 (-2.50%) helped: 428 HURT: 1 total temps in shared programs: 16811 -> 16920 (0.65%) temps in affected programs: 421 -> 530 (25.89%) helped: 7 HURT: 89 The instruction decrease is from the channel merging pass which can be much more agressive when we have ssa-like form. The temp regressions are cases where we merge something like 3: MAD output[1].xy, const[8].xy__, input[1].ww__, temp[0].xy__; .... 12: MOV output[1].zw, none.__00; We always merge the first instruction into the second one, which means the liverange for temp[0] will be unnecessarily extended here. This can be fixed with the following draft MR https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19790 however if we ever get a VS pair scheduling support this will be solved as well as a consequence, so let it be for now. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7693 Reviewed-by: Filip Gawin Part-of: --- src/gallium/drivers/r300/r300_state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 530e938afda..d773b1fd04a 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1950,9 +1950,11 @@ static void* r300_create_vs_state(struct pipe_context* pipe, .lower_cmp = true, .lower_fabs = true, .ubo_vec4_max = 0x00ff, + .unoptimized_ra = true, }; static const struct nir_to_tgsi_options hwtcl_r500_options = { .ubo_vec4_max = 0x00ff, + .unoptimized_ra = true, }; const struct nir_to_tgsi_options *ntt_options; if (r300->screen->caps.has_tcl) {