Skip to content

Commit ccd469c

Browse files
stellaraccidentmonorimetaviator19941123epsilonbrucekimrokcmu
authored
[fx] Upstream the turbine FxImporter to torch-mlir. (#2681)
Changes made during upstreaming: * Removed comments attributing some copied code back to torch-mlir (since it is now repatriated). * Re-organized imports. * Inlined RefMapping/RefTracker and TypeSubclassMap from an external utility module. * Added FxImporter class comments. * Updated stack trace extraction to be fail safe. * Added an entry-point for `import_frozen_exported_program` which uses the shiny new upstream `torch.export.export()` API (versus the lower-level/older API that Turbine is presently using). This necessitated a small FX rewrite to line external state management up with current conventions. * Adapted one of Turbine's importer tests to go with this initial submission. Turbine unfortunately has a lot of more-integration-ey tests, and I would like to extract those as more of unit tests of the importer features and upstream them that way vs trying to copy directly. For now, one overall test with the initial submission gets us moving. I acknowledge that there are some code quality things that could be improved in this submission: this was authored over the course of many months (and often via some trial and error). I would like to keep it relatively converged with the downstream for the next few steps while getting the test suite upstreamed. And then it will be easier to take a hygienic pass through the code. Including co-authors for contributors in the git log of the original repository. Co-authored-by: Ean Garvey <[email protected]> Co-authored-by: Avinash Sharma <[email protected]> Co-authored-by: Arham Khan <[email protected]> Co-authored-by: brucekimrokcmu <[email protected]> Co-authored-by: saienduri <[email protected]>
1 parent 46f2cb5 commit ccd469c

File tree

3 files changed

+1319
-0
lines changed

3 files changed

+1319
-0
lines changed

python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ declare_mlir_python_sources(TorchMLIRPythonSources.Importers
3535
ROOT_DIR "${TORCH_MLIR_PYTHON_ROOT_DIR}"
3636
ADD_TO_PARENT TorchMLIRPythonSources
3737
SOURCES
38+
extras/fx_importer.py
3839
extras/onnx_importer.py
3940
)
4041

0 commit comments

Comments
 (0)