[llvm-branch-commits] [llvm] [AMDGPU] Physical register tracking in GCN trackers. (PR #184275)
Dhruva Chakrabarti via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Mar 5 12:54:01 PST 2026
================
@@ -335,17 +370,60 @@ class GCNRPTracker {
LaneBitmask getLastUsedLanes(Register Reg, SlotIndex Pos) const;
+ // Helper to check if a register unit is live at a given slot index.
+ bool isUnitLiveAt(MCRegUnit Unit, SlotIndex SI) const;
+
+ // Check if all register units of Reg are currently live in PhysLiveRegs.
+ bool allRegUnitsLive(Register Reg) const;
+
+ // Check if Reg has any killed units at the given slot index.
+ bool checkRegKilled(Register Reg, SlotIndex SI) const;
+
+ // Check if Reg has any killed units and erase them from PhysLiveRegs.
+ bool eraseKilledUnits(Register Reg, SlotIndex SI);
+
+ // Erase all live units of Reg from PhysLiveRegs.
+ // Returns true if any unit was live (and thus erased).
+ bool eraseAllLiveUnits(Register Reg);
+
+ // Insert all not-live units of Reg into PhysLiveRegs.
+ // Returns true if any unit was not live (and thus inserted).
+ bool insertAllNotLiveUnits(Register Reg);
+
public:
+ // Enable physical register tracking only if both GCNTrackers and
+ // TrackPhysRegInTrackers are true.
+ void setPhysRegTracking();
+
// reset tracker and set live register set to the specified value.
void reset(const MachineRegisterInfo &MRInfo,
const LiveRegSet &VirtLiveRegsSet);
+
// live regs for the current state
const decltype(VirtLiveRegs) &getLiveRegs() const { return VirtLiveRegs; }
+ const decltype(VirtLiveRegs) &getVirtLiveRegs() const { return VirtLiveRegs; }
const MachineInstr *getLastTrackedMI() const { return LastTrackedMI; }
- void clearMaxPressure() { MaxVirtPressure.clear(); }
+ void clearMaxPressure() {
+ MaxVirtPressure.clear();
+ MaxPhysPressure.clear();
+ }
+
+ // Returns sum of virtual and physical register pressure
----------------
dhruvachak wrote:
I agree. But I don't know how to capture that in the current framework. The total pressure during scheduling is used in heuristics that don't always look at the allocatable set. So, I am maintaining total pressure that includes both virtual and physical registers.
https://github.com/llvm/llvm-project/pull/184275
More information about the llvm-branch-commits
mailing list