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

Author: Rhys Perry <[email protected]>
Date:   Mon Jan  4 13:06:15 2021 +0000

ac/nir: use llvm.readcyclecounter for LLVM9+

Unlike llvm.amdgcn.s.memtime, this works on GFX10.3

Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4033
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8306>

---

 src/amd/llvm/ac_llvm_build.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c
index b25981e0df9..93d408bcfb1 100644
--- a/src/amd/llvm/ac_llvm_build.c
+++ b/src/amd/llvm/ac_llvm_build.c
@@ -427,8 +427,9 @@ void ac_build_optimization_barrier(struct ac_llvm_context 
*ctx, LLVMValueRef *pv
 
 LLVMValueRef ac_build_shader_clock(struct ac_llvm_context *ctx, nir_scope 
scope)
 {
-   const char *name =
-      scope == NIR_SCOPE_DEVICE ? "llvm.amdgcn.s.memrealtime" : 
"llvm.amdgcn.s.memtime";
+   const char *subgroup = LLVM_VERSION_MAJOR >= 9 ? "llvm.readcyclecounter" : 
"llvm.amdgcn.s.memtime";
+   const char *name = scope == NIR_SCOPE_DEVICE ? "llvm.amdgcn.s.memrealtime" 
: subgroup;
+
    LLVMValueRef tmp = ac_build_intrinsic(ctx, name, ctx->i64, NULL, 0, 0);
    return LLVMBuildBitCast(ctx->builder, tmp, ctx->v2i32, "");
 }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to