This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Fix GCNDownwardRPTracker::advanceBeforeNext at the end of MBB
ClosedPublic

Authored by vpykhtin on Oct 28 2022, 2:03 AM.

Details

Summary

The problem with GCNDownwardRPTracker::advanceBeforeNext is that it doesn't allow to get register pressure
after the last instruction in a MBB.

However when we track RP through the boundary of a MBB we need the state that is after the last instruction
of the MBB and before the first instruction of the successor MBB. Currently we stop traking RP in the state
'at' the last instruction of the MBB which is incorrect.

This patch fixes 27 lit tests with EXPENSIVE_CHECKS enabled.

Diff Detail

Event Timeline

vpykhtin created this revision.Oct 28 2022, 2:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 2:03 AM
vpykhtin requested review of this revision.Oct 28 2022, 2:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 2:03 AM
vpykhtin updated this revision to Diff 471451.Oct 28 2022, 2:16 AM

updated comment

rampitec added inline comments.Oct 28 2022, 12:13 PM
llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
329

I think you still need to skip debug instructions.

vpykhtin updated this revision to Diff 472263.Nov 1 2022, 5:30 AM

restored bool return value for advanceBeforeNext, added debug instr skipping

vpykhtin marked an inline comment as done.Nov 1 2022, 5:34 AM
vpykhtin added inline comments.
llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
329

NextMI is already skipped debug instructions either in reset or advanceToNext. I just using slot index before NextMI to skip debug instruction during liveness test.

arsenm accepted this revision.Nov 1 2022, 11:06 AM
arsenm added inline comments.
llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
329

Maybe add an assert it's not a debug instruction

This revision is now accepted and ready to land.Nov 1 2022, 11:06 AM
vpykhtin updated this revision to Diff 472412.Nov 1 2022, 2:55 PM

added assert !isDebugInstr

arsenm accepted this revision.Nov 1 2022, 4:15 PM
rampitec accepted this revision.Nov 2 2022, 1:13 PM