Skip to content

Revert tensor.cast to flow reshape conversion #18772

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

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

IanWood1
Copy link
Contributor

@IanWood1 IanWood1 commented Oct 14, 2024

Revert tensor.cast to flow.tensor.reshape conversion because this is occurring too early. This happens as early as GlobalOptimization since Flow CanonicalizerPass is used there. Also, stop cloning tensor::CastOps into dispatches.

Reverted pr: #18351 Original Issue: #18229

@IanWood1
Copy link
Contributor Author

Okay, it appears like everything is working. I just need to fix up dispatch_linalg_on_tensors.mlir

@IanWood1 IanWood1 marked this pull request as ready for review October 14, 2024 22:24
@hanhanW
Copy link
Contributor

hanhanW commented Oct 14, 2024

Is the plan adding shape inference to tensor.expand/collapse_shape's canonicalization patterns?

cc @nirvedhmeshram who landed the patch

@IanWood1
Copy link
Contributor Author

Yes, I have a WIP pr llvm/llvm-project#112265. Also, It looks like collapse_shape already has this pattern

Copy link
Contributor

@nirvedhmeshram nirvedhmeshram left a comment

Choose a reason for hiding this comment

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

LGTM, yes converting to reshape early was working around an issue of tenor.casts in dispatches at the expense of shape inference, so this way we can do that shape inference on tensors and by not cloning the casts in the dispatches the original issue wont happen. Thanks!

Signed-off-by: Ian Wood <[email protected]>
@IanWood1
Copy link
Contributor Author

Given CI runs against onnx ops (https://github.com/iree-org/iree/actions/runs/11336536464/job/31526991018?pr=18772) I think this should be good to merge?

@nirvedhmeshram
Copy link
Contributor

nirvedhmeshram commented Oct 15, 2024

Given CI runs against onnx ops (https://github.com/iree-org/iree/actions/runs/11336536464/job/31526991018?pr=18772) I think this should be good to merge?

The CI doesn't really test the full coverage of onnx models but if the IR in the original issue is still compiling, I think this is okay to merge.

@IanWood1
Copy link
Contributor Author

iree-compile hit an assertion due to the elided dense attrs (after compilation) which I assume means it works

@nirvedhmeshram
Copy link
Contributor

iree-compile hit an assertion due to the elided dense attrs (after compilation) which I assume means it works

Yes, that old IR had that issue so you are good to go.

@IanWood1 IanWood1 merged commit 2945399 into iree-org:main Oct 16, 2024
35 checks passed
@IanWood1 IanWood1 deleted the revert_cast_to_reshape branch October 16, 2024 01:00
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.

4 participants