Skip to content

Commit db984d8

Browse files
authored
[AMDGPU] Include tensor load/store LDS instructions in isLDSDMA (#173079)
Needed by #172728. LIT test utilizing this new inclusion is there as well.
1 parent 87ca51a commit db984d8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,13 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
614614
}
615615

616616
static bool isLDSDMA(const MachineInstr &MI) {
617-
return isVALU(MI) && (isMUBUF(MI) || isFLAT(MI));
617+
return (isVALU(MI) && (isMUBUF(MI) || isFLAT(MI))) ||
618+
(MI.getDesc().TSFlags & SIInstrFlags::TENSOR_CNT);
618619
}
619620

620621
bool isLDSDMA(uint16_t Opcode) {
621-
return isVALU(Opcode) && (isMUBUF(Opcode) || isFLAT(Opcode));
622+
return (isVALU(Opcode) && (isMUBUF(Opcode) || isFLAT(Opcode))) ||
623+
(get(Opcode).TSFlags & SIInstrFlags::TENSOR_CNT);
622624
}
623625

624626
static bool isGWS(const MachineInstr &MI) {
@@ -815,7 +817,11 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
815817
}
816818

817819
static bool mayWriteLDSThroughDMA(const MachineInstr &MI) {
818-
return isLDSDMA(MI) && MI.getOpcode() != AMDGPU::BUFFER_STORE_LDS_DWORD;
820+
unsigned Opc = MI.getOpcode();
821+
// Exclude instructions that read FROM LDS (not write to it)
822+
return isLDSDMA(MI) && Opc != AMDGPU::BUFFER_STORE_LDS_DWORD &&
823+
Opc != AMDGPU::TENSOR_STORE_FROM_LDS &&
824+
Opc != AMDGPU::TENSOR_STORE_FROM_LDS_D2;
819825
}
820826

821827
static bool isSBarrierSCCWrite(unsigned Opcode) {

0 commit comments

Comments
 (0)