This is an archive of the discontinued LLVM Phabricator instance.

[mlgo][regalloc] Handle training case when no regalloc happens.
ClosedPublic

Authored by mtrofin on Feb 5 2023, 5:21 PM.

Details

Summary

There's an early-exit case for regalloc when we don't even get a chance
to ask for an advisor (priority or eviction), and switch the context.
Then, when we want to log the reward for that function (==the one with
the early exit case), we hit the error case where the function's name
doesn't match the last-seen context.

There are a few possible fixes, one would be to just switch context when
output-ing the reward, which would be correct. This patch opts for the
alternative where we check any loging happened in the first place - just
to re-validate that no function would have been regaloc-ed without first
log-ing its reward.

Diff Detail

Event Timeline

mtrofin created this revision.Feb 5 2023, 5:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2023, 5:21 PM
mtrofin requested review of this revision.Feb 5 2023, 5:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2023, 5:21 PM
MatzeB accepted this revision.Feb 6 2023, 9:50 AM

LGTM

llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
477

Ah, I see now, why things didn't work for me when I just moved the existing check :)

This revision is now accepted and ready to land.Feb 6 2023, 9:50 AM
jacobhegna accepted this revision.Feb 6 2023, 10:41 AM

This resolved my issues in training.

This revision was landed with ongoing or failed builds.Feb 6 2023, 1:57 PM
This revision was automatically updated to reflect the committed changes.