Mesa (master): ac/llvm: Fix ac_build_reduce in wave32 mode.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 10 11:47:44 UTC 2020


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

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Fri Jan 10 12:06:53 2020 +0100

ac/llvm: Fix ac_build_reduce in wave32 mode.

Previously, when cluster_size was set to 0, it always worked as if
the cluster size was 64. This commit fixes it in wave32 mode by
changing to work as if the cluster size was set to 32.

Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

---

 src/amd/llvm/ac_llvm_build.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c
index 79831260066..e97eb919c6a 100644
--- a/src/amd/llvm/ac_llvm_build.c
+++ b/src/amd/llvm/ac_llvm_build.c
@@ -4344,12 +4344,15 @@ ac_build_reduce(struct ac_llvm_context *ctx, LLVMValueRef src, nir_op op, unsign
 	if (cluster_size == 32) return ac_build_wwm(ctx, result);
 
 	if (ctx->chip_class >= GFX8) {
-		if (ctx->chip_class >= GFX10)
-			swap = ac_build_readlane(ctx, result, LLVMConstInt(ctx->i32, 31, false));
-		else
-			swap = ac_build_dpp(ctx, identity, result, dpp_row_bcast31, 0xc, 0xf, false);
-		result = ac_build_alu_op(ctx, result, swap, op);
-		result = ac_build_readlane(ctx, result, LLVMConstInt(ctx->i32, 63, 0));
+		if (ctx->wave_size == 64) {
+			if (ctx->chip_class >= GFX10)
+				swap = ac_build_readlane(ctx, result, LLVMConstInt(ctx->i32, 31, false));
+			else
+				swap = ac_build_dpp(ctx, identity, result, dpp_row_bcast31, 0xc, 0xf, false);
+			result = ac_build_alu_op(ctx, result, swap, op);
+			result = ac_build_readlane(ctx, result, LLVMConstInt(ctx->i32, 63, 0));
+		}
+
 		return ac_build_wwm(ctx, result);
 	} else {
 		swap = ac_build_readlane(ctx, result, ctx->i32_0);




More information about the mesa-commit mailing list