https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/239355
>From bf4167b0d275dcd0b57fb53e32adec2d4a6ea442 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" <[email protected]> Date: Sat, 7 Nov 2026 09:44:53 -0500 Subject: [PATCH] [AMDGPU] Warn about missing async barrier replay workarounds Warn by default when assembly lacks the recognized EXEC-zero B8 replay after an async barrier arrival. Keep recognition within a straight-line assembly block and support targeted and general warning controls. --- llvm/docs/AMDGPUUsage.md | 28 +++ llvm/docs/ReleaseNotes.md | 7 +- .../AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 81 ++++++++ .../async-barrier-arrive-replay-vgpr-msb.ll | 4 +- .../AMDGPU/async-barrier-replay-inline-asm.ll | 24 +++ .../async-barrier-replay-warning-vgpr-msb.s | 38 ++++ .../async-barrier-replay-warning-xnack.s | 27 +++ .../MC/AMDGPU/async-barrier-replay-warning.s | 187 ++++++++++++++++++ 8 files changed, 393 insertions(+), 3 deletions(-) create mode 100644 llvm/test/CodeGen/AMDGPU/async-barrier-replay-inline-asm.ll create mode 100644 llvm/test/MC/AMDGPU/async-barrier-replay-warning-vgpr-msb.s create mode 100644 llvm/test/MC/AMDGPU/async-barrier-replay-warning-xnack.s create mode 100644 llvm/test/MC/AMDGPU/async-barrier-replay-warning.s diff --git a/llvm/docs/AMDGPUUsage.md b/llvm/docs/AMDGPUUsage.md index 8a8eb1d0b6fc40..a578f195c11e1f 100644 --- a/llvm/docs/AMDGPUUsage.md +++ b/llvm/docs/AMDGPUUsage.md @@ -17259,6 +17259,34 @@ It supports AMDGCN GFX6-GFX11. This section describes general syntax for instructions and operands. +(amdgpu-async-barrier-replay-warning)= + +#### Async Barrier Arrival Warning + +The compiler emits an async barrier arrival workaround for gfx1250 and gfx1251 +unless XNACK is explicitly disabled. The assembler checks hand-written and +inline assembly for the same sequence. This check is also omitted when XNACK +is explicitly disabled. + +The assembler warns by default when it cannot recognize the compiler's dummy +form: `s_mov_b32 exec_lo, 0` followed by +`global_load_async_to_lds_b8` with a vector address, issued after an arrival +and before a non-async VMEM instruction. Only `s_set_vgpr_msb`, which does +not change EXEC, may intervene between the EXEC clear and the load. +Other load opcodes, scalar-address forms, +and active loads do not suppress the warning. Recognition stops at labels, +control-flow instructions, and the end of assembly. Assembler directives +can also end recognition; `.loc` and `.file` preserve it. Each inline assembly +block is checked separately. A warning reports missing recognized protection; +absence of a warning does not prove control-flow safety, correct EXEC +preservation, or correct async wait counts. + +Disable only this check in Clang with +`-mllvm -amdgpu-asm-warn-async-barrier-replay=false`, or in `llvm-mc` with +`-amdgpu-asm-warn-async-barrier-replay=false`. Clang's `-Wa,--no-warn` +suppresses all assembler warnings, and `-Wa,--fatal-warnings` treats them as +errors. With `llvm-mc`, use `--no-warn` and `--fatal-warnings` respectively. + #### Instructions An instruction has the following [syntax](AMDGPUInstructionSyntax.md): diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md index 4a81917c7fc589..31e96a14fb8e09 100644 --- a/llvm/docs/ReleaseNotes.md +++ b/llvm/docs/ReleaseNotes.md @@ -305,8 +305,11 @@ Makes programs 10x faster by doing Special New Thing. ### Changes to the AMDGPU Backend -* Added a compiler workaround for async barrier arrivals on gfx1250 and gfx1251 - unless XNACK is explicitly disabled. +* Added an async barrier arrival workaround for gfx1250 and gfx1251, and + assembler warnings for unrecognized sequences in handwritten or inline + assembly. Both are omitted when XNACK is explicitly disabled. See + {ref}`amdgpu-async-barrier-replay-warning` for recognized sequences and + warning controls. * Replaced `xnack` and `sramecc` target features with `amdgpu.xnack` and `amdgpu.sramecc` module flags. diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index 8ee55807ebb4b5..7671b8ce2dd960 100644 --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -21,6 +21,7 @@ #include "Utils/AMDKernelCodeTUtils.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/SmallBitVector.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Twine.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/CodeGenTypes/MachineValueType.h" @@ -40,10 +41,12 @@ #include "llvm/Support/AMDGPUObjLinkingInfo.h" #include "llvm/Support/AMDHSAKernelDescriptor.h" #include "llvm/Support/Casting.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MathExtras.h" #include "llvm/TargetParser/AMDGPUTargetParser.h" #include <optional> +#include <utility> using namespace llvm; using namespace llvm::AMDGPU; @@ -51,6 +54,12 @@ using namespace llvm::amdhsa; namespace { +static cl::opt<bool> WarnAsyncBarrierReplay( + "amdgpu-asm-warn-async-barrier-replay", + cl::desc("Warn about async barrier arrivals without a recognized replay " + "workaround in assembly"), + cl::init(true), cl::Hidden); + class AMDGPUAsmParser; enum RegisterKind { @@ -1135,6 +1144,12 @@ class AMDGPUAsmParser : public MCTargetAsmParser { const AMDGPU::GPUKind Gfx; const AMDGPU::IsaVersion ISA; + SmallVector<SMLoc, 4> PendingAsyncBarrierArrivals; + bool AsyncBarrierExecCleared = false; + + void checkAsyncBarrierReplay(const MCInst &Inst); + void warnPendingAsyncBarrierArrivals(); + /// @name Auto-generated Match Functions /// { @@ -5858,6 +5873,64 @@ static bool isInvalidVOPDY(const OperandVector &Operands, return false; } +void AMDGPUAsmParser::warnPendingAsyncBarrierArrivals() { + for (SMLoc Loc : PendingAsyncBarrierArrivals) { + Warning(Loc, "no recognized replay workaround after " + "'ds_atomic_async_barrier_arrive_b64' on this GPU"); + } + PendingAsyncBarrierArrivals.clear(); + AsyncBarrierExecCleared = false; +} + +void AMDGPUAsmParser::checkAsyncBarrierReplay(const MCInst &Inst) { + if (!WarnAsyncBarrierReplay || + !getSTI().hasFeature(AMDGPU::FeatureAsyncBarrierArriveReplayBug) || + getTargetStreamer().getTargetID()->getXnackSetting() == + AMDGPU::TargetIDSetting::Off) + return; + + const bool ExecCleared = std::exchange(AsyncBarrierExecCleared, false); + switch (Inst.getOpcode()) { + case AMDGPU::DS_ATOMIC_ASYNC_BARRIER_ARRIVE_B64_gfx12: + PendingAsyncBarrierArrivals.push_back(Inst.getLoc()); + return; + // These instructions change control flow but their MC descriptors do not + // carry branch, return, or trap flags. + case AMDGPU::S_RFE_B64_gfx1250: + case AMDGPU::S_TRAP_gfx12: + warnPendingAsyncBarrierArrivals(); + return; + case AMDGPU::S_MOV_B32_gfx12: + if (!PendingAsyncBarrierArrivals.empty()) { + const MCOperand &Dst = Inst.getOperand(0); + const MCOperand &Src = Inst.getOperand(1); + AsyncBarrierExecCleared = Dst.isReg() && + mc2PseudoReg(Dst.getReg()) == AMDGPU::EXEC_LO && + Src.isImm() && Src.getImm() == 0; + } + return; + case AMDGPU::S_SET_VGPR_MSB_gfx12: + // Changing the VGPR bank preserves EXEC during a handwritten replay. + AsyncBarrierExecCleared = ExecCleared; + return; + case AMDGPU::GLOBAL_LOAD_ASYNC_TO_LDS_B8_gfx1250: + // Recognize only the compiler's EXEC-zero B8 dummy form. + if (ExecCleared) + PendingAsyncBarrierArrivals.clear(); + return; + } + + if (PendingAsyncBarrierArrivals.empty()) + return; + + const MCInstrDesc &Desc = MII.get(Inst.getOpcode()); + // Check only a straight-line sequence. Labels and control-flow changes end + // recognition rather than allowing a load on another path to hide a warning. + if (Desc.isBranch() || Desc.isCall() || Desc.isTerminator() || + (SIInstrFlags::isVMEM(Desc) && !SIInstrFlags::usesASYNC_CNT(Desc))) + warnPendingAsyncBarrierArrivals(); +} + bool AMDGPUAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, OperandVector &Operands, MCStreamer &Out, @@ -5897,6 +5970,7 @@ bool AMDGPUAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, return true; } emitTargetDirective(); + checkAsyncBarrierReplay(Inst); Out.emitInstruction(Inst, getSTI()); // Record for kernel prologue checking. OpcodeStream.push_back(Inst.getOpcode()); @@ -7041,6 +7115,7 @@ bool AMDGPUAsmParser::ParseDirectiveAMDGPUInfo() { } void AMDGPUAsmParser::doBeforeLabelEmit(MCSymbol *Symbol, SMLoc IDLoc) { + warnPendingAsyncBarrierArrivals(); // Record every parsed label in the timeline so that, at end of file, the // instructions following a kernel's label can be located regardless of // whether the .amdhsa_kernel directive came before or after the label. @@ -7071,6 +7146,7 @@ void AMDGPUAsmParser::checkKernelPrologues() { } void AMDGPUAsmParser::onEndOfFile() { + warnPendingAsyncBarrierArrivals(); emitTargetDirective(); checkKernelPrologues(); if (InfoData) @@ -7080,6 +7156,11 @@ void AMDGPUAsmParser::onEndOfFile() { bool AMDGPUAsmParser::ParseDirective(AsmToken DirectiveID) { StringRef IDVal = DirectiveID.getString(); + // Debug locations do not interrupt the instruction sequence. Other + // directives may change sections or emit bytes outside this parser. + if (IDVal != ".loc" && IDVal != ".file") + warnPendingAsyncBarrierArrivals(); + if (isHsaAbi(getSTI())) { if (IDVal == ".amdhsa_kernel") return ParseDirectiveAMDHSAKernel(); diff --git a/llvm/test/CodeGen/AMDGPU/async-barrier-arrive-replay-vgpr-msb.ll b/llvm/test/CodeGen/AMDGPU/async-barrier-arrive-replay-vgpr-msb.ll index e1d896abf90ea9..be709b72489df9 100644 --- a/llvm/test/CodeGen/AMDGPU/async-barrier-arrive-replay-vgpr-msb.ll +++ b/llvm/test/CodeGen/AMDGPU/async-barrier-arrive-replay-vgpr-msb.ll @@ -1,6 +1,8 @@ -; NOTE: Do not autogenerate. Check the ordered VGPR bank switch and contiguous EXEC-preserving expansion. +; NOTE: Do not autogenerate. Check the bank switch, contiguous EXEC-preserving expansion, and warning-free assembly round trip. ; RUN: llc -mtriple=amdgpu12.50-amd-amdhsa -verify-machineinstrs < %s | FileCheck %s ; RUN: llc -mtriple=amdgpu12.51-amd-amdhsa -verify-machineinstrs < %s | FileCheck %s +; RUN: llc -mtriple=amdgpu12.50-amd-amdhsa < %s | llvm-mc -triple=amdgpu12.50-amd-amdhsa -filetype=null --fatal-warnings +; RUN: llc -mtriple=amdgpu12.51-amd-amdhsa < %s | llvm-mc -triple=amdgpu12.51-amd-amdhsa -filetype=null --fatal-warnings ; Keep a divergent LDS address live across clobbers of all low VGPRs. The ; occupancy attributes allow allocation of v256 without spilling the address. diff --git a/llvm/test/CodeGen/AMDGPU/async-barrier-replay-inline-asm.ll b/llvm/test/CodeGen/AMDGPU/async-barrier-replay-inline-asm.ll new file mode 100644 index 00000000000000..3fae1ef4cb7fc7 --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/async-barrier-replay-inline-asm.ll @@ -0,0 +1,24 @@ +; NOTE: Do not autogenerate. Object emission invokes the inline assembler; null emission does not. Check warning presence and absence. +; RUN: llc -mtriple=amdgpu12.50-amd-amdhsa -filetype=obj -o %t.o < %s 2>&1 | FileCheck %s --check-prefix=WARN --implicit-check-not=warning: +; RUN: llc -mtriple=amdgpu12.50-amd-amdhsa -filetype=obj -o %t.o -amdgpu-asm-warn-async-barrier-replay=false < %s 2>&1 | count 0 +; RUN: llc -mtriple=amdgpu12.50-amd-amdhsa -amdgpu-xnack=0 -filetype=obj -o %t.o < %s 2>&1 | count 0 +; RUN: llc -mtriple=amdgpu12.51-amd-amdhsa -filetype=obj -o %t.o < %s 2>&1 | FileCheck %s --check-prefix=WARN --implicit-check-not=warning: + +define amdgpu_kernel void @unprotected_inline_asm() { + call void asm sideeffect "ds_atomic_async_barrier_arrive_b64 v0", "~{v0},~{memory}"() +; WARN: warning: no recognized replay workaround after 'ds_atomic_async_barrier_arrive_b64' on this GPU + ret void +} + +define amdgpu_kernel void @protected_inline_asm() { + call void asm sideeffect "ds_atomic_async_barrier_arrive_b64 v0\0As_mov_b32 s7, exec_lo\0As_mov_b32 exec_lo, 0\0Aglobal_load_async_to_lds_b8 v0, v[0:1], off\0As_mov_b32 exec_lo, s7", "~{v0},~{v1},~{s7},~{memory}"() + ret void +} + +; A later inline-asm block cannot protect an arrival in an earlier block. +define amdgpu_kernel void @split_inline_asm() { + call void asm sideeffect "ds_atomic_async_barrier_arrive_b64 v0", "~{v0},~{memory}"() +; WARN: warning: no recognized replay workaround after 'ds_atomic_async_barrier_arrive_b64' on this GPU + call void asm sideeffect "s_mov_b32 s7, exec_lo\0As_mov_b32 exec_lo, 0\0Aglobal_load_async_to_lds_b8 v0, v[0:1], off\0As_mov_b32 exec_lo, s7", "~{v0},~{v1},~{s7},~{memory}"() + ret void +} diff --git a/llvm/test/MC/AMDGPU/async-barrier-replay-warning-vgpr-msb.s b/llvm/test/MC/AMDGPU/async-barrier-replay-warning-vgpr-msb.s new file mode 100644 index 00000000000000..f9f36f8b6450a1 --- /dev/null +++ b/llvm/test/MC/AMDGPU/async-barrier-replay-warning-vgpr-msb.s @@ -0,0 +1,38 @@ +// NOTE: Do not autogenerate. Check diagnostic locations and absence across the EXEC-clear sequence. +// RUN: llvm-mc -triple=amdgpu12.50 -filetype=null < %s 2>&1 | FileCheck %s --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.51 -filetype=null < %s 2>&1 | FileCheck %s --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.50 -filetype=null -amdgpu-asm-warn-async-barrier-replay=false < %s 2>&1 | count 0 + +// VGPR bank changes preserve EXEC during a handwritten replay sequence. +ds_atomic_async_barrier_arrive_b64 v0 +s_mov_b32 s7, exec_lo +s_mov_b32 exec_lo, 0 +s_set_vgpr_msb 0x100 +global_load_async_to_lds_b8 v0, v[0:1], off +s_mov_b32 exec_lo, s7 +s_endpgm + +// A bank change alone does not establish that EXEC is clear. +ds_atomic_async_barrier_arrive_b64 v0 +// CHECK: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_set_vgpr_msb 0x100 +global_load_async_to_lds_b8 v0, v[0:1], off +s_endpgm + +// A bank change does not hide a subsequent write to EXEC. +ds_atomic_async_barrier_arrive_b64 v0 +// CHECK: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +s_set_vgpr_msb 0x100 +s_mov_b32 exec_lo, 1 +global_load_async_to_lds_b8 v0, v[0:1], off +s_endpgm + +// Other intervening instructions still break the pattern. +ds_atomic_async_barrier_arrive_b64 v0 +// CHECK: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +s_nop 0 +s_set_vgpr_msb 0x100 +global_load_async_to_lds_b8 v0, v[0:1], off +s_endpgm diff --git a/llvm/test/MC/AMDGPU/async-barrier-replay-warning-xnack.s b/llvm/test/MC/AMDGPU/async-barrier-replay-warning-xnack.s new file mode 100644 index 00000000000000..f1931aebaef82e --- /dev/null +++ b/llvm/test/MC/AMDGPU/async-barrier-replay-warning-xnack.s @@ -0,0 +1,27 @@ +// NOTE: Do not autogenerate. Check target-ID XNACK settings and warning locations. +// RUN: split-file %s %t +// RUN: llvm-mc -triple=amdgpu12.50-amd-amdhsa -filetype=null < %t/on.s 2>&1 | FileCheck %s --check-prefix=ON --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.50-amd-amdhsa -filetype=null < %t/off.s 2>&1 | count 0 +// RUN: sed 's/12.50/12.51/g; s/gfx1250/gfx1251/g' %t/on.s | llvm-mc -triple=amdgpu12.51-amd-amdhsa -filetype=null 2>&1 | FileCheck %s --check-prefix=ON --implicit-check-not=warning: +// RUN: sed 's/12.50/12.51/g; s/gfx1250/gfx1251/g' %t/off.s | llvm-mc -triple=amdgpu12.51-amd-amdhsa -filetype=null 2>&1 | count 0 +// RUN: llvm-mc -triple=amdgpu12.50-amd-amdhsa -filetype=null < %t/any.s 2>&1 | FileCheck %s --check-prefix=ANY --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.51-amd-amdhsa -filetype=null < %t/any.s 2>&1 | FileCheck %s --check-prefix=ANY --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.50s-amd-amdhsa -filetype=null < %t/any.s 2>&1 | FileCheck %s --check-prefix=ANY --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.5-amd-amdhsa -filetype=null < %t/any.s 2>&1 | FileCheck %s --check-prefix=ANY --implicit-check-not=warning: + +// ON: <stdin>:2:1: warning: no recognized replay workaround +// ANY: <stdin>:1:1: warning: no recognized replay workaround + +//--- on.s +.amdgcn_target "amdgpu12.50-amd-amdhsa-unknown-gfx1250:xnack+" +ds_atomic_async_barrier_arrive_b64 v0 +s_endpgm + +//--- off.s +.amdgcn_target "amdgpu12.50-amd-amdhsa-unknown-gfx1250:xnack-" +ds_atomic_async_barrier_arrive_b64 v0 +s_endpgm + +//--- any.s +ds_atomic_async_barrier_arrive_b64 v0 +s_endpgm diff --git a/llvm/test/MC/AMDGPU/async-barrier-replay-warning.s b/llvm/test/MC/AMDGPU/async-barrier-replay-warning.s new file mode 100644 index 00000000000000..719e87544c98a9 --- /dev/null +++ b/llvm/test/MC/AMDGPU/async-barrier-replay-warning.s @@ -0,0 +1,187 @@ +// NOTE: Do not autogenerate. Check diagnostic locations and absence across sequence boundaries. +// RUN: llvm-mc -triple=amdgpu12.50 -filetype=null < %s 2>&1 | FileCheck %s --check-prefix=WARN --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.51 -filetype=null < %s 2>&1 | FileCheck %s --check-prefix=WARN --implicit-check-not=warning: +// RUN: echo "ds_atomic_async_barrier_arrive_b64 v0" | not llvm-mc -triple=amdgpu12.50 -filetype=null --fatal-warnings 2>&1 | FileCheck %s --check-prefix=FATAL --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.50 -filetype=null -amdgpu-asm-warn-async-barrier-replay=true < %s 2>&1 | FileCheck %s --check-prefix=WARN --implicit-check-not=warning: +// RUN: llvm-mc -triple=amdgpu12.50 -filetype=null -amdgpu-asm-warn-async-barrier-replay=false < %s 2>&1 | count 0 +// RUN: llvm-mc -triple=amdgpu12.50 -filetype=null --no-warn < %s 2>&1 | count 0 +// RUN: echo "ds_atomic_async_barrier_arrive_b64 v0" | llvm-mc -triple=amdgpu13.10 -mattr=+lds-barrier-arrive-atomic -filetype=null 2>&1 | count 0 +// RUN: llvm-mc -triple=amdgpu12.50 -mattr=-async-barrier-arrive-replay-bug -filetype=null < %s 2>&1 | count 0 +// FATAL: <stdin>:1:1: error: no recognized replay workaround after 'ds_atomic_async_barrier_arrive_b64' on this GPU + +// Non-async VMEM ends recognition before the following load. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround after 'ds_atomic_async_barrier_arrive_b64' on this GPU +s_nop 0 +global_load_b32 v1, v[2:3], off +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off + +// The compiler's dummy-load sequence is recognized without fixing its SGPR. +ds_atomic_async_barrier_arrive_b64 v0 +s_mov_b32 s7, exec_lo +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v0, v[0:1], off +s_mov_b32 exec_lo, s7 +s_endpgm + +// Active B8 loads and scalar-address forms are not the recognized dummy form. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +global_load_async_to_lds_b8 v4, v[2:3], off +global_load_b32 v1, v[2:3], off +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v5, s[2:3] +global_load_b32 v1, v[2:3], off + +// B32 forms are not recognized, even with EXEC cleared. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b32 v4, v5, s[2:3] +global_load_b32 v1, v[2:3], off +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b32 v4, v[2:3], off +s_endpgm + +// Cluster loads do not suppress the warning, even with EXEC cleared. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 m0, 0 +s_mov_b32 exec_lo, 0 +cluster_load_async_to_lds_b8 v4, v[2:3], off +s_endpgm + +// Clearing another register or using a nonzero EXEC is not the dummy form. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 s7, 0 +global_load_async_to_lds_b8 v4, v[2:3], off +s_endpgm +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 1 +global_load_async_to_lds_b8 v4, v[2:3], off +s_endpgm + +// Intervening instructions break the immediately preceding EXEC-clear pattern. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +s_nop 0 +global_load_async_to_lds_b8 v4, v[2:3], off +s_endpgm + +// Source locations do not interrupt a protective sequence. +.file 1 "async-barrier.s" +ds_atomic_async_barrier_arrive_b64 v0 +s_mov_b32 s9, exec_lo +s_mov_b32 exec_lo, 0 +.loc 1 10 0 +global_load_async_to_lds_b8 v4, v[2:3], off +s_mov_b32 exec_lo, s9 +s_endpgm + +// One qualifying load can follow several arrivals. +ds_atomic_async_barrier_arrive_b64 v0 +ds_atomic_async_barrier_arrive_b64 v1 +s_mov_b32 s9, exec_lo +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off +s_mov_b32 exec_lo, s9 +s_endpgm + +// B64/B128 forms are not recognized. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b64 v4, v[2:3], off +global_load_b32 v1, v[2:3], off +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b128 v4, v[2:3], off +s_endpgm + +// Recognize scratch, flat and buffer VMEM as well as global VMEM. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +scratch_load_b32 v1, v2, off +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +flat_load_b32 v1, v[2:3] +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +buffer_load_b32 v1, v2, s[4:7], s8 offen +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off + +// A load beyond a branch or label does not prove protection on every path. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_branch next +next: +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off + +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_mov_b32 exec_lo, 0 +another_path: +global_load_async_to_lds_b8 v4, v[2:3], off + +// Calls, indirect branches, traps and exception returns end recognition. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_swap_pc_i64 s[2:3], s[0:1] +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_set_pc_i64 s[0:1] +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_trap 2 +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_rfe_i64 s[0:1] +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off + +// A conditional branch must not let a fall-through load hide the warning. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +s_cbranch_scc0 1 +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off + +// Bytes emitted by a directive interrupt recognition. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround +.long 0 +s_mov_b32 exec_lo, 0 +global_load_async_to_lds_b8 v4, v[2:3], off + +// Preserve the original location through macro expansion. +.macro arrive + ds_atomic_async_barrier_arrive_b64 v0 +// WARN: <instantiation>:1:1: warning: no recognized replay workaround +.endm +arrive +s_endpgm + +// EOF also diagnoses an outstanding arrival. +ds_atomic_async_barrier_arrive_b64 v0 +// WARN: :[[@LINE-1]]:1: warning: no recognized replay workaround _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
