[llvm] [AMDGPU] always emit a soft wait even if it is trivially ~0 (PR #147257)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 00:58:21 PDT 2025


================
@@ -669,6 +679,7 @@ define amdgpu_kernel void @global_volatile_store_1(
 ; GFX12-WGP-NEXT:    s_wait_kmcnt 0x0
 ; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
 ; GFX12-WGP-NEXT:    global_store_b32 v0, v1, s[0:1] scope:SCOPE_SYS
+; GFX12-WGP-NEXT:    s_wait_loadcnt 0x3f
----------------
Pierre-vh wrote:

Something still doesn't feel right with this PR for me, I feel like this isn't the right approach but I struggle to suggest something better.

As this targets a specific set of architectures, could we instead add a special pseudo-instruction for a vmcnt wait that is only necessary if there is a DMA ? That'd make the changes more focused. I feel like this patch adds a lot of surface area for potential issues as-is. What do other reviewers think?

Longer term we should really just have a single waitcnt pseudo for the MemoryLegalizer that is target-independent, it'd fix issues like these if we had special sentinel values for different things.

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


More information about the llvm-commits mailing list