From 39d0c68321dfb592afc1f6f63d90d5508cdf7333 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 15 Jul 2019 23:42:35 -0400 Subject: [PATCH] ac: fix shader clock on LLVM 9 Probably relevant commit: commit dd32dc3f72ec99b1794d62c74d2beb3b60468d50 Author: Stanislav Mekhanoshin 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 --- src/amd/common/ac_llvm_build.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index f024d1b4d57..221850139b1 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -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, ""); } -- 2.30.2