-
Notifications
You must be signed in to change notification settings - Fork 321
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
[NNPA] Memory reduction of stickified constant by stickifying at file writing #2917
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
@jenkins-droid test this please. |
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
I updated the figure in this PR since previous figure might be confusing. |
Signed-off-by: Haruki Imai <[email protected]>
The previous figure is fine. I knew that this PR replaced some krnl.GlobalOps (result of stickifiedConstant) with zlowstickifiedConstant. The previous figure showed the reason why the ConstantOpInterface is introduced. |
@chentong319 Thanks for the comments. I'm now looking into RNN group and inheritance in Op definition. |
Our RNN group did not use inheritance. We just use a common utility function for core part of different RNN operations. |
I'm considering to use common functions. I'm investigating how we can commonize |
If you use the Op matching rule for rewrite, the op is cast automatically. |
From ConstantOpInterface to KrnlGlobalOpInterface Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
@chentong319 Thanks for the investigations and comments! I tried to implement some other way such as common functions and Trait, but I couldn't write it clean. So, I would like to keep using OpInterface. |
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
"The stickified tensor's buffer size and MemRef's size mismatched"); | ||
|
||
// Create a KrnlGlobalOp. | ||
KrnlGlobalOp constantGlobal = |
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.
Keep the previous implementation with KrnlGlobalOp in comment or if false
branch, if you do not want to create an option to control the choice. You can define an option '--disable-krnl-constant-to-file' with default value of 'false'.
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.
OK. Is this because we may reuse the previous implementation in the future?
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 created directive NNPA_ZHIGH_STICKIFIEDCONST_GEN
to keep the original implementation. Currently commented out, but I confirmed it works when enabling this code.
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Signed-off-by: Haruki Imai <[email protected]>
Could you review again? |
@chentong319 Do you mind reviewing it? You have been very involved with this PR. Thanks |
Signed-off-by: Haruki Imai <[email protected]>
This PR reduces memory usage for NNPA compilation. Current main branch creates stickified data in ZHighConstPropagationPass and keeps the data until compilation finish. This PR sets original data, not stickified data, in ZHighConstPropagationPass. Then, in the KrnlToLLVMPass, stickfied data is created and stored in the file, and deleted after writing into the file.