ac/nir: fix shader clock with subgroup scope
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 20 May 2020 07:56:36 +0000 (09:56 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 24 May 2020 18:37:54 +0000 (20:37 +0200)
The compiler should emit s_memtime instead of s_memrealtime for
the subgroup scope. I don't know why this LLVM 9 checks was for
but LLVM 8 also has this amdgcn intrinsic.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5117>

src/amd/llvm/ac_llvm_build.c

index edb6c9a06c7b1b328df2ff957d1bee2355ef8a4d..db953019edd6f0b58309db943ea9b44bf118a469 100644 (file)
@@ -459,9 +459,7 @@ ac_build_optimization_barrier(struct ac_llvm_context *ctx,
 LLVMValueRef
 ac_build_shader_clock(struct ac_llvm_context *ctx)
 {
-       const char *intr = LLVM_VERSION_MAJOR >= 9 && ctx->chip_class >= GFX8 ?
-                               "llvm.amdgcn.s.memrealtime" : "llvm.readcyclecounter";
-       LLVMValueRef tmp = ac_build_intrinsic(ctx, intr, ctx->i64, NULL, 0, 0);
+       LLVMValueRef tmp = ac_build_intrinsic(ctx, "llvm.amdgcn.s.memtime", ctx->i64, NULL, 0, 0);
        return LLVMBuildBitCast(ctx->builder, tmp, ctx->v2i32, "");
 }