Mesa (main): ac/llvm: conditionally check wave id in gs sendmsg

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 27 02:37:20 UTC 2022


Module: Mesa
Branch: main
Commit: 74e596a5f0fbb790af70927ae25ab757142a84a8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=74e596a5f0fbb790af70927ae25ab757142a84a8

Author: Qiang Yu <yuq825 at gmail.com>
Date:   Wed Jun 15 10:34:51 2022 +0800

ac/llvm: conditionally check wave id in gs sendmsg

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 <timur.kristof at gmail.com>
Signed-off-by: Qiang Yu <yuq825 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17130>

---

 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;



More information about the mesa-commit mailing list