From 9835a2df83e37bd8031a335fd9ad0153385a9fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Tue, 28 Jan 2025 16:10:17 +0100 Subject: [PATCH] r300: do not limit maximum TEX group for R300/R400 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We do not have the TEX semaphore there anyway so the benefits are not as high as with R500 and the chances of running out of TEX indirections are just too high. This will increase the register pressure in some shaders, but I believe the gained shaders are worth it and there is also some cycles reduction in some cases. I'm not sure how to optimize this further without actually clonning the shader before the pair shceduling and than doing a trial and error to see if there is some compromise where we can just hit the indirection limit to not group it too much... Shader-db RV410: total instructions in shared programs: 112800 -> 112825 (0.02%) instructions in affected programs: 5024 -> 5049 (0.50%) helped: 23 HURT: 19 total temps in shared programs: 18170 -> 18244 (0.41%) temps in affected programs: 1365 -> 1439 (5.42%) helped: 39 HURT: 34 total cycles in shared programs: 169535 -> 166806 (-1.61%) cycles in affected programs: 14229 -> 11500 (-19.18%) helped: 84 HURT: 4 LOST: 0 GAINED: 8 GAINED: shaders/godot3.4/34-59.shader_test FS GAINED: shaders/lightsmark/25.shader_test FS GAINED: shaders/lightsmark/28.shader_test FS GAINED: shaders/lightsmark/34.shader_test FS GAINED: shaders/this-war-of-mine/144.shader_test FS GAINED: shaders/this-war-of-mine/145.shader_test FS GAINED: shaders/tropics/432.shader_test FS GAINED: shaders/tropics/462.shader_test FS Signed-off-by: Pavel Ondračka Reviewed-by: Filip Gawin Part-of: --- src/gallium/drivers/r300/ci/r300-rv410-fails.txt | 1 - src/gallium/drivers/r300/compiler/radeon_pair_schedule.c | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/ci/r300-rv410-fails.txt b/src/gallium/drivers/r300/ci/r300-rv410-fails.txt index bc81dd720e5..1112976b85d 100644 --- a/src/gallium/drivers/r300/ci/r300-rv410-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv410-fails.txt @@ -1032,7 +1032,6 @@ spec@glsl-1.10@execution@fs-sign-times-neg,Fail spec@glsl-1.10@execution@fs-sign-times-neg-abs,Fail spec@glsl-1.10@execution@fs-sign-times-sign,Fail spec@glsl-1.10@execution@glsl-1.10-built-in-matrix-state,Fail -spec@glsl-1.10@execution@glsl-fs-convolution-1,Fail spec@glsl-1.10@execution@glsl-fs-convolution-2,Fail spec@glsl-1.10@execution@glsl-fs-if-nested-loop,Fail spec@glsl-1.10@execution@glsl-vs-if-nested-loop,Fail diff --git a/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c b/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c index 19b20e3b679..369ada4b19e 100644 --- a/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c +++ b/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c @@ -1315,7 +1315,10 @@ rc_pair_schedule(struct radeon_compiler *cc, void *user) } else { s.CalcScore = calc_score_r300; } - s.max_tex_group = debug_get_num_option("RADEON_TEX_GROUP", 8); + /* max_tex_group is mostly R500 optimization, for R300-R400 we want to group as much + * as we can, otherwise we risk running out of TEX indirections. + */ + s.max_tex_group = debug_get_num_option("RADEON_TEX_GROUP", cc->is_r500 ? 8 : UINT_MAX); /* First go over and count all TEX. */ while (inst != &c->Base.Program.Instructions) {