Skip to content

Commit 47b7c72

Browse files
committed
[AMDGPU] Fix image_msaa_load waitcnt insertion for pre-gfx12
#90201 made some fixes for gfx12 image_msaa_load waitcnt insertion. That fix might break in some situations for pre-gfx12 - this fixes that by explitly checking for VSAMPLE which always requires a s_wait_samplecnt and leaves the previous logic intact for non-gfx12.
1 parent 6fab3f2 commit 47b7c72

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ VmemType getVmemType(const MachineInstr &Inst) {
187187
const AMDGPU::MIMGInfo *Info = AMDGPU::getMIMGInfo(Inst.getOpcode());
188188
const AMDGPU::MIMGBaseOpcodeInfo *BaseInfo =
189189
AMDGPU::getMIMGBaseOpcodeInfo(Info->BaseOpcode);
190-
// The test for MSAA here is because gfx12+ image_msaa_load is actually
191-
// encoded as VSAMPLE and requires the appropriate s_waitcnt variant for that.
192-
// Pre-gfx12 doesn't care since all vmem types result in the same s_waitcnt.
193-
return BaseInfo->BVH ? VMEM_BVH
194-
: BaseInfo->Sampler || BaseInfo->MSAA ? VMEM_SAMPLER
195-
: VMEM_NOSAMPLER;
190+
// We have to make an additional check for isVSAMPLE here since some
191+
// instructions don't have a sampler, but are still classified as sampler
192+
// instructions for the purposes of e.g. waitcnt.
193+
return BaseInfo->BVH ? VMEM_BVH
194+
: (BaseInfo->Sampler || SIInstrInfo::isVSAMPLE(Inst)) ? VMEM_SAMPLER
195+
: VMEM_NOSAMPLER;
196196
}
197197

198198
unsigned &getCounterRef(AMDGPU::Waitcnt &Wait, InstCounterType T) {

0 commit comments

Comments
 (0)