-
Notifications
You must be signed in to change notification settings - Fork 383
Lower MemRef GetGlobal and write data to json files #7301
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
Conversation
0e020a7 to
e8f9e95
Compare
|
I have switched to using |
a104870 to
8b314cd
Compare
|
Test case included! Ready for another round of review! |
be02332 to
a17ffca
Compare
|
fixed the signless integer problem! |
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.
Nice! A few smaller style comments, but overall looks great.
|
Made changes based on the feedback, thank you @cgyurgyik ! |
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.
A final few nits, please address them as you see fit. LGTM once tests pass. Nice job!
| llvm::json::Array result; | ||
| result.reserve(std::max(static_cast<int>(shape.size()), 1)); | ||
|
|
||
| bool isSignlessOrUnsigned = memtype.getElementType().isSignlessInteger() || |
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.
Suggestion: it seems that every place you use this its prefixed by !. Maybe just do
Type elemType = memtype.getElementType();
bool isSigned = !elemType.isSignlessInteger() && !elemType.isUnsignedInteger();(Although isn't that just the same as isSignedInteger()?)
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.
sounds good!
Although isn't that just the same as isSignedInteger()?
isSigned should be true when isSignedIntegerOrFloat, but there is no such built-in check; only isSignlessOrFloat is present, but that's not what we want.
Or we can use isSignedInteger || isFloat, but there is again no built-in isFloat check, only those specific checks like isFloat8E3M4().
So I have to use the negation logic..
…values and write to json; use std reduce to get total size
…put file hack; add more docs; and change the test file accordingly
…assigning to a int variable; also fix some issues and comment after review
8e1ea7b to
3572f99
Compare
|
Planning to squash and merge once the CI passes. Thank you for the review! |
This patch lowers
memref::GetGlobalOpand write data that it carries to corresponding json files, so that they can be used later by Calyx. Json data will be written to the same directory as the source file. Since there might be situations where users don't wish to do so, writing to json will only be carried out if users specify--lower-scf-to-calyx="write-json=true".