Skip to content
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

Relax SliceOp to being able to be a root op. #3876

Merged
merged 5 commits into from Nov 18, 2020

Conversation

hanhanW
Copy link
Contributor

@hanhanW hanhanW commented Nov 17, 2020

  • Move mergable checks to DispatchConfig.
  • Add a new trait for root only ops.
  • Add slice + add tests.

@google-cla google-cla bot added the cla: yes label Nov 17, 2020
++lhsResultIdx) {
if (rhsArgs[rhsOpIdx] == lhs.getResult(lhsResultIdx)) {
for (auto *user : rhsBlock.getArgument(rhsOpIdx).getUsers()) {
if (isa<mhlo::TorchIndexSelectOp>(user)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be really nice to remove as many of these hardcoded ops as possible - is this still actually required to be inspected manually like this? can the trait you're looking for here be generalized (like isIndexableOp in dispatch analysis, etc) so that we have a chance of not ending up with an explosion of things in this file?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this kind of super specific check is needed, move it to DispatchConfig.h as an isFoo(op) method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to move it to DispatchConfig.h

For long-term, we would like to remove most of these limits, but now I'm trying to push the boundary so we will get more ideas where we are and how to push things forward.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM! what you're doing now is super useful as it lets us know which ops we actually care about and hopefully come up with some unique traits for them that we can upstream and apply to other frontend dialects like TOSA - way easier to do that when we have the minimal set and not a bunch of random ones :)

for (int rhsOpIdx = 0; rhsOpIdx < rhsArgs.size(); ++rhsOpIdx) {
for (int lhsResultIdx = 0; lhsResultIdx < lhs.getNumResults();
++lhsResultIdx) {
if (rhsArgs[rhsOpIdx] == lhs.getResult(lhsResultIdx)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 level deep nesting gets hard to read - prefer instead to early exit to keep things shallow

for example, if (rhs arg != lhs arg) continue;

@hanhanW hanhanW changed the base branch from google to main November 17, 2020 19:13
@hanhanW hanhanW changed the title Leaf root op Relax SliceOp to being able to be a root op. Nov 17, 2020
@hanhanW
Copy link
Contributor Author

hanhanW commented Nov 17, 2020

Still need some clean up, please hold off the review a bit

@hanhanW hanhanW merged commit 347d5c4 into iree-org:main Nov 18, 2020
@hanhanW hanhanW deleted the leaf-root-op branch November 18, 2020 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants