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

Add preprocessing TransposeExtractConcat pass #17692

Closed
wants to merge 2 commits into from

Conversation

IanWood1
Copy link
Contributor

@IanWood1 IanWood1 commented Jun 18, 2024

@IanWood1 IanWood1 force-pushed the concat branch 2 times, most recently from f256330 to 50d192f Compare June 18, 2024 17:26
@IanWood1 IanWood1 marked this pull request as ready for review June 18, 2024 20:05
rewriter, genericOp.getDpsInitOperand(0)->get(), perm);
SmallVector<Value> newOperands(genericOp.getOperands());
newOperands.back() = newInit;
auto newGenericOp =
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have expected that you have to transpose the operands as well? I am actually confused why you even need to do a transpose or anything here... you should be able to just clone the operation as is?

Copy link
Contributor Author

@IanWood1 IanWood1 Jun 25, 2024

Choose a reason for hiding this comment

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

I guess the naming for the function createTransposedInit wasn't good. Its not transposing anything but rather creating an empty tensor of the same shape as the new. The idea is that there is a long chain of unary elementwise generic ops and when the tensor.extract_slice op gets transposed, the corresponding child linalg generic's operand type is updated but not the dps init operand.

e.g.
generic with ins(tensor<1024x2>) outs(tensor<1024x2>)

then, after changing transposing extract slice ins and outs don't match:
generic with ins(tensor<2x1024>) outs(tensor<1024x2>)

Copy link
Contributor

Choose a reason for hiding this comment

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

Lets try to find time today to walk through this a bit.

IanWood1 added 2 commits June 25, 2024 05:15
Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu>
Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu>
@IanWood1
Copy link
Contributor Author

IanWood1 commented Jun 28, 2024

Talked with Mahesh yesterday about this. Notes:

  • Must check that indexing maps are identity (like when there is a affine constant 0)
  • gridsampler op from torch-mlir should be using linalg.index

@AmosLewis
Copy link
Contributor

llvm/torch-mlir#3483

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.

3 participants