-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[AMDGPU] NFCI: Track AV Register Pressure separately #149863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Change-Id: Ifcd242c111b139f62109b12b588bb6af764fe4df
|
@llvm/pr-subscribers-backend-amdgpu Author: Jeffrey Byrnes (jrbyrnes) ChangesAdds new entries in the GCNPressure array for AVGPR pressure. In this PR, AVGPR pressure is added to pure VGPR pressure under all the pressure queries, so it is NFC. Separating out this pseudo RC will help us make more informed decisions in future work. This RC can be assigned as either VGPR or AGPR, so tracking them as pure VGPR pressure is not accurate. Full diff: https://github.com/llvm/llvm-project/pull/149863.diff 2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
index 7d6723a6108be..334afd3a2a5b4 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
@@ -38,7 +38,11 @@ bool llvm::isEqual(const GCNRPTracker::LiveRegSet &S1,
unsigned GCNRegPressure::getRegKind(const TargetRegisterClass *RC,
const SIRegisterInfo *STI) {
- return STI->isSGPRClass(RC) ? SGPR : (STI->isAGPRClass(RC) ? AGPR : VGPR);
+ return STI->isSGPRClass(RC)
+ ? SGPR
+ : (STI->isAGPRClass(RC)
+ ? AGPR
+ : (STI->isVectorSuperClass(RC) ? AVGPR : VGPR));
}
void GCNRegPressure::inc(unsigned Reg,
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.h b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
index 3749b6d1efc63..5ec898351f922 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.h
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
@@ -29,43 +29,58 @@ class raw_ostream;
class SlotIndex;
struct GCNRegPressure {
- enum RegKind { SGPR, VGPR, AGPR, TOTAL_KINDS };
+ enum RegKind { SGPR, VGPR, AGPR, AVGPR, TOTAL_KINDS };
GCNRegPressure() {
clear();
}
- bool empty() const { return !Value[SGPR] && !Value[VGPR] && !Value[AGPR]; }
+ bool empty() const {
+ return !Value[SGPR] && !Value[VGPR] && !Value[AGPR] && !Value[AVGPR];
+ }
void clear() { std::fill(&Value[0], &Value[ValueArraySize], 0); }
/// \returns the SGPR32 pressure
unsigned getSGPRNum() const { return Value[SGPR]; }
- /// \returns the aggregated ArchVGPR32, AccVGPR32 pressure dependent upon \p
- /// UnifiedVGPRFile
+ /// \returns the aggregated ArchVGPR32, AccVGPR32, and Pseudo AVGPR pressure
+ /// dependent upon \p UnifiedVGPRFile
unsigned getVGPRNum(bool UnifiedVGPRFile) const {
if (UnifiedVGPRFile) {
- return Value[AGPR] ? getUnifiedVGPRNum(Value[VGPR], Value[AGPR])
- : Value[VGPR];
+ return Value[AGPR]
+ ? getUnifiedVGPRNum(Value[VGPR], Value[AGPR], Value[AVGPR])
+ : Value[VGPR] + Value[AVGPR];
}
- return std::max(Value[VGPR], Value[AGPR]);
+ // Until we hit the VGPRThreshold, we will assign AV as VGPR. After that
+ // point, we will assign as AGPR.
+ return std::max(Value[VGPR] + Value[AVGPR], Value[AGPR]);
}
/// Returns the aggregated VGPR pressure, assuming \p NumArchVGPRs ArchVGPRs
- /// and \p NumAGPRs AGPRS, for a target with a unified VGPR file.
+ /// \p NumAGPRs AGPRS, and \p NumAVGPRs AVGPRs for a target with a unified
+ /// VGPR file.
inline static unsigned getUnifiedVGPRNum(unsigned NumArchVGPRs,
- unsigned NumAGPRs) {
- return alignTo(NumArchVGPRs, AMDGPU::IsaInfo::getArchVGPRAllocGranule()) +
+ unsigned NumAGPRs,
+ unsigned NumAVGPRs) {
+
+ // Until we hit the VGPRThreshold, we will assign AV as VGPR. After that
+ // point, we will assign as AGPR.
+ return alignTo(NumArchVGPRs + NumAVGPRs,
+ AMDGPU::IsaInfo::getArchVGPRAllocGranule()) +
NumAGPRs;
}
- /// \returns the ArchVGPR32 pressure
- unsigned getArchVGPRNum() const { return Value[VGPR]; }
+ /// \returns the ArchVGPR32 pressure, plus the AVGPRS which we assume will be
+ /// allocated as VGPR
+ unsigned getArchVGPRNum() const { return Value[VGPR] + Value[AVGPR]; }
/// \returns the AccVGPR32 pressure
unsigned getAGPRNum() const { return Value[AGPR]; }
+ /// \returns the AVGPR32 pressure
+ unsigned getAVGPRNum() const { return Value[AVGPR]; }
unsigned getVGPRTuplesWeight() const {
- return std::max(Value[TOTAL_KINDS + VGPR], Value[TOTAL_KINDS + AGPR]);
+ return std::max(Value[TOTAL_KINDS + VGPR] + Value[TOTAL_KINDS + AVGPR],
+ Value[TOTAL_KINDS + AGPR]);
}
unsigned getSGPRTuplesWeight() const { return Value[TOTAL_KINDS + SGPR]; }
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: another mention of VGPRThreshold to remove
|
The last commit added changes to the scheduler, is this expected or meant to be part of a future change? Asking since it no longer seems NFC with the scheduler/lit test changes. |
Change-Id: I40b174912ad90652dcd5f59a4e4b37300408f6d2
Change-Id: I4a99d3a729a6927d63a7c4fb939fc3a32cde74e0
2d5adf9 to
ffbb962
Compare
Oops -- that is going to be a different PR. |
Adds new entries in the GCNPressure array for AVGPR pressure. In this PR, AVGPR pressure is added to pure VGPR pressure under all the pressure queries, so it is NFC. Separating out this pseudo RC will help us make more informed decisions in future work. This RC can be assigned as either VGPR or AGPR, so tracking them as pure VGPR pressure is not accurate.
Adds new entries in the GCNPressure array for AVGPR pressure. In this PR, AVGPR pressure is added to pure VGPR pressure under all the pressure queries, so it is NFC. Separating out this pseudo RC will help us make more informed decisions in future work. This RC can be assigned as either VGPR or AGPR, so tracking them as pure VGPR pressure is not accurate.
Adds new entries in the GCNPressure array for AVGPR pressure. In this PR, AVGPR pressure is added to pure VGPR pressure under all the pressure queries, so it is NFC. Separating out this pseudo RC will help us make more informed decisions in future work. This RC can be assigned as either VGPR or AGPR, so tracking them as pure VGPR pressure is not accurate.
Adds new entries in the GCNPressure array for AVGPR pressure. In this PR, AVGPR pressure is added to pure VGPR pressure under all the pressure queries, so it is NFC. Separating out this pseudo RC will help us make more informed decisions in future work. This RC can be assigned as either VGPR or AGPR, so tracking them as pure VGPR pressure is not accurate.
…lvm#4095) This patch fixes a performance regression in rocrand. See JIRA SWDEV-538318
Adds new entries in the GCNPressure array for AVGPR pressure. In this PR, AVGPR pressure is added to pure VGPR pressure under all the pressure queries, so it is NFC.
Separating out this pseudo RC will help us make more informed decisions in future work. This RC can be assigned as either VGPR or AGPR, so tracking them as pure VGPR pressure is not accurate.