From 74e596a5f0fbb790af70927ae25ab757142a84a8 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Wed, 15 Jun 2022 10:34:51 +0800 Subject: [PATCH] ac/llvm: conditionally check wave id in gs sendmsg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nir lowering already call this with wave id check, no need to check inside ac_build_sendmsg_gs_alloc_req again. Reviewed-by: Timur Kristóf Signed-off-by: Qiang Yu Part-of: --- src/amd/llvm/ac_llvm_build.c | 6 ++++-- src/amd/llvm/ac_nir_to_llvm.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index 100ed9fa251..ecc2b63303b 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -4388,7 +4388,8 @@ void ac_build_sendmsg_gs_alloc_req(struct ac_llvm_context *ctx, LLVMValueRef wav export_dummy_prim = true; } - ac_build_ifcc(ctx, LLVMBuildICmp(builder, LLVMIntEQ, wave_id, ctx->i32_0, ""), 5020); + if (wave_id) + ac_build_ifcc(ctx, LLVMBuildICmp(builder, LLVMIntEQ, wave_id, ctx->i32_0, ""), 5020); tmp = LLVMBuildShl(builder, prim_cnt, LLVMConstInt(ctx->i32, 12, false), ""); tmp = LLVMBuildOr(builder, tmp, vtx_cnt, ""); @@ -4413,7 +4414,8 @@ void ac_build_sendmsg_gs_alloc_req(struct ac_llvm_context *ctx, LLVMValueRef wav ac_build_endif(ctx, 5021); } - ac_build_endif(ctx, 5020); + if (wave_id) + ac_build_endif(ctx, 5020); } diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 1dd6e3a93f8..4ee645e746c 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -4260,10 +4260,10 @@ static void visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins break; } case nir_intrinsic_alloc_vertices_and_primitives_amd: - /* The caller should only call this conditionally for wave 0, so assume that the current - * wave is always wave 0. + /* The caller should only call this conditionally for wave 0, so pass NULL to disable + * the wave 0 check inside this function. */ - ac_build_sendmsg_gs_alloc_req(&ctx->ac, ctx->ac.i32_0, + ac_build_sendmsg_gs_alloc_req(&ctx->ac, NULL, get_src(ctx, instr->src[0]), get_src(ctx, instr->src[1])); break;