ac: fix shader clock on LLVM 9
authorMarek Olšák <marek.olsak@amd.com>
Tue, 16 Jul 2019 03:42:35 +0000 (23:42 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 20 Jul 2019 00:16:19 +0000 (20:16 -0400)
Probably relevant commit:

commit dd32dc3f72ec99b1794d62c74d2beb3b60468d50
Author: Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Date:   Tue Jul 9 03:10:18 2019 +0000

    [AMDGPU] Always use s_memtime for readcyclecounter

    Differential Revision: https://reviews.llvm.org/D64369

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365431 91177308-0d34-0410-b5e6-96231b3b80d8

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/common/ac_llvm_build.c

index f024d1b4d5796d74a636207a6079a966dccaf4e1..221850139b19e23bfd1af1e60f3f055472bc517c 100644 (file)
@@ -432,8 +432,9 @@ ac_build_optimization_barrier(struct ac_llvm_context *ctx,
 LLVMValueRef
 ac_build_shader_clock(struct ac_llvm_context *ctx)
 {
-       LLVMValueRef tmp = ac_build_intrinsic(ctx, "llvm.readcyclecounter",
-                                             ctx->i64, NULL, 0, 0);
+       const char *intr = HAVE_LLVM >= 0x0900 && ctx->chip_class >= GFX8 ?
+                               "llvm.amdgcn.s.memrealtime" : "llvm.readcyclecounter";
+       LLVMValueRef tmp = ac_build_intrinsic(ctx, intr, ctx->i64, NULL, 0, 0);
        return LLVMBuildBitCast(ctx->builder, tmp, ctx->v2i32, "");
 }