Mesa (master): ac/nir: implement nir_intrinsic_shader_clock with device scope
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun May 24 19:42:34 UTC 2020
Module: Mesa
Branch: master
Commit: 14292310d930263cdea9de57ca28faee628c4a78
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=14292310d930263cdea9de57ca28faee628c4a78
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Wed May 20 10:07:26 2020 +0200
ac/nir: implement nir_intrinsic_shader_clock with device scope
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5117>
---
src/amd/llvm/ac_llvm_build.c | 5 +++--
src/amd/llvm/ac_llvm_build.h | 3 ++-
src/amd/llvm/ac_nir_to_llvm.c | 3 ++-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c
index db953019edd..ef4c95e5673 100644
--- a/src/amd/llvm/ac_llvm_build.c
+++ b/src/amd/llvm/ac_llvm_build.c
@@ -457,9 +457,10 @@ ac_build_optimization_barrier(struct ac_llvm_context *ctx,
}
LLVMValueRef
-ac_build_shader_clock(struct ac_llvm_context *ctx)
+ac_build_shader_clock(struct ac_llvm_context *ctx, nir_scope scope)
{
- LLVMValueRef tmp = ac_build_intrinsic(ctx, "llvm.amdgcn.s.memtime", ctx->i64, NULL, 0, 0);
+ const char *name = scope == NIR_SCOPE_DEVICE ? "llvm.amdgcn.s.memrealtime" : "llvm.amdgcn.s.memtime";
+ LLVMValueRef tmp = ac_build_intrinsic(ctx, name, ctx->i64, NULL, 0, 0);
return LLVMBuildBitCast(ctx->builder, tmp, ctx->v2i32, "");
}
diff --git a/src/amd/llvm/ac_llvm_build.h b/src/amd/llvm/ac_llvm_build.h
index 703f7ea31cc..a4777f12f07 100644
--- a/src/amd/llvm/ac_llvm_build.h
+++ b/src/amd/llvm/ac_llvm_build.h
@@ -181,7 +181,8 @@ void ac_build_s_barrier(struct ac_llvm_context *ctx);
void ac_build_optimization_barrier(struct ac_llvm_context *ctx,
LLVMValueRef *pvgpr);
-LLVMValueRef ac_build_shader_clock(struct ac_llvm_context *ctx);
+LLVMValueRef ac_build_shader_clock(struct ac_llvm_context *ctx,
+ nir_scope scope);
LLVMValueRef ac_build_ballot(struct ac_llvm_context *ctx, LLVMValueRef value);
LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx,
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index 27fd64ef6c0..e6f4e79aa58 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -3864,7 +3864,8 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
result = visit_image_size(ctx, instr, false);
break;
case nir_intrinsic_shader_clock:
- result = ac_build_shader_clock(&ctx->ac);
+ result = ac_build_shader_clock(&ctx->ac,
+ nir_intrinsic_memory_scope(instr));
break;
case nir_intrinsic_discard:
case nir_intrinsic_discard_if:
More information about the mesa-commit
mailing list