diff options
author | Marek Olšák <[email protected]> | 2019-06-29 01:03:29 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-07-04 15:39:03 -0400 |
commit | ea64d66fdea66351c6895df6e19e819822c46033 (patch) | |
tree | 3a23018d036dc44ace229b07753e23a9e742e4cf /src/amd | |
parent | 14450c8c41f9510ed7232198b968ead8f2eb7751 (diff) |
ac: use an LLVM fence instead of s.waitcnt when possible
Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 63891855e07..b208ba41eea 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -2887,6 +2887,15 @@ void ac_build_waitcnt(struct ac_llvm_context *ctx, unsigned wait_flags) vmcnt = 0; } + /* There is no intrinsic for vscnt(0), so use a fence. */ + if ((wait_flags & AC_WAIT_LGKM && + wait_flags & AC_WAIT_VLOAD && + wait_flags & AC_WAIT_VSTORE) || + vscnt == 0) { + LLVMBuildFence(ctx->builder, LLVMAtomicOrderingRelease, false, ""); + return; + } + unsigned simm16 = (lgkmcnt << 8) | (7 << 4) | /* expcnt */ (vmcnt & 0xf) | @@ -2897,15 +2906,6 @@ void ac_build_waitcnt(struct ac_llvm_context *ctx, unsigned wait_flags) }; ac_build_intrinsic(ctx, "llvm.amdgcn.s.waitcnt", ctx->voidt, args, 1, 0); - - /* TODO: add llvm.amdgcn.s.waitcnt.vscnt into LLVM: */ - if (0 && ctx->chip_class >= GFX10 && vscnt == 0) { - LLVMValueRef args[1] = { - LLVMConstInt(ctx->i32, vscnt, false), - }; - ac_build_intrinsic(ctx, "llvm.amdgcn.s.waitcnt.vscnt", - ctx->voidt, args, 1, 0); - } } LLVMValueRef ac_build_fmed3(struct ac_llvm_context *ctx, LLVMValueRef src0, |