This is an archive of the discontinued LLVM Phabricator instance.

RegAllocGreedy: Fix illegal eviction assert for urgent evictions
ClosedPublic

Authored by arsenm on Mar 29 2022, 5:25 PM.

Details

Reviewers
qcolombet
MatzeB
Summary

The condition in canEvictInterferenceBasedOnCost is slightly different
from the assertion in evictInteference.
canEvictInterferenceBasedOnCost uses a <= check for the cascade number
for legality, but the assert was checking for <. For equal cascade
numbers for an urgent eviction, canEvictInterferenceBasedOnCost could
return success. The actual eviction would then hit this assert. Avoid
ever returning true for equivalent cascade numbers.

The resulting failed allocation seems a bit off to me. e.g. in
illegal-eviction-assert.mir, I wuold assume %0 gets allocated starting
at $vgpr0. That was its initial allocation choice, but was later
evicted. In this example no evictions can help improve anything.

Diff Detail

Event Timeline

arsenm created this revision.Mar 29 2022, 5:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2022, 5:25 PM
arsenm requested review of this revision.Mar 29 2022, 5:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2022, 5:25 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm updated this revision to Diff 419025.Mar 29 2022, 5:42 PM

Add testcase comment

Another testcase continues to infinite loop with this assertion suppressed, so maybe this isn't right

arsenm updated this revision to Diff 419538.Mar 31 2022, 12:17 PM
arsenm retitled this revision from RegAllocGreedy: Relax increasing cascade number assertion to RegAllocGreedy: Fix illegal eviction assert for urgent evictions.
arsenm edited the summary of this revision. (Show Details)

Keep the assert as-is. Adjust canEvictInterferenceBasedOnCost to return false for urgent evictions with equivalent cascade numbers

qcolombet accepted this revision.Apr 1 2022, 11:00 AM
This revision is now accepted and ready to land.Apr 1 2022, 11:00 AM