Mesa (master): radeonsi: don't declare LDS in PS when ds_bpermute is used

Marek Olšák mareko at kemper.freedesktop.org
Tue Oct 4 14:13:49 UTC 2016


Module: Mesa
Branch: master
Commit: 71a5cf6f3b8c6baee8ec71f1a2bef3b2efa5b91a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=71a5cf6f3b8c6baee8ec71f1a2bef3b2efa5b91a

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Oct  2 22:01:38 2016 +0200

radeonsi: don't declare LDS in PS when ds_bpermute is used

I guess this is not needed because dead code elimination removes
the declaration.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

---

 src/gallium/drivers/radeonsi/si_pipe.c   | 3 +++
 src/gallium/drivers/radeonsi/si_pipe.h   | 1 +
 src/gallium/drivers/radeonsi/si_shader.c | 7 +++----
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 43d6377..2aa679c 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -817,6 +817,9 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
 		 sscreen->b.info.pfp_fw_version >= 121 &&
 		 sscreen->b.info.me_fw_version >= 87);
 
+	sscreen->has_ds_bpermute = HAVE_LLVM >= 0x0309 &&
+				   sscreen->b.chip_class >= VI;
+
 	sscreen->b.has_cp_dma = true;
 	sscreen->b.has_streamout = true;
 	pipe_mutex_init(sscreen->shader_parts_mutex);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 558e185..3cefee7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -83,6 +83,7 @@ struct si_screen {
 	unsigned			tess_offchip_block_dw_size;
 	bool				has_distributed_tess;
 	bool				has_draw_indirect_multi;
+	bool				has_ds_bpermute;
 
 	/* Whether shaders are monolithic (1-part) or separate (3-part). */
 	bool				use_monolithic_shaders;
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 7844ebd..30bf093 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5009,8 +5009,6 @@ static void si_llvm_emit_ddxy(
 	LLVMValueRef thread_id, tl, trbl, tl_tid, trbl_tid, val, args[2];
 	int idx;
 	unsigned mask;
-	bool has_ds_bpermute = HAVE_LLVM >= 0x0309 &&
-			       ctx->screen->b.chip_class >= VI;
 
 	thread_id = get_thread_id(ctx);
 
@@ -5031,7 +5029,7 @@ static void si_llvm_emit_ddxy(
 
 	val = LLVMBuildBitCast(gallivm->builder, emit_data->args[0], ctx->i32, "");
 
-	if (has_ds_bpermute) {
+	if (ctx->screen->has_ds_bpermute) {
 		args[0] = LLVMBuildMul(gallivm->builder, tl_tid,
 				       lp_build_const_int32(gallivm, 4), "");
 		args[1] = val;
@@ -5738,7 +5736,8 @@ static void create_function(struct si_shader_context *ctx)
 		for (; i < num_params; ++i)
 			shader->info.num_input_vgprs += llvm_get_type_size(params[i]) / 4;
 
-	if (bld_base->info &&
+	if (!ctx->screen->has_ds_bpermute &&
+	    bld_base->info &&
 	    (bld_base->info->opcode_count[TGSI_OPCODE_DDX] > 0 ||
 	     bld_base->info->opcode_count[TGSI_OPCODE_DDY] > 0 ||
 	     bld_base->info->opcode_count[TGSI_OPCODE_DDX_FINE] > 0 ||




More information about the mesa-commit mailing list