@@ -29,43 +29,57 @@ class raw_ostream;
29
29
class SlotIndex ;
30
30
31
31
struct GCNRegPressure {
32
- enum RegKind { SGPR, VGPR, AGPR, TOTAL_KINDS };
32
+ enum RegKind { SGPR, VGPR, AGPR, AVGPR, TOTAL_KINDS };
33
33
34
34
GCNRegPressure () {
35
35
clear ();
36
36
}
37
37
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
+ }
39
41
40
42
void clear () { std::fill (&Value[0 ], &Value[ValueArraySize], 0 ); }
41
43
42
44
// / \returns the SGPR32 pressure
43
45
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
46
48
unsigned getVGPRNum (bool UnifiedVGPRFile) const {
47
49
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];
50
53
}
51
- return std::max (Value[VGPR], Value[AGPR]);
54
+ // AVGPR assignment priority is based on the width of the register. Account
55
+ // AVGPR pressure as VGPR.
56
+ return std::max (Value[VGPR] + Value[AVGPR], Value[AGPR]);
52
57
}
53
58
54
59
// / 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.
56
62
inline static unsigned getUnifiedVGPRNum (unsigned NumArchVGPRs,
57
- unsigned NumAGPRs) {
58
- return alignTo (NumArchVGPRs, AMDGPU::IsaInfo::getArchVGPRAllocGranule ()) +
63
+ unsigned NumAGPRs,
64
+ unsigned NumAVGPRs) {
65
+
66
+ // Assume AVGPRs will be assigned as VGPRs.
67
+ return alignTo (NumArchVGPRs + NumAVGPRs,
68
+ AMDGPU::IsaInfo::getArchVGPRAllocGranule ()) +
59
69
NumAGPRs;
60
70
}
61
71
62
- // / \returns the ArchVGPR32 pressure
63
- unsigned getArchVGPRNum () const { return Value[VGPR]; }
72
+ // / \returns the ArchVGPR32 pressure, plus the AVGPRS which we assume will be
73
+ // / allocated as VGPR
74
+ unsigned getArchVGPRNum () const { return Value[VGPR] + Value[AVGPR]; }
64
75
// / \returns the AccVGPR32 pressure
65
76
unsigned getAGPRNum () const { return Value[AGPR]; }
77
+ // / \returns the AVGPR32 pressure
78
+ unsigned getAVGPRNum () const { return Value[AVGPR]; }
66
79
67
80
unsigned getVGPRTuplesWeight () const {
68
- return std::max (Value[TOTAL_KINDS + VGPR], Value[TOTAL_KINDS + AGPR]);
81
+ return std::max (Value[TOTAL_KINDS + VGPR] + Value[TOTAL_KINDS + AVGPR],
82
+ Value[TOTAL_KINDS + AGPR]);
69
83
}
70
84
unsigned getSGPRTuplesWeight () const { return Value[TOTAL_KINDS + SGPR]; }
71
85
0 commit comments