[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 02:30:48 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.
+  return BaseInfo->BVH                         ? VMEM_BVH
+         : BaseInfo->Sampler || BaseInfo->MSAA ? VMEM_SAMPLER
----------------
jayfoad wrote:

As a follow up, perhaps we should rethink whether `BaseInfo->Sampler` _should_ be true for MSAA instructions. But that is a bigger change that would require auditing all uses of `BaseInfo->Sampler`.

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


More information about the llvm-commits mailing list