This leverages the new logging format in that we don't need to buffer
the training data, we can just write it out.
Details
- Reviewers
kazu jacobhegna - Commits
- rG6d11baf02b33: [mlgo] Stream the training data
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM. Just a minor comment about currentObservationID.
llvm/include/llvm/Analysis/Utils/TrainingLogger.h | ||
---|---|---|
122–124 | If you only care about currentObservationID().has_value(), I wonder if you can rename this function to isObservationInProgress or something and do: return ObservationIDs.count(CurrentContext); |
llvm/include/llvm/Analysis/Utils/TrainingLogger.h | ||
---|---|---|
122–124 | good point, done! |
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp | ||
---|---|---|
468–469 | I think I am hitting this for cases where RegAllocGreedy bails out early in the if (!hasVirtRegAlloc()) return false; check and never initializes the advisor. Replacing with Log->switchCurrentContext() for my experiments... |
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp | ||
---|---|---|
468–469 | ack. I'll take a look. Probably in that case (!hasVirtRegAlloc()) there's also no output to log, right? |
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp | ||
---|---|---|
468–469 | Guess I can also try to first test for hasObservationInProgress() and bail out on that before checking the function name... Rebuilding and testing right now... |
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp | ||
---|---|---|
468–469 | checking for hasObservationInProgress() first was not enough to avoid hitting those errors. (the "InProgress" part of the function name seems somewhat confusing anyway as this seems to be more of an "everHadAnObservation()" behavior rather than being in the middle of a startObservation() / endObservation() thingy...) |
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp | ||
---|---|---|
468–469 | I'm not sure it's really that early-exit in RAGreedy that makes me hit that error, but I am hitting it for multiple functions within many compilation units here; will continue digging next week... |
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp | ||
---|---|---|
468–469 | Ack, thanks - so in the case you're seeing, we did have an observation but we get to logRewardIfNeeded for a different function first? (lmk if you can share a repro, happy to help) |
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp | ||
---|---|---|
468–469 | I am hitting this error when training the regalloc priority model as well. |
If you only care about currentObservationID().has_value(), I wonder if you can rename this function to isObservationInProgress or something and do: