This patch introduces the priority analysis and the priority advisor,
the default implementation, and the scaffolding for introducing the
other implementations of the advisor.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Add a patch description: what is this patch trying to achieve?
llvm/lib/CodeGen/MLRegallocPriorityAdvisor.cpp | ||
---|---|---|
1 ↗ | (On Diff #450897) | This should come in a different patch. |
llvm/lib/CodeGen/RegAllocPriorityAdvisor.cpp | ||
30 | new line | |
llvm/lib/CodeGen/RegAllocPriorityAdvisor.h | ||
26 | I'd prefer this were introduced in a subsequent change. This current change can stay focused at factoring out the prioritization logic behind the RegAllocPriorityAdvisor interface. | |
59 | add a new line |
This patch introduces the priority analysis and the priority advisor,
the default implementation, and the scaffolding for introducing the
other implementations of the advisor.
llvm/lib/CodeGen/RegAllocPriorityAdvisor.h | ||
---|---|---|
12 | Header guard is still missing |
llvm/lib/CodeGen/RegAllocGreedy.cpp | ||
---|---|---|
357 | rename to getPriority, and it should just take LIas parameter. Then, its implementation is all the stuff above. | |
llvm/lib/CodeGen/RegAllocPriorityAdvisor.h | ||
35 | remove logReward. this is something that only matters in the training scenario, so it doesn't belong on the abstraction. | |
38 | do you need MF and RA here? IIUC, you just need the LiveInterval (passed in); maybe have the advisor take just RAGreedy, so it can get to ExtraInfo and LIS from it. At this stage, too, the ctor can be public. | |
45 | remove the analysis stuff, it'll come in with a subsequent patch | |
83 | remove logReward. |
Nice! This is almost ready to go, left a few comments that should be easy to address.
llvm/lib/CodeGen/CMakeLists.txt | ||
---|---|---|
171 | nit: place it in alphabetical order, I think this goes under PBQP | |
llvm/lib/CodeGen/RegAllocGreedy.cpp | ||
298 | make it const LiveInterval &LI: it's never expected to be nullptr, so pass-by-reference strongly suggests that to one reading the code. also: remove the LiveRangeStage parameter. You can get it from RA.getExtraInfo().getStage(LI). This makes the interface very simple: you pass in a LI, you get a priority, the rest of the values that may factor in the calculation are up to the advisor implementation to get from wherever - other analyses, or the RA. | |
llvm/lib/CodeGen/RegAllocGreedy.h | ||
152 | this API almost feels like could be removed and we just pass RegClassPriorityTrumpsGlobalness via the ctor to the advisor, but we can easily do that once the full design is in, so lgtm | |
153 | you can put a FIXME comment above to say this can be removed once we have an analysis, because the analysis can getAnalysis<SlotIndexes> and pass this. See elsewhere in the codebase how these comments look like (basically //FIXME: this is unnecessary once priority advisers are created by an analysis pass, which can fetch the SlotIndexes analysis itself.) | |
llvm/lib/CodeGen/RegAllocPriorityAdvisor.h | ||
45 | SlotIndexes * const Indexes; const bool RegClassPriorityTrumpsGlobalness; because they are ctor-time init-ed and then never change. |
Please remember to:
- add this to the git commit (i.e. git commit --amend and make sure this is the description)
- also add this to the review message (from Edit Revision button on the right)
llvm/lib/CodeGen/RegAllocGreedy.cpp | ||
---|---|---|
357 | Did you consider the precision loss that can happen when casting a 32bit unsigned number to 32bit float? |
llvm/lib/CodeGen/RegAllocPriorityAdvisor.h | ||
---|---|---|
2 | You marked this comment as "done", but this still reads "interference resolution" which I am pretty sure makes no sense. |
nit: place it in alphabetical order, I think this goes under PBQP