Repository navigation
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@llvm/pr-subscribers-llvm-regalloc @llvm/pr-subscribers-backend-amdgpu Author: Christudasan Devadasan (cdevadas) ChangesPutting back the functions that are recently deleted 2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
index c45f5ccc10ccd..f21ad7b59cb23 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -4030,6 +4030,28 @@ bool SIRegisterInfo::isProperlyAlignedRC(const TargetRegisterClass &RC) const {
return true;
}
+const TargetRegisterClass *
+SIRegisterInfo::getProperlyAlignedRC(const TargetRegisterClass *RC) const {
+ if (!RC || !ST.needsAlignedVGPRs())
+ return RC;
+
+ unsigned Size = getRegSizeInBits(*RC);
+ if (Size <= 32)
+ return RC;
+
+ if (RC == &AMDGPU::VS_64RegClass)
+ return &AMDGPU::VS_64_Align2RegClass;
+
+ if (isVGPRClass(RC))
+ return getAlignedVGPRClassForBitWidth(Size);
+ if (isAGPRClass(RC))
+ return getAlignedAGPRClassForBitWidth(Size);
+ if (isVectorSuperClass(RC))
+ return getAlignedVectorSuperClassForBitWidth(Size);
+
+ return RC;
+}
+
ArrayRef<MCPhysReg>
SIRegisterInfo::getAllSGPR128(const MachineFunction &MF) const {
return ArrayRef(AMDGPU::SGPR_128RegClass.begin(), ST.getMaxNumSGPRs(MF) / 4);
diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
index b959fe7cf2db1..1b12eea6dfcc3 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
@@ -433,6 +433,11 @@ class SIRegisterInfo final : public AMDGPUGenRegisterInfo {
// the subtarget.
bool isProperlyAlignedRC(const TargetRegisterClass &RC) const;
+ // Given \p RC returns corresponding aligned register class if required
+ // by the subtarget.
+ const TargetRegisterClass *
+ getProperlyAlignedRC(const TargetRegisterClass *RC) const;
+
/// Return all SGPR128 which satisfy the waves per execution unit requirement
/// of the subtarget.
ArrayRef<MCPhysReg> getAllSGPR128(const MachineFunction &MF) const;
|
arsenm
left a comment
There was a problem hiding this comment.
This should not be reintroduced. Instruction constraints should be taken directly from the relevant use instructions, this is unnecessary hardcoding. Spills should not have hard alignment restrictions
Can you elaborate on it? How, during RA, can the newly introduced regclasses be constrained for their uses? Currently, there is an MIR verifier error for the spill and its subsequent uses for not meeting the alignment requirements. |
b86e3c5 to
975be2f
Compare
64d13e3 to
5647ba0
Compare
975be2f to
acb9b34
Compare
5647ba0 to
1a83444
Compare
Currently, SGPR spill pseudo-instructions lack an offset field to represent non-zero stack offsets. This patch introduces an additional offset field to SGPR spill pseudo-instructions and updates all relevant passes that handle spill lowering to support this new field. This field is essential for a future patch that implements subreg reload of tuple registers from their stack location during RA.
AMDGPURewriteAGPRCopyMFMA pass is currently not subreg-aware. In particular, the logic that optimizes spills into COPY instructions assumes full register reloads. This becomes problematic when the reload instruction partially restores a tuple register. This patch introduces the necessary changes to make this pass subreg-aware, for a future patch that implements subreg reload during RA.
Instead of just cloning the virtual register, this function now creates a new virtual register derived from a subregister class of the original value.
Putting back the functions that are recently deleted as they were found unused. They are needed for implementing subreg reload during RA.
acb9b34 to
4343cad
Compare
1a83444 to
c74c50e
Compare
This shouldn't be necessary. The spill pseudos should support any register class, always. They can be split up as required to satisfy alignment when the pseudo is expanded |
Yep. #177317 is meant to fix the align constraints for spill pseudos. I will cloes this PR when @easyonaadit lands this spill pseudo fixup patch after approval. |

Putting back the functions that are recently deleted
as they were found unused. They are needed for
implementing subreg reload during RA.