[Mesa-dev] [PATCH 06/20] radeonsi: set maximum work group size based on block size

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Sat Apr 2 13:10:49 UTC 2016


Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
 src/gallium/drivers/radeonsi/si_shader.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 7c7e9e5..28c7923 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5034,6 +5034,18 @@ static void create_function(struct si_shader_context *ctx)
 					  S_0286D0_LINEAR_CENTROID_ENA(1) |
 					  S_0286D0_FRONT_FACE_ENA(1) |
 					  S_0286D0_POS_FIXED_PT_ENA(1));
+	} else if (ctx->type == TGSI_PROCESSOR_COMPUTE) {
+		const unsigned *properties = shader->selector->info.properties;
+		unsigned max_work_group_size =
+		               properties[TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH] *
+		               properties[TGSI_PROPERTY_CS_FIXED_BLOCK_HEIGHT] *
+		               properties[TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH];
+
+		assert(max_work_group_size);
+
+		radeon_llvm_add_attribute(ctx->radeon_bld.main_fn,
+		                          "amdgpu-maximum-work-group-size",
+		                          max_work_group_size);
 	}
 
 	shader->info.num_input_sgprs = 0;
-- 
2.7.4



More information about the mesa-dev mailing list