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

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 03:33:55 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.
----------------
pendingchaos wrote:

I don't think this is true. It matters before GFX12 because WaW doesn't require a waitcnt if the two instructions are of the same VMEM type (I believe this optimization is done around `hasOtherPendingVmemTypes()`'s caller).

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


More information about the llvm-commits mailing list