[Mesa-dev] [PATCH 8/9] radeonsi: move si_shader_binary_upload out of si_compile_llvm

Marek Olšák maraeo at gmail.com
Fri Jan 1 06:14:01 PST 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_compute.c |  1 +
 src/gallium/drivers/radeonsi/si_shader.c  | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 939c7c2..01a2450 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -124,6 +124,7 @@ static void *si_create_compute_state(
                                                         code, header->num_bytes);
 			si_compile_llvm(sctx->screen, &program->kernels[i], sctx->tm,
 					mod, TGSI_PROCESSOR_COMPUTE);
+			si_shader_binary_upload(sctx->screen, &program->kernels[i]);
 			LLVMDisposeModule(mod);
 		}
 	}
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index df67ea3..df0ff48 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -3887,10 +3887,6 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
 
 	si_shader_binary_read(sscreen, shader, processor);
 
-	r = si_shader_binary_upload(sscreen, shader);
-	if (r)
-		return r;
-
 	FREE(shader->binary.config);
 	FREE(shader->binary.rodata);
 	FREE(shader->binary.global_symbol_offsets);
@@ -3975,6 +3971,8 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen,
 	r = si_compile_llvm(sscreen, si_shader_ctx->shader,
 			    si_shader_ctx->tm, bld_base->base.gallivm->module,
 			    TGSI_PROCESSOR_GEOMETRY);
+	if (!r)
+		r = si_shader_binary_upload(sscreen, si_shader_ctx->shader);
 
 	radeon_llvm_dispose(&si_shader_ctx->radeon_bld);
 
@@ -4188,6 +4186,12 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
 		goto out;
 	}
 
+	r = si_shader_binary_upload(sscreen, shader);
+	if (r) {
+		fprintf(stderr, "LLVM failed to upload shader\n");
+		goto out;
+	}
+
 	radeon_llvm_dispose(&si_shader_ctx.radeon_bld);
 
 	if (si_shader_ctx.type == TGSI_PROCESSOR_GEOMETRY) {
-- 
2.1.4



More information about the mesa-dev mailing list