Has any progress been made on Pure Python Torch FX Graph to MLIR importer?
I see that following post mentions about it:
12:10PM - 24 Nov 22 UTC
This adds a basic e2e Config for TorchDynamo using
But TorchDynamo is pretty orthogonal to
various other pieces, so it should compose nicely with variations like:
- Switching out all the backends (Linalg-on-Tensors, TOSA, MHLO)
- PyTorch functionalization and decompositions
- Taking the example inputs and compiling with all dynamic or all static
shapes without duplicating tests.
This adds it to the CI, but there are still a lot of XFAIL's.
This also adds a helper `from torch_mlir.dynamo import
make_simple_dynamo_backend` which simplifies some of the steps for
making a Torch-MLIR-based TorchDynamo backend. We include "simple" in
the name because we are going to be exploring various things next from
the long-term roadmap.
The next steps are:
- Burn down all the XFAIL's.
- Start working on the pieces from the [long-term roadmap](https://github.com/llvm/torch-mlir/blob/main/docs/long_term_roadmap.md).
- Add functionalization/decompositions into the TorchDynamo flow and
remove reliance on the current Torch-MLIR "frontend".
- Write a pure-Python direct FX->MLIR importer.
- Hook up the new PyTorch symbolic shape stuff.
- Explore PrimTorch decompositions for simplifying backends.
torch-mlir/__init__.py at main · llvm/torch-mlir · GitHub , I do not see any mention of support for Torch Fx graph. When using torch MLIR with PyTorch 2.0, am I still required to get a Torchscript graph before calling torch-mlir.compile?
Thanks for your help!
It’s almost done - stay tuned.
That is great to hear! Looking forward to it! So, for now, is there any way to import a Torch Fx Graph to Torch MLIR through some sort of Torch Fx to torchscript converter as torch-mlir.compile seems to expect torchscript graph ?
Passing an FX graph to torch_mlir.compile should “Just Work” – it will be scripted/traced as usual.
Thanks Sean! The Fx graph captured by TorchDynamo seems to have issue while lowering to torch MLIR for Transformer models from HuggingFace. The Fx graph captured by make_fx seems to do a lot better and lowers to torch MLIR without issues.