[clang] [llvm] [mlir] [AMDGPU] Introduce waitcounter padding builtin/intrinsic (PR #243204)

Sameer Sahasrabuddhe via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 01:35:27 PST 2026


ssahasra wrote:

In general, we do not want to encourage the use of things like `wait(vmcnt 3)`. The user cannot always know in advance whether vmcnt is the right counter and whether 3 is the right value. Glad that @nhaehnle caught this! We are back to abstracting out concrete "wait(N)" operations into "wait.mark(M)" operations. This also aligns with the fact that the PR description actually uses async loads as in the example. Consider the following shape:

```
i = ...
v0 = async_load()
v1 = default
v2 = default
if (condition(i)) {
  v1 = async_load();
  asyncmark();
  v2 = async_load();
  asyncmark();
} else {
  asyncmark(PAD);
  asyncmark(PAD);
}
wait.asyncmark(2);
use(v0)
...hazard free code...
wait.asyncmark(1);
use(v1)
...hazard free code...
wait.asyncmark(0);
use(v2)
```

"PAD" is a hypothetical new stage argument that makes this distinct from a trivial asyncmark(). The compiler will emit code for the former, but possibly optimize away the latter.

https://github.com/llvm/llvm-project/pull/243204


More information about the cfe-commits mailing list