-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Optimizer] Greedy solution for join nodes in L1 Interleaved policy #1162
Conversation
PR title does not correspond to changes made. |
5a24709
to
daed82a
Compare
e6f54a9
to
4d1c249
Compare
2036257
to
0cb6250
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, because it is a big change, let's make a few architectural adjustments first and then review the rest.
0cb6250
to
485bfa0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments, mostly about readability. As @nobradovic mentioned, the PR title should try to explain what the change is in a way so that people not familiar with the work can uderstand. Maybe something like: "[Optimizer] Solve join nodes in L1 interleaved policy"
} | ||
l1ChainConfigs->back().build(); | ||
l1ChainConfigs->back().resolve(); | ||
std::unordered_set<Edge> memReconfigEdges; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we see a scenario in future where in L1Interleaved policy we will need reconfig edge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on the op and there may be a scenario where we need reconfigEdges. For example, if we greedily decide that the output of an op's operand should be in DRAM and there is enough available L1 memory this operand then we can insert a ToLayout op on that edge so we can gain on the performance. I assume this may be true depending on the op.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but in this scenario it would not be coming from policy like for example in DFSharding, but only as an external override, because if policy found out that reconfigEdge is needed it could directly change OP output instead. Just thinking if it should be completely removed from L1Interleaved policy as it is currently only used as an empty dummy struct to satisfy API.
4f43072
to
c9adb16
Compare
Change has no description. |
5eed6db
to
d559286
Compare
5b7f37d
to
74ce175
Compare
74ce175
to
062a978
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Please add a description for the PR with a few sentances describing the PR contains. Do this for all future PRs.
This PR introduces new MemoryLayoutAnalysis policy as an alternative to the DFSharding policy with the goal of greedily solving join nodes. This means that if an op is a join node (node with multiple operands, e.g. Add, Matmul,...) we should consider placing multiple op's operands in the L1 memory and limit ourselves to only one operand being placed in L1 memory as is it the case with DFSharding. For all the combination of operands, we pick the one that maximizes L1 usage (by maximising L1 usage we try to have as few DRAM spills as possible) and minimizes required L1 usage (minimal amount of L1 memory neccesseary in order to reach desired memory configuration). Furthermore, it should be emphasized that this may not lead to globally optimal solution because we pick the optimal config at moment of analysing the op.