Skip to content

Conversation

@stellaraccident
Copy link
Collaborator

@stellaraccident stellaraccident commented Nov 21, 2023

Adds a pipeline to convert custom ops and metadata represented as torch.operator custom ops to corresponding torch ops where possible.

This is part of a multi-part approach for building ONNX import in as a regular feature of torch-mlir. It is focused on the conversions vs the infra. We will end up maintaining a pure-python importer to go with this in torch-mlir, and we will also maintain test case generation utilities derived from it.

I have left substantial documentation in the README of the conversion directory, including the recommended approach that we will take to keep building this out.

(note that this organizes the code to coincide with the refactoring in #2442 versus the current flat arrangement)

stellaraccident added a commit to nod-ai/AMD-SHARK-ModelDev that referenced this pull request Nov 21, 2023
Added per docs I am working on for the torch lowerings:
llvm/torch-mlir#2585
@stellaraccident stellaraccident marked this pull request as ready for review November 22, 2023 02:23
Add docs.

Match metadata attrs to the impl.

Add conversions.

CI

Remove stray filecheck
Copy link
Collaborator

@vivekkhandelwal1 vivekkhandelwal1 left a comment

Choose a reason for hiding this comment

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

LGTM

@stellaraccident stellaraccident merged commit e06efc5 into main Nov 22, 2023
@stellaraccident stellaraccident deleted the torch_onnx branch November 22, 2023 05:03
@silvasean
Copy link
Contributor

silvasean commented Nov 26, 2023

Drive-by nit: double-check that torch.onnx won't collide with any actual PyTorch op (not sure who own that namespace now, or how it is used -- hopefully it is isomorphic to this proposal). We may need torch._tm_onnx or some such though.

sjain-stanford added a commit that referenced this pull request Nov 28, 2023
Adapts to the TorchOnnxToTorch changes from
#2585.
Also restores bazel builds in post-merge CI that was disabled in
2148c4c.

Bazel workflow:
https://github.com/sjain-stanford/torch-mlir/actions/runs/7023912962
@stellaraccident
Copy link
Collaborator Author

Drive-by nit: double-check that torch.onnx won't collide with any actual PyTorch op (not sure who own that namespace now, or how it is used -- hopefully it is isomorphic to this proposal). We may need torch._tm_onnx or some such though.

Thanks. I did double check. I think this is good enough for now and once we get enough support to be real, we can assess/ask/etc. if we have to change it, we are at the level of a fancy sed command in the future, so I think it is fine to defer for now in favor of just moving forward.

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