[Mesa-dev] [PATCH 2/2] radeonsi: Consider input SGPR count for compute shader SGPR count.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Tue Apr 19 12:51:14 UTC 2016


Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
 src/gallium/drivers/radeonsi/si_compute.c | 16 +++++++++++-----
 src/gallium/drivers/radeonsi/si_shader.c  |  3 ++-
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 557e892..905c169 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -81,14 +81,20 @@ static void *si_create_compute_state(
 
 		program->shader.selector = &sel;
 
-		if (si_compile_tgsi_shader(sscreen, sctx->tm, &program->shader,
-		                           true, &sctx->b.debug)) {
+		if (si_shader_create(sscreen, sctx->tm, &program->shader,
+		                     &sctx->b.debug)) {
 			FREE(sel.tokens);
 			return NULL;
 		}
 
 		scratch_enabled = shader->config.scratch_bytes_per_wave > 0;
 
+		shader->config.rsrc1 =
+			   S_00B848_VGPRS((shader->config.num_vgprs - 1) / 4) |
+			   S_00B848_SGPRS((shader->config.num_sgprs - 1) / 8) |
+			   S_00B848_DX10_CLAMP(1) |
+			   S_00B848_FLOAT_MODE(shader->config.float_mode);
+
 		shader->config.rsrc2 = S_00B84C_USER_SGPR(SI_CS_NUM_USER_SGPR) |
 			   S_00B84C_SCRATCH_EN(scratch_enabled) |
 			   S_00B84C_TGID_X_EN(1) | S_00B84C_TGID_Y_EN(1) |
@@ -105,10 +111,10 @@ static void *si_create_compute_state(
 		radeon_elf_read(code, header->num_bytes, &program->shader.binary);
 		si_shader_binary_read_config(&program->shader.binary,
 			     &program->shader.config, 0);
+		si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
+			       PIPE_SHADER_COMPUTE, stderr);
+		si_shader_binary_upload(sctx->screen, &program->shader);
 	}
-	si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
-		       TGSI_PROCESSOR_COMPUTE, stderr);
-	si_shader_binary_upload(sctx->screen, &program->shader);
 
 	return program;
 }
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 605b964..3bf68eb 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -7022,7 +7022,8 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
 	     (shader->key.vs.as_es != mainp->key.vs.as_es ||
 	      shader->key.vs.as_ls != mainp->key.vs.as_ls)) ||
 	    (shader->selector->type == PIPE_SHADER_TESS_EVAL &&
-	     shader->key.tes.as_es != mainp->key.tes.as_es)) {
+	     shader->key.tes.as_es != mainp->key.tes.as_es) ||
+	    shader->selector->type == PIPE_SHADER_COMPUTE) {
 		/* Monolithic shader (compiled as a whole, has many variants,
 		 * may take a long time to compile).
 		 */
-- 
2.8.0



More information about the mesa-dev mailing list