[llvm] [AMDGPU] Fix gfx12 waitcnt type for image_msaa_load (PR #90201)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 03:42:44 PDT 2024


================
@@ -187,8 +187,12 @@ VmemType getVmemType(const MachineInstr &Inst) {
   const AMDGPU::MIMGInfo *Info = AMDGPU::getMIMGInfo(Inst.getOpcode());
   const AMDGPU::MIMGBaseOpcodeInfo *BaseInfo =
       AMDGPU::getMIMGBaseOpcodeInfo(Info->BaseOpcode);
-  return BaseInfo->BVH ? VMEM_BVH
-                       : BaseInfo->Sampler ? VMEM_SAMPLER : VMEM_NOSAMPLER;
+  // The test for MSAA here is because gfx12+ image_msaa_load is actually
+  // encoded as VSAMPLE and requires the appropriate s_waitcnt variant for that.
+  // Pre-gfx12 doesn't care since all vmem types result in the same s_waitcnt.
----------------
jayfoad wrote:

Good point! Pre-GFX12 you need this wait to avoid WAW:
```
  image_sample v[0:3], ...
  s_waitcnt vmcnt(0)
  image_msaa_load v[0:3], ...
```
But this patch will break that.

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


More information about the llvm-commits mailing list