[Mesa-dev] [PATCH] radeonsi/compute: Fix LDS size calculation

Tom Stellard tom at stellard.net
Thu Aug 22 08:25:49 PDT 2013


From: Tom Stellard <thomas.stellard at amd.com>

We need to include the number of LDS bytes allocated by the state tracker.
---
 src/gallium/drivers/radeonsi/radeonsi_compute.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_compute.c b/src/gallium/drivers/radeonsi/radeonsi_compute.c
index 10309ba..1adb32f 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_compute.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_compute.c
@@ -191,7 +191,13 @@ static void radeonsi_launch_grid(
 		| S_00B84C_TGID_Z_EN(1)
 		| S_00B84C_TG_SIZE_EN(1)
 		| S_00B84C_TIDIG_COMP_CNT(2)
-		| S_00B84C_LDS_SIZE(shader->lds_size)
+		/* XXX: We are over allocating LDS.  The shader reports LDS in
+		 * blocks of 256 bytes, so if there are 4 bytes lds allocated in
+		 * the shader and 4 bytes allocated by the state tracker, then
+		 * we will set LDS_SIZE to 512 bytes rather than 256.
+		 */
+		| S_00B84C_LDS_SIZE(shader->lds_size +
+				(align(program->local_size, 256) >> 8) + 1)
 		| S_00B84C_EXCP_EN(0))
 		;
 	si_pm4_set_reg(pm4, R_00B854_COMPUTE_RESOURCE_LIMITS, 0);
-- 
1.8.1.5



More information about the mesa-dev mailing list