-
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
L1 interleaved policy #1117
L1 interleaved policy #1117
Conversation
5c18e7d
to
608a531
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, with a few comments.
93b8890
to
0194e80
Compare
0194e80
to
e5bd01d
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.
LGTM
@nobradovictt Please take a quick look as well.
|
||
// Check if currentOp is valid l1 interleaved op. | ||
// | ||
if (legalLayouts.lookup(currentOp).size() > 0) { |
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.
You don't even check if adjacent OPs in chain are connected?
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.
That is true, because we decided that is ok for V0 to put all ops with possible l1 interleaved layout into a single L1ChainConfig. Also, I added a comment that it will be fixed in V1.
// Resolve l1 chain configs. | ||
// | ||
for (auto &l1ChainConfig : *l1ChainConfigs) { | ||
l1ChainConfig.build(); |
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.
Shouldn't build happen when chain is fully populated. Using it here like this is pointless?
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.
Also here, for V0 we only have one L1ChainConfig and therefore build and resolve should happen at the same time. This for loop is only a placeholder for V1 and future versions of this policy.
|
||
// Check if currentOp is valid l1 interleaved op. | ||
// | ||
if (legalLayouts.lookup(currentOp).size() > 0) { |
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.
What if we don't have a valid l1 interleaved config?
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.
In that case, legalLayouts for that specific op will not be overridden by l1 interleaved layout and therefore keep the legalLayouts from LegalGridAnalysis.
// This is V0 implementation of L1 interleaved policy. In the current | ||
// implementation we have a single L1ChainCofig per FuncOp. This implies | ||
// that in case of DRAM spil we will have a disconnected chain of L1 ops. | ||
// This will be fixed in V1. |
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.
I don't like this proposed staging, disconnected chain is not a chain and this policy is just random then.
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.
This has already been fixed in V1 version of this policy (#1132).
Hey @fbajraktariTT, can you please add a description on what the purpose of this PR is? Additionally, can you attach tracking issue? It's a little hidden, but after you create a PR, you can click on the development section (right-side bar) to attach issues. |
c8010b7
to
e303453
Compare
Looks good to me. Let's add two tests. One with a simple fork join and one with a huge tensor size that won't fit into L1. |
0ba6873
to
902a363
Compare
Refactor sharding into mem layout analysis. All l1 interleaved policy for mem layout analysis Add mnist test Add option in both optimizer pass and ttnn-ttir-backedn-pipeline to specify memory layout analysis policy type
…ass and TTIRToTTNNBackendPipeline
f46bee4
to
11f0ea7
Compare
The goal of this PR is to add new MemoryLayoutAnalysis policy. Apart from DFShardingPolicy, the idea is to implement L1Interleaved policy that will try to build l1 interleaved chains instead of l1 sharding chains.