Mesa (staging/20.3): ac/nir: use llvm.readcyclecounter for LLVM9+
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jan 6 18:02:20 UTC 2021
Module: Mesa
Branch: staging/20.3
Commit: 071a87ac7f9e218b2f11be85d04b4786a3e6dad6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=071a87ac7f9e218b2f11be85d04b4786a3e6dad6
Author: Rhys Perry <pendingchaos02 at gmail.com>
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 <pendingchaos02 at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4033
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8306>
(cherry picked from commit c5973ede01c4d5458b3d487f7b7486707d905c52)
---
.pick_status.json | 2 +-
src/amd/llvm/ac_llvm_build.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index f5386e3c237..a5b53269bc1 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1075,7 +1075,7 @@
"description": "ac/nir: use llvm.readcyclecounter for LLVM9+",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c
index 00a3346928f..27bfa411387 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, "");
}
More information about the mesa-commit
mailing list