From 870d17012ac8cd4d3c079d5aa73f7c1361a5b875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 30 Apr 2025 22:31:22 -0400 Subject: [PATCH] ac: adjust maximum HS workgroup size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has no effect on triangles because max 64 patches implied max 192 threads, but it improves performance for cases when the number of threads per patch is > 3. This improves the score for gfxbench5 "gl_tess_off" (offscreen) by 11% on Navi48. Reviewed-by: Timur Kristóf Part-of: --- src/amd/common/ac_shader_util.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/amd/common/ac_shader_util.c b/src/amd/common/ac_shader_util.c index b86583f5f80..f9d5e2153a3 100644 --- a/src/amd/common/ac_shader_util.c +++ b/src/amd/common/ac_shader_util.c @@ -942,15 +942,12 @@ uint32_t ac_compute_num_tess_patches(const struct radeon_info *info, uint32_t nu if (has_primid_instancing_bug && tess_uses_primid) return 1; - /* 256 threads per workgroup is the hw limit. */ + /* 256 threads per workgroup is the hw limit, but 192 performs better. */ const unsigned num_threads_per_patch = MAX2(num_tcs_input_cp, num_tcs_output_cp); - unsigned num_patches = 256 / num_threads_per_patch; + unsigned num_patches = 192 / num_threads_per_patch; - /* Not necessary for correctness, but higher numbers are slower. - * The hardware can do more, but we prefer fully occupied waves. - * eg. 64 triangle patches means 3 fully occupied Wave64 waves. - */ - num_patches = MIN2(num_patches, 64); + /* 127 is the maximum value that fits in tcs_offchip_layout. */ + num_patches = MIN2(num_patches, 127); /* When distributed tessellation is unsupported, switch between SEs * at a higher frequency to manually balance the workload between SEs.