@@ -29,43 +29,58 @@ class raw_ostream;
2929class SlotIndex ;
3030
3131struct GCNRegPressure {
32- enum RegKind { SGPR, VGPR, AGPR, TOTAL_KINDS };
32+ enum RegKind { SGPR, VGPR, AGPR, AVGPR, TOTAL_KINDS };
3333
3434 GCNRegPressure () {
3535 clear ();
3636 }
3737
38- bool empty () const { return !Value[SGPR] && !Value[VGPR] && !Value[AGPR]; }
38+ bool empty () const {
39+ return !Value[SGPR] && !Value[VGPR] && !Value[AGPR] && !Value[AVGPR];
40+ }
3941
4042 void clear () { std::fill (&Value[0 ], &Value[ValueArraySize], 0 ); }
4143
4244 // / \returns the SGPR32 pressure
4345 unsigned getSGPRNum () const { return Value[SGPR]; }
44- // / \returns the aggregated ArchVGPR32, AccVGPR32 pressure dependent upon \p
45- // / UnifiedVGPRFile
46+ // / \returns the aggregated ArchVGPR32, AccVGPR32, and Pseudo AVGPR pressure
47+ // / dependent upon \p UnifiedVGPRFile
4648 unsigned getVGPRNum (bool UnifiedVGPRFile) const {
4749 if (UnifiedVGPRFile) {
48- return Value[AGPR] ? getUnifiedVGPRNum (Value[VGPR], Value[AGPR])
49- : Value[VGPR];
50+ return Value[AGPR]
51+ ? getUnifiedVGPRNum (Value[VGPR], Value[AGPR], Value[AVGPR])
52+ : Value[VGPR] + Value[AVGPR];
5053 }
51- return std::max (Value[VGPR], Value[AGPR]);
54+ // Until we hit the VGPRThreshold, we will assign AV as VGPR. After that
55+ // point, we will assign as AGPR.
56+ return std::max (Value[VGPR] + Value[AVGPR], Value[AGPR]);
5257 }
5358
5459 // / Returns the aggregated VGPR pressure, assuming \p NumArchVGPRs ArchVGPRs
55- // / and \p NumAGPRs AGPRS, for a target with a unified VGPR file.
60+ // / \p NumAGPRs AGPRS, and \p NumAVGPRs AVGPRs for a target with a unified
61+ // / VGPR file.
5662 inline static unsigned getUnifiedVGPRNum (unsigned NumArchVGPRs,
57- unsigned NumAGPRs) {
58- return alignTo (NumArchVGPRs, AMDGPU::IsaInfo::getArchVGPRAllocGranule ()) +
63+ unsigned NumAGPRs,
64+ unsigned NumAVGPRs) {
65+
66+ // Until we hit the VGPRThreshold, we will assign AV as VGPR. After that
67+ // point, we will assign as AGPR.
68+ return alignTo (NumArchVGPRs + NumAVGPRs,
69+ AMDGPU::IsaInfo::getArchVGPRAllocGranule ()) +
5970 NumAGPRs;
6071 }
6172
62- // / \returns the ArchVGPR32 pressure
63- unsigned getArchVGPRNum () const { return Value[VGPR]; }
73+ // / \returns the ArchVGPR32 pressure, plus the AVGPRS which we assume will be
74+ // / allocated as VGPR
75+ unsigned getArchVGPRNum () const { return Value[VGPR] + Value[AVGPR]; }
6476 // / \returns the AccVGPR32 pressure
6577 unsigned getAGPRNum () const { return Value[AGPR]; }
78+ // / \returns the AVGPR32 pressure
79+ unsigned getAVGPRNum () const { return Value[AVGPR]; }
6680
6781 unsigned getVGPRTuplesWeight () const {
68- return std::max (Value[TOTAL_KINDS + VGPR], Value[TOTAL_KINDS + AGPR]);
82+ return std::max (Value[TOTAL_KINDS + VGPR] + Value[TOTAL_KINDS + AVGPR],
83+ Value[TOTAL_KINDS + AGPR]);
6984 }
7085 unsigned getSGPRTuplesWeight () const { return Value[TOTAL_KINDS + SGPR]; }
7186
0 commit comments