-
Notifications
You must be signed in to change notification settings - Fork 612
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
[Encoding][DT][NFC] Simplify the codes for EncodingAttr creation. #19147
Conversation
We've developed few builders for the EncodingAttr; the method takes non-attribute types. We can use the builders to avoid C++ structures to MLIR attributes conversion. Signed-off-by: hanhanW <[email protected]>
Signed-off-by: hanhanW <[email protected]>
std::optional<AffineMap> newBcastMap; | ||
if (encoding.getBcastMap()) { | ||
newBcastMap = encoding.getBcastMap().getValue(); | ||
} |
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 is the only part of this PR that, instead of simplifying code, adds more complex code. Why can't we continue to just pass encoding.getBcastMap()
to IREE::Encoding::EncodingAttr::get
like in the existing code?
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.
Good question. This is because encoding.getBcastMap()
returns an attribute (i.e., AffineMapAttr), while the builder requires C++ structured/builtin types (i.e., std::optional<AffineMap>
). Instead of having the logic here, I think we can add an std::optional<AffineMap> getBcastMapValue()
method to the encoding attribute. What do you think?
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 see. I like the idea, but really don't favor adding extraClassDeclarations
. Can this be a plain global C++ function instead (not declared in .td, not member)? Otherwise, feel free to just drop that commit, I don't want to make this PR hard to merge and I liked the original form very much already.
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 can try to put it to a better state when I start poking the broadcast map things. I don't really know what methods could be useful and we can revisit later (when we have more needs). Revert the commits for now.
Signed-off-by: hanhanW <[email protected]>
Signed-off-by: hanhanW <[email protected]>
This reverts commit 268a6f9. Signed-off-by: hanhanW <[email protected]>
This reverts commit 9d256c2. Signed-off-by: hanhanW <[email protected]>
Signed-off-by: hanhanW <[email protected]>
36012ab
to
ac56f17
Compare
We've developed few builders for the EncodingAttr; the method takes
non-attribute types. We can use the builders to avoid C++ structures to
MLIR attributes conversion.