From 6961f0a2472561b06d2b831eda68aa3b369e8555 Mon Sep 17 00:00:00 2001 From: Stella Laurenzo Date: Thu, 2 Nov 2023 19:45:55 -0700 Subject: [PATCH] Re-organize project structure to separate PyTorch dependencies from core project. (#2542) This is a first step towards the structure we discussed here: https://gist.github.com/stellaraccident/931b068aaf7fa56f34069426740ebf20 There are two primary goals: 1. Separate the core project (C++ dialects and conversions) from the hard PyTorch dependencies. We move all such things into projects/pt1 as a starting point since they are presently entangled with PT1-era APIs. Additional work can be done to disentangle components from that (specifically LTC is identified as likely ultimately living in a `projects/ltc`). 2. Create space for native PyTorch2 Dynamo-based infra to be upstreamed without needing to co-exist with the original TorchScript path. Very little changes in this path with respect to build layering or options. These can be updated in a followup without commingling directory structure changes. This also takes steps toward a couple of other layering enhancements: * Removes the llvm-external-projects/torch-mlir-dialects sub-project, collapsing it into the main tree. * Audits and fixes up the core C++ build to account for issues found while moving things. This is just an opportunistic pass through but roughly ~halves the number of build actions for the project from the high 4000's to the low 2000's. It deviates from the discussed plan by having a `projects/` tree instead of `compat/`. As I was thinking about it, this will better accommodate the follow-on code movement. Once things are roughly in place and the CI passing, followups will focus on more in-situ fixes and cleanups. --- .github/workflows/buildAndTest.yml | 3 +- .gitignore | 2 +- CMakeLists.txt | 79 +++++++++---------- build_tools/autogen_ltc_backend.py | 8 +- build_tools/build_standalone.sh | 3 +- .../python_deploy/build_linux_packages.sh | 7 +- build_tools/python_deploy/build_windows_ci.sh | 3 +- docs/development.md | 6 +- .../torch-mlir-dialects/CMakeLists.txt | 64 --------------- .../torch-mlir-dialects/README.md | 11 --- .../include/CMakeLists.txt | 1 - .../torch-mlir-dialects/lib/CMakeLists.txt | 1 - .../lib/Dialect/CMakeLists.txt | 1 - .../torch-mlir-dialects/test/CMakeLists.txt | 21 ----- .../test/lit.site.cfg.py.in | 27 ------- .../torch-mlir-dialects/tools/CMakeLists.txt | 1 - .../torch-mlir-dialects-opt/CMakeLists.txt | 22 ------ .../torch-mlir-dialects-opt.cpp | 48 ----------- include/CMakeLists.txt | 1 + .../torch-mlir-dialects/CMakeLists.txt | 0 .../Dialect/CMakeLists.txt | 0 .../Dialect/TMTensor/CMakeLists.txt | 0 .../Dialect/TMTensor/IR/CMakeLists.txt | 0 .../TMTensor/IR/ScalarLoopOpInterface.h | 0 .../TMTensor/IR/ScalarLoopOpInterface.td | 0 .../Dialect/TMTensor/IR/TMTensorBase.td | 0 .../Dialect/TMTensor/IR/TMTensorDialect.h | 0 .../Dialect/TMTensor/IR/TMTensorInterfaces.h | 0 .../Dialect/TMTensor/IR/TMTensorInterfaces.td | 0 .../Dialect/TMTensor/IR/TMTensorOpInterface.h | 0 .../Dialect/TMTensor/IR/TMTensorOps.h | 0 .../Dialect/TMTensor/IR/TMTensorOps.td | 0 .../TMTensor/Transforms/CMakeLists.txt | 0 .../Dialect/TMTensor/Transforms/PassDetail.h | 0 .../Dialect/TMTensor/Transforms/Passes.h | 0 .../Dialect/TMTensor/Transforms/Passes.td | 0 include/torch-mlir/InitAll.h | 6 ++ lib/CAPI/CMakeLists.txt | 2 - lib/CMakeLists.txt | 19 +++-- lib/Conversion/CMakeLists.txt | 4 - .../TorchConversionToMLProgram/CMakeLists.txt | 3 - lib/Conversion/TorchToArith/CMakeLists.txt | 3 - lib/Conversion/TorchToLinalg/CMakeLists.txt | 3 - lib/Conversion/TorchToSCF/CMakeLists.txt | 3 - .../TorchToStablehlo/CMakeLists.txt | 3 - lib/Conversion/TorchToTMTensor/CMakeLists.txt | 3 - lib/Conversion/TorchToTosa/CMakeLists.txt | 3 - lib/Dialect/CMakeLists.txt | 1 + .../Dialect/TMTensor/CMakeLists.txt | 0 .../Dialect/TMTensor/IR/CMakeLists.txt | 2 +- .../TMTensor/IR/ScalarLoopOpInterface.cpp | 0 .../Dialect/TMTensor/IR/TMTensorDialect.cpp | 0 .../TMTensor/IR/TMTensorInterfaces.cpp | 0 .../Dialect/TMTensor/IR/TMTensorOps.cpp | 0 .../Dialect/TMTensor/Transforms/Bufferize.cpp | 0 .../TMTensor/Transforms/CMakeLists.txt | 2 + .../TMTensor/Transforms/ConvertToLoops.cpp | 0 .../Dialect/TMTensor/Transforms/Passes.cpp | 0 lib/Dialect/Torch/IR/CMakeLists.txt | 3 - lib/Dialect/Torch/Transforms/CMakeLists.txt | 3 - lib/Dialect/TorchConversion/IR/CMakeLists.txt | 3 - .../TorchConversion/Transforms/CMakeLists.txt | 3 - lib/InitAll.cpp | 20 ++++- projects/pt1/CMakeLists.txt | 27 +++++++ .../pt1/e2e_testing}/main.py | 0 .../pt1/e2e_testing}/xfail_sets.py | 0 .../pt1/examples}/ltc_backend_bert.py | 0 .../pt1/examples}/ltc_backend_mnist.py | 0 .../pt1/examples}/torchdynamo_resnet18.py | 0 .../pt1/examples}/torchscript_resnet18.py | 0 .../torchscript_resnet18_all_output_types.py | 0 .../torchscript_resnet_inference.ipynb | 0 .../torchscript_stablehlo_backend_resnet.py | 0 .../torchscript_stablehlo_backend_tinybert.py | 0 .../pt1/python}/CMakeLists.txt | 2 +- .../pt1/python}/TorchMLIRModule.cpp | 0 .../pt1/python}/test/CMakeLists.txt | 0 .../pt1/python}/test/annotations-sugar.py | 0 .../test/compile_api/already_scripted.py | 0 .../test/compile_api/already_traced.py | 0 .../test/compile_api/backend_legal_ops.py | 0 .../pt1/python}/test/compile_api/basic.py | 0 .../pt1/python}/test/compile_api/make_fx.py | 0 .../test/compile_api/multiple_methods.py | 0 .../test/compile_api/output_type_spec.py | 0 .../pt1/python}/test/compile_api/tracing.py | 0 .../pt1/python}/test/debug/lockstep_basic.py | 0 .../python}/test/dynamo_fx_importer/basic.py | 0 .../test/lazy_backend/device_data_name.py | 0 .../pt1/python}/test/lazy_backend/run_test.py | 0 .../pt1/python}/test/lit.cfg.py | 0 .../pt1/python}/test/lit.site.cfg.py.in | 0 .../test/torchscript_e2e_test/README.md | 0 .../test/torchscript_e2e_test/basic.py | 0 .../compilation_failure.py | 0 .../torchscript_e2e_test/error_reports.py | 0 .../torchscript_e2e_test/non_tensor_values.py | 0 .../torchscript_e2e_test/runtime_failure.py | 0 .../test/torchscript_e2e_test/submodule.py | 0 .../pt1/python}/torch_mlir/__init__.py | 0 .../python}/torch_mlir/_dynamo_fx_importer.py | 0 .../CMakeLists.txt | 1 - .../_torch_mlir_custom_op_example/README.md | 0 .../_torch_mlir_custom_op_example/__init__.py | 0 .../torch_mlir_custom_op_example.cpp | 0 .../pt1/python}/torch_mlir/_version.py | 0 .../cmake/modules/TorchMLIRPyTorch.cmake | 0 .../pt1/python}/torch_mlir/compiler_utils.py | 0 .../pt1/python}/torch_mlir/csrc/.clang-format | 0 .../csrc/base_lazy_backend/CMakeLists.txt | 16 ++-- .../csrc/base_lazy_backend/README.md | 0 .../csrc/base_lazy_backend/backend_impl.cpp | 0 .../csrc/base_lazy_backend/backend_impl.h | 0 .../csrc/base_lazy_backend/dynamic_ir.cpp | 0 .../csrc/base_lazy_backend/dynamic_ir.h | 0 .../csrc/base_lazy_backend/ir_builder.h | 0 .../mlir_lowering_context.cpp | 0 .../base_lazy_backend/mlir_lowering_context.h | 0 .../mlir_native_functions.cpp | 0 .../csrc/base_lazy_backend/mlir_node.cpp | 0 .../csrc/base_lazy_backend/mlir_node.h | 0 .../base_lazy_backend/mlir_node_lowering.cpp | 0 .../base_lazy_backend/mlir_node_lowering.h | 0 .../base_lazy_backend/ops/device_data.cpp | 0 .../csrc/base_lazy_backend/ops/device_data.h | 0 .../csrc/base_lazy_backend/ops/generic.cpp | 0 .../csrc/base_lazy_backend/ops/generic.h | 0 .../csrc/base_lazy_backend/ops/index.cpp | 0 .../csrc/base_lazy_backend/ops/index.h | 0 .../csrc/base_lazy_backend/ops/ivalue.cpp | 0 .../csrc/base_lazy_backend/ops/ivalue.h | 0 .../csrc/base_lazy_backend/ops/split.cpp | 0 .../csrc/base_lazy_backend/ops/split.h | 0 .../csrc/base_lazy_backend/ops/to_copy.h | 0 .../csrc/base_lazy_backend/ops/unbind_int.cpp | 0 .../csrc/base_lazy_backend/ops/unbind_int.h | 0 .../base_lazy_backend/shape_inference.cpp | 0 .../csrc/base_lazy_backend/tensor.cpp | 0 .../csrc/base_lazy_backend/tensor.h | 0 .../csrc/base_lazy_backend/utils/debug.h | 0 .../csrc/base_lazy_backend/utils/exception.h | 0 .../base_lazy_backend/utils/jit_utils.cpp | 0 .../csrc/base_lazy_backend/utils/jit_utils.h | 0 .../base_lazy_backend/utils/string_utils.h | 0 .../csrc/base_lazy_backend/utils/sys_utils.h | 0 .../base_lazy_backend/utils/tensor_utils.cpp | 0 .../base_lazy_backend/utils/tensor_utils.h | 0 .../reference_lazy_backend/CMakeLists.txt | 7 +- .../csrc/reference_lazy_backend/__init__.py | 0 .../reference_lazy_backend/backend_impl.cpp | 0 .../reference_lazy_backend/backend_impl.h | 0 .../reference_lazy_backend/gen_dummy_lib.py | 0 .../reference_lazy_backend_pybind.cpp | 0 .../torch_mlir/dialects/TorchBinding.td | 0 .../torch_mlir/dialects/torch/__init__.py | 0 .../dialects/torch/importer/__init__.py | 0 .../torch/importer/jit_ir/CMakeLists.txt | 7 +- .../torch/importer/jit_ir/__init__.py | 0 .../importer/jit_ir/build_tools/__init__.py | 0 .../build_tools/abstract_interp_lib_gen.py | 0 .../jit_ir/build_tools/library_generator.py | 0 .../importer/jit_ir/build_tools/registry.py | 0 .../jit_ir/build_tools/testing_framework.py | 0 .../jit_ir/build_tools/torch_ods_gen.py | 0 .../importer/jit_ir/build_tools/utils.py | 0 .../torch/importer/jit_ir/csrc/CMakeLists.txt | 0 .../importer/jit_ir/csrc/class_annotator.cpp | 0 .../importer/jit_ir/csrc/class_annotator.h | 0 .../jit_ir/csrc/class_annotator_pybind.cpp | 0 .../jit_ir/csrc/class_annotator_pybind.h | 0 .../jit_ir/csrc/function_importer.cpp | 0 .../importer/jit_ir/csrc/function_importer.h | 0 .../jit_ir/csrc/get_registered_ops.cpp | 0 .../importer/jit_ir/csrc/get_registered_ops.h | 0 .../importer/jit_ir/csrc/import_options.h | 0 .../jit_ir/csrc/import_options_pybind.cpp | 0 .../jit_ir/csrc/import_options_pybind.h | 0 .../jit_ir/csrc/init_python_bindings.cpp | 0 .../importer/jit_ir/csrc/ivalue_importer.cpp | 0 .../importer/jit_ir/csrc/ivalue_importer.h | 0 .../torch/importer/jit_ir/csrc/mlir_utils.h | 0 .../importer/jit_ir/csrc/module_builder.cpp | 0 .../importer/jit_ir/csrc/module_builder.h | 0 .../importer/jit_ir/csrc/node_importer.cpp | 0 .../importer/jit_ir/csrc/node_importer.h | 0 .../jit_ir/csrc/torch_to_mlir_utils.cpp | 0 .../jit_ir/csrc/torch_to_mlir_utils.h | 0 .../jit_ir/torchscript_annotations.py | 0 .../pt1/python}/torch_mlir/dynamo.py | 0 .../torch_mlir_e2e_test/CMakeLists.txt | 0 .../python}/torch_mlir_e2e_test/__init__.py | 0 .../torch_mlir_e2e_test/annotations.py | 0 .../torch_mlir_e2e_test/configs/__init__.py | 0 .../configs/lazy_tensor_core.py | 0 .../configs/linalg_on_tensors_backend.py | 0 .../configs/native_torch.py | 0 .../configs/stablehlo_backend.py | 0 .../configs/torchdynamo.py | 0 .../configs/torchscript.py | 0 .../configs/tosa_backend.py | 0 .../torch_mlir_e2e_test/configs/utils.py | 0 .../torch_mlir_e2e_test/debug/lockstep.py | 0 .../python}/torch_mlir_e2e_test/framework.py | 0 .../linalg_on_tensors_backends/__init__.py | 0 .../linalg_on_tensors_backends/abc.py | 0 .../linalg_on_tensors_backends/refbackend.py | 0 .../python}/torch_mlir_e2e_test/registry.py | 0 .../python}/torch_mlir_e2e_test/reporting.py | 0 .../stablehlo_backends/__init__.py | 0 .../stablehlo_backends/abc.py | 0 .../test_suite/__init__.py | 0 .../torch_mlir_e2e_test/test_suite/arange.py | 0 .../torch_mlir_e2e_test/test_suite/argmax.py | 0 .../test_suite/backprop.py | 0 .../torch_mlir_e2e_test/test_suite/basic.py | 0 .../torch_mlir_e2e_test/test_suite/cast.py | 0 .../test_suite/constant_alloc.py | 0 .../test_suite/control_flow.py | 0 .../torch_mlir_e2e_test/test_suite/conv.py | 0 .../test_suite/custom_op_example.py | 0 .../test_suite/elementwise.py | 0 .../test_suite/elementwise_comparison.py | 0 .../histogram_binning_calibration.py | 0 .../test_suite/index_select.py | 0 .../torch_mlir_e2e_test/test_suite/matmul.py | 0 .../torch_mlir_e2e_test/test_suite/mlp.py | 0 .../test_suite/nll_loss.py | 0 .../test_suite/norm_like.py | 0 .../torch_mlir_e2e_test/test_suite/pooling.py | 0 .../test_suite/quantized_models.py | 0 .../test_suite/reduction.py | 0 .../test_suite/reshape_like.py | 0 .../test_suite/return_types.py | 0 .../torch_mlir_e2e_test/test_suite/rng.py | 0 .../torch_mlir_e2e_test/test_suite/scalar.py | 0 .../test_suite/scalar_comparison.py | 0 .../torch_mlir_e2e_test/test_suite/scatter.py | 0 .../test_suite/slice_like.py | 0 .../torch_mlir_e2e_test/test_suite/squeeze.py | 0 .../torch_mlir_e2e_test/test_suite/stats.py | 0 .../test_suite/threshold.py | 0 .../test_suite/type_conversion.py | 0 .../test_suite/type_promotion.py | 0 .../test_suite/vision_models.py | 0 .../tosa_backends/__init__.py | 0 .../torch_mlir_e2e_test/tosa_backends/abc.py | 0 .../tosa_backends/linalg_on_tensors.py | 0 .../pt1/python}/torch_mlir_e2e_test/utils.py | 0 projects/pt1/test/CMakeLists.txt | 26 ++++++ .../pt1}/test/lit.cfg.py | 31 +++++--- projects/pt1/test/lit.site.cfg.py.in | 25 ++++++ .../test}/python/custom_op_shape_dtype_fn.py | 0 .../importer/jit_ir/get_registered_ops.py | 0 .../importer/jit_ir/ivalue_import/README.md | 0 .../ivalue_import/annotations/arg-error.py | 0 .../annotations/arg-tensor-type-bound.py | 0 .../annotations/class-annotator-repr.py | 0 .../ivalue_import/annotations/export-error.py | 0 .../annotations/export-recursive.py | 0 .../ivalue_import/annotations/export.py | 0 .../jit_ir/ivalue_import/debug-module-name.py | 0 .../importer/jit_ir/ivalue_import/dict.py | 0 .../functions-that-call-methods.py | 0 .../jit_ir/ivalue_import/functions.py | 0 .../importer/jit_ir/ivalue_import/list.py | 0 .../jit_ir/ivalue_import/methods-derefine.py | 0 .../jit_ir/ivalue_import/methods-locations.py | 0 .../importer/jit_ir/ivalue_import/methods.py | 0 .../object-identity-error-submodule.py | 0 .../ivalue_import/object-identity-error.py | 0 .../object-identity-torch-bug.py | 0 .../jit_ir/ivalue_import/object-identity.py | 0 .../importer/jit_ir/ivalue_import/prim.py | 0 .../jit_ir/ivalue_import/primitives.py | 0 .../jit_ir/ivalue_import/quantization.py | 0 .../importer/jit_ir/ivalue_import/strings.py | 0 .../jit_ir/ivalue_import/submodules-select.py | 0 .../jit_ir/ivalue_import/submodules.py | 0 .../ivalue_import/tensors-value-semantics.py | 0 .../importer/jit_ir/ivalue_import/tensors.py | 0 .../importer/jit_ir/ivalue_import/tuple.py | 0 .../python/importer/jit_ir/lit.local.cfg | 0 .../importer/jit_ir/node_import/README.md | 0 .../importer/jit_ir/node_import/classes.py | 0 .../importer/jit_ir/node_import/debug-info.py | 0 .../importer/jit_ir/node_import/dict.py | 0 .../importer/jit_ir/node_import/elif.py | 0 .../importer/jit_ir/node_import/errors.py | 0 .../function-block-arg-adjustment.py | 0 .../jit_ir/node_import/function-derefine.py | 0 .../python/importer/jit_ir/node_import/if.py | 0 .../importer/jit_ir/node_import/list.py | 0 .../importer/jit_ir/node_import/loop.py | 0 .../importer/jit_ir/node_import/prim.py | 0 .../importer/jit_ir/node_import/tuple.py | 0 .../importer/jit_ir/node_import/types-bool.py | 0 .../importer/jit_ir/node_import/types-none.py | 0 .../jit_ir/node_import/unimplemented.py | 0 .../importer/jit_ir/node_import/union.py | 0 .../importer/jit_ir/node_import/utils.py | 0 .../pt1/test}/python/lit.local.cfg | 0 .../pt1/test}/python/smoketest.py | 0 {tools => projects/pt1/tools}/e2e_test.sh | 3 +- setup.py | 3 +- test/CAPI/CMakeLists.txt | 7 -- test/CMakeLists.txt | 6 +- .../Dialect/TMTensor}/bufferize.mlir | 2 +- .../Dialect/TMTensor}/canonicalize.mlir | 2 +- .../Dialect/TMTensor}/convert_to_loops.mlir | 2 +- .../Dialect/TMTensor}/invalid.mlir | 2 +- test/RefBackend/lit.local.cfg | 2 + test/lit.site.cfg.py.in | 2 +- tools/torch-mlir-lsp-server/CMakeLists.txt | 14 ++-- .../torch-mlir-lsp-server.cpp | 5 +- tools/torch-mlir-opt/CMakeLists.txt | 8 +- tools/torch-mlir-opt/torch-mlir-opt.cpp | 23 ++++-- 316 files changed, 249 insertions(+), 372 deletions(-) delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/CMakeLists.txt delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/README.md delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/include/CMakeLists.txt delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/lib/CMakeLists.txt delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/CMakeLists.txt delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/test/CMakeLists.txt delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/test/lit.site.cfg.py.in delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/tools/CMakeLists.txt delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/CMakeLists.txt delete mode 100644 externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/torch-mlir-dialects-opt.cpp rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/CMakeLists.txt (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/CMakeLists.txt (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/CMakeLists.txt (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/CMakeLists.txt (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorBase.td (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.h (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterface.h (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/Transforms/CMakeLists.txt (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/Transforms/PassDetail.h (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/include => include}/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/CMakeLists.txt (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/IR/CMakeLists.txt (89%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/IR/TMTensorDialect.cpp (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/IR/TMTensorInterfaces.cpp (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/IR/TMTensorOps.cpp (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/Transforms/Bufferize.cpp (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/Transforms/CMakeLists.txt (88%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/Transforms/ConvertToLoops.cpp (100%) rename {externals/llvm-external-projects/torch-mlir-dialects/lib => lib}/Dialect/TMTensor/Transforms/Passes.cpp (100%) create mode 100644 projects/pt1/CMakeLists.txt rename {e2e_testing => projects/pt1/e2e_testing}/main.py (100%) rename {e2e_testing => projects/pt1/e2e_testing}/xfail_sets.py (100%) rename {examples => projects/pt1/examples}/ltc_backend_bert.py (100%) rename {examples => projects/pt1/examples}/ltc_backend_mnist.py (100%) rename {examples => projects/pt1/examples}/torchdynamo_resnet18.py (100%) rename {examples => projects/pt1/examples}/torchscript_resnet18.py (100%) rename {examples => projects/pt1/examples}/torchscript_resnet18_all_output_types.py (100%) rename {examples => projects/pt1/examples}/torchscript_resnet_inference.ipynb (100%) rename {examples => projects/pt1/examples}/torchscript_stablehlo_backend_resnet.py (100%) rename {examples => projects/pt1/examples}/torchscript_stablehlo_backend_tinybert.py (100%) rename {python => projects/pt1/python}/CMakeLists.txt (98%) rename {python => projects/pt1/python}/TorchMLIRModule.cpp (100%) rename {python => projects/pt1/python}/test/CMakeLists.txt (100%) rename {python => projects/pt1/python}/test/annotations-sugar.py (100%) rename {python => projects/pt1/python}/test/compile_api/already_scripted.py (100%) rename {python => projects/pt1/python}/test/compile_api/already_traced.py (100%) rename {python => projects/pt1/python}/test/compile_api/backend_legal_ops.py (100%) rename {python => projects/pt1/python}/test/compile_api/basic.py (100%) rename {python => projects/pt1/python}/test/compile_api/make_fx.py (100%) rename {python => projects/pt1/python}/test/compile_api/multiple_methods.py (100%) rename {python => projects/pt1/python}/test/compile_api/output_type_spec.py (100%) rename {python => projects/pt1/python}/test/compile_api/tracing.py (100%) rename {python => projects/pt1/python}/test/debug/lockstep_basic.py (100%) rename {python => projects/pt1/python}/test/dynamo_fx_importer/basic.py (100%) rename {python => projects/pt1/python}/test/lazy_backend/device_data_name.py (100%) rename {python => projects/pt1/python}/test/lazy_backend/run_test.py (100%) rename {python => projects/pt1/python}/test/lit.cfg.py (100%) rename {python => projects/pt1/python}/test/lit.site.cfg.py.in (100%) rename {python => projects/pt1/python}/test/torchscript_e2e_test/README.md (100%) rename {python => projects/pt1/python}/test/torchscript_e2e_test/basic.py (100%) rename {python => projects/pt1/python}/test/torchscript_e2e_test/compilation_failure.py (100%) rename {python => projects/pt1/python}/test/torchscript_e2e_test/error_reports.py (100%) rename {python => projects/pt1/python}/test/torchscript_e2e_test/non_tensor_values.py (100%) rename {python => projects/pt1/python}/test/torchscript_e2e_test/runtime_failure.py (100%) rename {python => projects/pt1/python}/test/torchscript_e2e_test/submodule.py (100%) rename {python => projects/pt1/python}/torch_mlir/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir/_dynamo_fx_importer.py (100%) rename {python => projects/pt1/python}/torch_mlir/_torch_mlir_custom_op_example/CMakeLists.txt (93%) rename {python => projects/pt1/python}/torch_mlir/_torch_mlir_custom_op_example/README.md (100%) rename {python => projects/pt1/python}/torch_mlir/_torch_mlir_custom_op_example/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir/_torch_mlir_custom_op_example/torch_mlir_custom_op_example.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/_version.py (100%) rename {python => projects/pt1/python}/torch_mlir/cmake/modules/TorchMLIRPyTorch.cmake (100%) rename {python => projects/pt1/python}/torch_mlir/compiler_utils.py (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/.clang-format (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt (85%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/README.md (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/backend_impl.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/backend_impl.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/dynamic_ir.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/dynamic_ir.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ir_builder.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/mlir_native_functions.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/mlir_node.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/mlir_node.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/device_data.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/device_data.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/generic.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/generic.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/index.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/index.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/ivalue.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/ivalue.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/split.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/split.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/to_copy.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/shape_inference.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/tensor.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/tensor.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/utils/debug.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/utils/exception.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/utils/string_utils.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/utils/sys_utils.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/reference_lazy_backend/CMakeLists.txt (91%) rename {python => projects/pt1/python}/torch_mlir/csrc/reference_lazy_backend/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/reference_lazy_backend/backend_impl.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/reference_lazy_backend/backend_impl.h (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/reference_lazy_backend/gen_dummy_lib.py (100%) rename {python => projects/pt1/python}/torch_mlir/csrc/reference_lazy_backend/reference_lazy_backend_pybind.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/TorchBinding.td (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt (79%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/build_tools/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/build_tools/library_generator.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/build_tools/testing_framework.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/build_tools/torch_ods_gen.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/build_tools/utils.py (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/init_python_bindings.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/mlir_utils.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.cpp (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.h (100%) rename {python => projects/pt1/python}/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py (100%) rename {python => projects/pt1/python}/torch_mlir/dynamo.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/CMakeLists.txt (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/annotations.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/lazy_tensor_core.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/linalg_on_tensors_backend.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/native_torch.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/stablehlo_backend.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/torchdynamo.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/torchscript.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/tosa_backend.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/configs/utils.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/debug/lockstep.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/framework.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/linalg_on_tensors_backends/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/linalg_on_tensors_backends/abc.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/linalg_on_tensors_backends/refbackend.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/registry.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/reporting.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/stablehlo_backends/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/stablehlo_backends/abc.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/arange.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/argmax.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/backprop.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/basic.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/cast.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/constant_alloc.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/control_flow.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/conv.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/custom_op_example.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/elementwise.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/elementwise_comparison.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/index_select.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/matmul.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/mlp.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/nll_loss.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/norm_like.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/pooling.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/quantized_models.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/reduction.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/reshape_like.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/return_types.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/rng.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/scalar.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/scalar_comparison.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/scatter.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/slice_like.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/squeeze.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/stats.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/threshold.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/type_conversion.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/type_promotion.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/test_suite/vision_models.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/tosa_backends/__init__.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/tosa_backends/abc.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/tosa_backends/linalg_on_tensors.py (100%) rename {python => projects/pt1/python}/torch_mlir_e2e_test/utils.py (100%) create mode 100644 projects/pt1/test/CMakeLists.txt rename {externals/llvm-external-projects/torch-mlir-dialects => projects/pt1}/test/lit.cfg.py (63%) create mode 100644 projects/pt1/test/lit.site.cfg.py.in rename {test => projects/pt1/test}/python/custom_op_shape_dtype_fn.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/get_registered_ops.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/README.md (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/annotations/arg-error.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/annotations/arg-tensor-type-bound.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/annotations/class-annotator-repr.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/annotations/export-error.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/annotations/export-recursive.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/annotations/export.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/debug-module-name.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/dict.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/functions-that-call-methods.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/functions.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/list.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/methods-derefine.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/methods-locations.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/methods.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/object-identity-error-submodule.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/object-identity-error.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/object-identity-torch-bug.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/object-identity.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/prim.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/primitives.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/quantization.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/strings.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/submodules-select.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/submodules.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/tensors-value-semantics.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/tensors.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/ivalue_import/tuple.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/lit.local.cfg (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/README.md (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/classes.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/debug-info.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/dict.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/elif.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/errors.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/function-block-arg-adjustment.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/function-derefine.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/if.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/list.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/loop.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/prim.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/tuple.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/types-bool.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/types-none.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/unimplemented.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/union.py (100%) rename {test => projects/pt1/test}/python/importer/jit_ir/node_import/utils.py (100%) rename {test => projects/pt1/test}/python/lit.local.cfg (100%) rename {test => projects/pt1/test}/python/smoketest.py (100%) rename {tools => projects/pt1/tools}/e2e_test.sh (80%) rename {externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor => test/Dialect/TMTensor}/bufferize.mlir (98%) rename {externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor => test/Dialect/TMTensor}/canonicalize.mlir (91%) rename {externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor => test/Dialect/TMTensor}/convert_to_loops.mlir (99%) rename {externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor => test/Dialect/TMTensor}/invalid.mlir (99%) create mode 100644 test/RefBackend/lit.local.cfg diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index aa63625b9..8e27b2d94 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -125,9 +125,8 @@ jobs: -DCMAKE_OSX_ARCHITECTURES=arm64 \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DLLVM_ENABLE_PROJECTS=mlir \ - -DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" \ + -DLLVM_EXTERNAL_PROJECTS="torch-mlir" \ -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$GITHUB_WORKSPACE" \ - -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="${GITHUB_WORKSPACE}/externals/llvm-external-projects/torch-mlir-dialects" \ -DLLVM_TARGETS_TO_BUILD=AArch64 \ -DLLVM_USE_HOST_TOOLS=ON \ -DLLVM_ENABLE_ZSTD=OFF \ diff --git a/.gitignore b/.gitignore index 676cd3653..6b76bc3ea 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ __pycache__ bazel-* # Autogenerated files -/python/torch_mlir/csrc/base_lazy_backend/generated +/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/generated #Docker builds build_oot/ diff --git a/CMakeLists.txt b/CMakeLists.txt index deeb99c20..cf33ccac1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,7 @@ +#------------------------------------------------------------------------------- +# Project setup and globals +#------------------------------------------------------------------------------- + cmake_minimum_required(VERSION 3.12) if(POLICY CMP0068) @@ -17,30 +21,30 @@ if(POLICY CMP0116) cmake_policy(SET CMP0116 OLD) endif() -#------------------------------------------------------------------------------- -# Project setup and globals -#------------------------------------------------------------------------------- - project(torch-mlir LANGUAGES CXX C) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) -macro(torch_mlir_add_llvm_external_project name identifier location) - message(STATUS "Adding LLVM external project ${name} (${identifier}) -> ${location}") - if(NOT EXISTS "${location}/CMakeLists.txt") - message(FATAL_ERROR "External project location ${location} is not valid") - endif() - list(APPEND LLVM_EXTERNAL_PROJECTS ${name}) - list(REMOVE_DUPLICATES LLVM_EXTERNAL_PROJECTS) - set(LLVM_EXTERNAL_${identifier}_SOURCE_DIR ${location} CACHE STRING "" FORCE) - set(LLVM_EXTERNAL_PROJECTS ${LLVM_EXTERNAL_PROJECTS} CACHE STRING "" FORCE) -endmacro() +#------------------------------------------------------------------------------- +# Project options +#------------------------------------------------------------------------------- + +option(TORCH_MLIR_ENABLE_REFBACKEND "Enable reference backend" ON) +if(TORCH_MLIR_ENABLE_REFBACKEND) + add_definitions(-DTORCH_MLIR_ENABLE_REFBACKEND) +endif() option(TORCH_MLIR_ENABLE_STABLEHLO "Add stablehlo dialect" ON) if(TORCH_MLIR_ENABLE_STABLEHLO) add_definitions(-DTORCH_MLIR_ENABLE_STABLEHLO) endif() +option(TORCH_MLIR_OUT_OF_TREE_BUILD "Specifies an out of tree build" OFF) + +# PT1 options. +option(TORCH_MLIR_ENABLE_PROJECT_PT1 "Enables the PyTorch1 project under projects/pt1" OFF) +# TODO: Rename/scope these. They use historic names for now to ease migration +# burden. option(TORCH_MLIR_ENABLE_JIT_IR_IMPORTER "Enables JIT IR Importer" ON) option(TORCH_MLIR_ENABLE_LTC "Enables LTC backend" OFF) option(TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS "Build Torch dialect MLIR Python bindings but neither JIT IR Importer nor LTC backend" OFF) @@ -48,21 +52,17 @@ if(TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS) set(TORCH_MLIR_ENABLE_JIT_IR_IMPORTER OFF) set(TORCH_MLIR_ENABLE_LTC OFF) endif() - -if(TORCH_MLIR_ENABLE_LTC) - set(ENV{TORCH_MLIR_ENABLE_LTC} 1) - message(STATUS "LTC Backend build is enabled") -else() - set(ENV{TORCH_MLIR_ENABLE_LTC} 0) - message(STATUS "LTC Backend build is disabled") +# Force enable the PT1 project if either the JIT_IR_IMPORTER or LTC is enabled. +if(NOT TORCH_MLIR_ENABLE_PROJECT_PT1) + if(TORCH_MLIR_ENABLE_JIT_IR_IMPORTER OR TORCH_MLIR_ENABLE_LTC) + message(STATUS "Enabling projects/pt1 because features requiring it are enabled") + set(TORCH_MLIR_ENABLE_PROJECT_PT1 ON) + endif() endif() -torch_mlir_add_llvm_external_project( - torch-mlir-dialects - TORCH_MLIR_DIALECTS - ${CMAKE_CURRENT_SOURCE_DIR}/externals/llvm-external-projects/torch-mlir-dialects) - -option(TORCH_MLIR_OUT_OF_TREE_BUILD "Specifies an out of tree build" OFF) +#------------------------------------------------------------------------------- +# Configure out-of-tree vs in-tree build +#------------------------------------------------------------------------------- if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR TORCH_MLIR_OUT_OF_TREE_BUILD) message(STATUS "Torch-MLIR out-of-tree build.") @@ -99,11 +99,10 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR TORCH_MLIR_OUT_OF_TREE_ # Don't try to compile the python extensions at the moment. We need # to import lots of dependencies from AddMLIRPython to make this work. - set(MLIR_ENABLE_BINDINGS_PYTHON 1) + set(MLIR_ENABLE_BINDINGS_PYTHON ON) - set(TORCH-MLIR_BUILT_STANDALONE 1) + set(TORCH-MLIR_BUILT_STANDALONE ON) set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}") - add_subdirectory(externals/llvm-external-projects/torch-mlir-dialects) else() message(STATUS "Torch-MLIR in-tree build.") # In-tree build with LLVM_EXTERNAL_PROJECTS=torch-mlir @@ -169,11 +168,7 @@ add_subdirectory(lib) add_subdirectory(tools) add_custom_target(check-torch-mlir-all) -add_dependencies(check-torch-mlir-all - check-torch-mlir - check-torch-mlir-dialects - check-torch-mlir-capi - ) +add_dependencies(check-torch-mlir-all check-torch-mlir) if(MLIR_ENABLE_BINDINGS_PYTHON) # If parent projects want to configure where to place the python packages, @@ -181,12 +176,6 @@ if(MLIR_ENABLE_BINDINGS_PYTHON) if(NOT TORCH_MLIR_PYTHON_PACKAGES_DIR) set(TORCH_MLIR_PYTHON_PACKAGES_DIR "${CMAKE_CURRENT_BINARY_DIR}/python_packages") endif() - add_dependencies(check-torch-mlir-all - check-torch-mlir-python - ) - add_subdirectory(python) -else() - add_custom_target(TorchMLIRPythonModules) endif() add_subdirectory(test) @@ -237,3 +226,11 @@ if (TORCH_MLIR_ENABLE_STABLEHLO) EXCLUDE_FROM_ALL) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/externals/stablehlo) endif() + +#------------------------------------------------------------------------------- +# Sub-projects +#------------------------------------------------------------------------------- + +if(TORCH_MLIR_ENABLE_PROJECT_PT1) + add_subdirectory(projects/pt1) +endif() diff --git a/build_tools/autogen_ltc_backend.py b/build_tools/autogen_ltc_backend.py index 444401580..02ac0eff0 100644 --- a/build_tools/autogen_ltc_backend.py +++ b/build_tools/autogen_ltc_backend.py @@ -29,7 +29,7 @@ if not TORCH_INCLUDE_DIR.is_dir(): TORCH_INCLUDE_DIR = TORCH_DIR TORCHGEN_DIR = Path(torchgen.__path__[0]).resolve() TORCH_MLIR_DIR = Path(__file__).resolve().parent.parent - +TORCH_MLIR_PT1_DIR = TORCH_MLIR_DIR / "projects" / "pt1" def reindent(text, prefix=""): return indent(dedent(text), prefix) @@ -114,12 +114,12 @@ class GenTorchMlirLTC: self.binary_dir = Path(binary_dir) assert self.binary_dir.is_dir(), f"Binary directory not found: {self.binary_dir}" self.source_yaml = self.binary_dir.joinpath("generated_native_functions.yaml") - self.backend_path = TORCH_MLIR_DIR.joinpath( + self.backend_path = TORCH_MLIR_PT1_DIR.joinpath( "python", "torch_mlir", "csrc", "base_lazy_backend" ) - assert self.backend_path.is_dir() + assert self.backend_path.is_dir(), f"Backend path not found: {self.backend_path}" self.generated_path = self.binary_dir.joinpath( - "python", "torch_mlir", "csrc", "base_lazy_backend", "generated" + "projects", "pt1", "python", "torch_mlir", "csrc", "base_lazy_backend", "generated" ) self.generated_path.mkdir(parents=True, exist_ok=True) diff --git a/build_tools/build_standalone.sh b/build_tools/build_standalone.sh index a6b13ffc1..02e2ec161 100755 --- a/build_tools/build_standalone.sh +++ b/build_tools/build_standalone.sh @@ -19,9 +19,8 @@ cmake -GNinja -B"$build_dir" "$llvm_project_dir/llvm" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DLLVM_ENABLE_PROJECTS=mlir \ - -DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" \ + -DLLVM_EXTERNAL_PROJECTS="torch-mlir" \ -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$project_dir" \ - -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="${project_dir}"/externals/llvm-external-projects/torch-mlir-dialects \ -DMLIR_ENABLE_BINDINGS_PYTHON=ON \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DLLVM_TARGETS_TO_BUILD=host diff --git a/build_tools/python_deploy/build_linux_packages.sh b/build_tools/python_deploy/build_linux_packages.sh index c64119d34..8b8c7b0eb 100755 --- a/build_tools/python_deploy/build_linux_packages.sh +++ b/build_tools/python_deploy/build_linux_packages.sh @@ -234,9 +234,8 @@ function build_in_tree() { -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DLLVM_ENABLE_PROJECTS=mlir \ - -DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" \ + -DLLVM_EXTERNAL_PROJECTS="torch-mlir" \ -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="/main_checkout/torch-mlir" \ - -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="/main_checkout/torch-mlir/externals/llvm-external-projects/torch-mlir-dialects" \ -DLLVM_TARGETS_TO_BUILD=host \ -DMLIR_ENABLE_BINDINGS_PYTHON=ON \ -DTORCH_MLIR_ENABLE_LTC=${enable_ltc} \ @@ -246,7 +245,7 @@ function build_in_tree() { -DTM_PYTORCH_INSTALL_WITHOUT_REBUILD=${TM_PYTORCH_INSTALL_WITHOUT_REBUILD} \ -DPython3_EXECUTABLE="$(which python3)" \ /main_checkout/torch-mlir/externals/llvm-project/llvm - cmake --build /main_checkout/torch-mlir/build + cmake --build /main_checkout/torch-mlir/build --target tools/torch-mlir/all ccache -s } @@ -288,7 +287,7 @@ function test_in_tree() { cmake --build /main_checkout/torch-mlir/build --target check-torch-mlir-all cd /main_checkout/torch-mlir/ - export PYTHONPATH="/main_checkout/torch-mlir/build/tools/torch-mlir/python_packages/torch_mlir" + export PYTHONPATH="/main_checkout/torch-mlir/build/tools/torch-mlir/python_packages/torch_mlir:/main_checkout/torch-mlir/projects/pt1" case $torch_version in nightly) diff --git a/build_tools/python_deploy/build_windows_ci.sh b/build_tools/python_deploy/build_windows_ci.sh index 2e791a1e0..c5da1adf6 100644 --- a/build_tools/python_deploy/build_windows_ci.sh +++ b/build_tools/python_deploy/build_windows_ci.sh @@ -11,9 +11,8 @@ cmake -GNinja -Bbuild \ -DLLVM_TARGETS_TO_BUILD=host \ -DMLIR_ENABLE_BINDINGS_PYTHON=ON \ -DPython3_FIND_VIRTUALENV=ONLY \ - -DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" \ + -DLLVM_EXTERNAL_PROJECTS="torch-mlir" \ -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \ - -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="$PWD/externals/llvm-external-projects/torch-mlir-dialects" \ -DPython3_EXECUTABLE="$(which python)" \ $GITHUB_WORKSPACE/externals/llvm-project/llvm diff --git a/docs/development.md b/docs/development.md index 323db4d8b..9496644af 100644 --- a/docs/development.md +++ b/docs/development.md @@ -35,9 +35,8 @@ cmake -GNinja -Bbuild \ -DCMAKE_BUILD_TYPE=Release \ -DPython3_FIND_VIRTUALENV=ONLY \ -DLLVM_ENABLE_PROJECTS=mlir \ - -DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" \ + -DLLVM_EXTERNAL_PROJECTS="torch-mlir" \ -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \ - -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="$PWD"/externals/llvm-external-projects/torch-mlir-dialects \ -DMLIR_ENABLE_BINDINGS_PYTHON=ON \ -DLLVM_TARGETS_TO_BUILD=host \ externals/llvm-project/llvm @@ -360,6 +359,7 @@ Torch-MLIR has two types of tests: Alternatively, you can run the tests via Python directly: ```shell +cd projects/pt1 python -m e2e_testing.main -f 'AtenEmbeddingBag' ``` @@ -374,7 +374,7 @@ ninja check-torch-mlir-all This can be broken down into ``` -ninja check-torch-mlir check-torch-mlir-dialects check-torch-mlir-python +ninja check-torch-mlir check-torch-mlir-python ``` To run more fine-grained tests, you can do, for `check-torch-mlir`: diff --git a/externals/llvm-external-projects/torch-mlir-dialects/CMakeLists.txt b/externals/llvm-external-projects/torch-mlir-dialects/CMakeLists.txt deleted file mode 100644 index c8f747af7..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - # The cmake configuration to build torch-mlir-dialects as - # an out-of-tree project has not been implemented. It can - # be built as part of LLVM or as a subdirectory of torch-mlir. - message(FATAL_ERROR - "This project is intended to be built as part of LLVM via " - "-DLLVM_EXTERNAL_PROJECTS=torch-mlir-dialects " - "-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}") -endif() - -option(MLIR_ENABLE_BINDINGS_PYTHON "Enables MLIR Python Bindings" OFF) - -set(TORCH_MLIR_DIALECTS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -set(TORCH_MLIR_DIALECTS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") -message(STATUS "Building torch-mlir-dialects project at ${TORCH_MLIR_DIALECTS_SOURCE_DIR} (into ${TORCH_MLIR_DIALECTS_BINARY_DIR})") - -if(MLIR_FOUND) - message(STATUS "LLVM and MLIR packages have already been configured.") -else() - message(STATUS "torch-mlir-dialect is being built in-tree") - # An in-tree build, LLVM hasn't been installed yet. - # We compute these properties manually, they're otherwise - # contributed by find_package(MLIR...) - set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir) - set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include) - set(MLIR_GENERATED_INCLUDE_DIR ${LLVM_BINARY_DIR}/tools/mlir/include) - set(MLIR_INCLUDE_DIRS ${MLIR_INCLUDE_DIR} ${MLIR_GENERATED_INCLUDE_DIR}) - set(LLVM_INCLUDE_DIRS ${LLVM_MAIN_INCLUDE_DIR}) - - # Configure CMake and tablegen. - list(APPEND CMAKE_MODULE_PATH ${MLIR_MAIN_SRC_DIR}/cmake/modules) - list(APPEND CMAKE_MODULE_PATH ${LLVM_MAIN_SRC_DIR}/cmake) - - include(TableGen) - include(AddLLVM) - include(AddMLIR) -endif() - -function(torch_mlir_dialects_target_includes target) - set(_dirs - $ - $ - $ - ) - # In LLVM parlance, the actual target may just be an interface and may not - # be responsible for actually compiling anything. The corresponding obj. - # target, when present, is just used for compilation and does not - # contribute to the interface properties. - # TODO: Normalize this upstream. - target_include_directories(${target} PUBLIC "${_dirs}") - if(TARGET obj.${target}) - target_include_directories(obj.${target} PRIVATE "${_dirs}") - endif() -endfunction() - -# TODO: Needed for tablegen. Remove. -include_directories(SYSTEM ${MLIR_INCLUDE_DIRS}) -include_directories(SYSTEM ${LLVM_INCLUDE_DIRS}) -include_directories(SYSTEM ${TORCH_MLIR_DIALECTS_SOURCE_DIR}/include) - -add_subdirectory(include) -add_subdirectory(lib) -add_subdirectory(tools) -add_subdirectory(test) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/README.md b/externals/llvm-external-projects/torch-mlir-dialects/README.md deleted file mode 100644 index 1a3caaa2c..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Torch-MLIR Dialects Project - -Sources for torch-mlir's public dialects (containing ops/types/attributes that -are unique to Torch-MLIR at the moment) - -This project is intended to be used via LLVM's external projects setup: - -* `-DLLVM_EXTERNAL_PROJECTS=torch-mlir-dialects` -* `-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR={this_directory}` - -It depends on the `mlir` project. diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/CMakeLists.txt b/externals/llvm-external-projects/torch-mlir-dialects/include/CMakeLists.txt deleted file mode 100644 index 991c1bb41..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/include/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(torch-mlir-dialects) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/CMakeLists.txt b/externals/llvm-external-projects/torch-mlir-dialects/lib/CMakeLists.txt deleted file mode 100644 index 0ca0f41c5..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/lib/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(Dialect) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/CMakeLists.txt b/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/CMakeLists.txt deleted file mode 100644 index 683a52159..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(TMTensor) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/test/CMakeLists.txt b/externals/llvm-external-projects/torch-mlir-dialects/test/CMakeLists.txt deleted file mode 100644 index 4596fabd7..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/test/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# lit needs to find the tools, and the location differs for in-tree and out-of-tree builds. -get_target_property(TORCH_MLIR_DIALECTS_TOOLS_DIR torch-mlir-dialects-opt RUNTIME_OUTPUT_DIRECTORY) -configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py - MAIN_CONFIG - ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py -) - -set(TORCH_MLIR_DIALECTS_TEST_DEPENDS - FileCheck count not - torch-mlir-dialects-opt - ) - -add_lit_testsuite(check-torch-mlir-dialects "Running the torch-mlir-dialects regression tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${TORCH_MLIR_DIALECTS_TEST_DEPENDS} - ) -set_target_properties(check-torch-mlir-dialects PROPERTIES FOLDER "Tests") - -add_lit_testsuites(TORCH_MLIR_DIALECTS ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${TORCH_MLIR_DIALECTS_TEST_DEPENDS}) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/test/lit.site.cfg.py.in b/externals/llvm-external-projects/torch-mlir-dialects/test/lit.site.cfg.py.in deleted file mode 100644 index 8f41e043f..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/test/lit.site.cfg.py.in +++ /dev/null @@ -1,27 +0,0 @@ -# -*- Python -*- -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# Also available under a BSD-style license. See LICENSE. - -@LIT_SITE_CFG_IN_HEADER@ - -import sys - -config.torch_mlir_dialects_obj_root = "@TORCH_MLIR_DIALECTS_BINARY_DIR@" -config.torch_mlir_dialects_tools_dir = "@TORCH_MLIR_DIALECTS_TOOLS_DIR@" -config.llvm_src_root = "@LLVM_SOURCE_DIR@" -config.llvm_obj_root = "@LLVM_BINARY_DIR@" -config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" -config.llvm_lib_dir = "@LLVM_LIBS_DIR@" -config.llvm_shlib_dir = "@SHLIBDIR@" -config.llvm_shlib_ext = "@SHLIBEXT@" -config.llvm_exe_ext = "@EXEEXT@" -config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" -config.python_executable = sys.executable - -import lit.llvm -lit.llvm.initialize(lit_config, config) - -# Let the main config do the real work. -lit_config.load_config(config, "@TORCH_MLIR_DIALECTS_SOURCE_DIR@/test/lit.cfg.py") diff --git a/externals/llvm-external-projects/torch-mlir-dialects/tools/CMakeLists.txt b/externals/llvm-external-projects/torch-mlir-dialects/tools/CMakeLists.txt deleted file mode 100644 index db400ab20..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/tools/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(torch-mlir-dialects-opt) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/CMakeLists.txt b/externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/CMakeLists.txt deleted file mode 100644 index 102d60bce..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(LIBS - MLIRArithDialect - MLIRDialect - MLIRLinalgDialect - MLIRMemRefDialect - MLIROptLib - MLIRSCFDialect - MLIRSCFTransforms - MLIRFuncDialect - MLIRTensorDialect - MLIRTransforms - TorchMLIRTMTensorDialect - TorchMLIRTMTensorPasses -) - -add_llvm_tool(torch-mlir-dialects-opt - torch-mlir-dialects-opt.cpp - - DEPENDS - ${LIBS} -) -target_link_libraries(torch-mlir-dialects-opt PRIVATE ${LIBS}) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/torch-mlir-dialects-opt.cpp b/externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/torch-mlir-dialects-opt.cpp deleted file mode 100644 index 058dfc82d..000000000 --- a/externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/torch-mlir-dialects-opt.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===------------------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// Also available under a BSD-style license. See LICENSE. -// -//===----------------------------------------------------------------------===// - -#include "mlir/Dialect/Arith/IR/Arith.h" -#include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Linalg/IR/Linalg.h" -#include "mlir/Dialect/MemRef/IR/MemRef.h" -#include "mlir/Dialect/SCF/IR/SCF.h" -#include "mlir/Dialect/SCF/Transforms/Passes.h" -#include "mlir/Dialect/Tensor/IR/Tensor.h" -#include "mlir/IR/AsmState.h" -#include "mlir/IR/Dialect.h" -#include "mlir/Tools/mlir-opt/MlirOptMain.h" -#include "mlir/Transforms/Passes.h" -#include "torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h" -#include "torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h" -#include "torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h" - -using namespace mlir; - -int main(int argc, char **argv) { - registerAsmPrinterCLOptions(); - registerMLIRContextCLOptions(); - - registerTransformsPasses(); - registerSCFPasses(); - - // Local dialects. - mlir::torch::TMTensor::registerPasses(); - - DialectRegistry registry; - registry.insert< - // Local dialects - mlir::torch::TMTensor::TMTensorDialect, - // Upstream dialects - mlir::arith::ArithDialect, mlir::linalg::LinalgDialect, - mlir::func::FuncDialect, mlir::memref::MemRefDialect, - mlir::scf::SCFDialect, mlir::tensor::TensorDialect>(); - - return mlir::asMainReturnCode(mlir::MlirOptMain( - argc, argv, "MLIR modular optimizer driver\n", registry)); -} diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 31414822e..cba1f75a1 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory(torch-mlir) +add_subdirectory(torch-mlir-dialects) \ No newline at end of file diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/CMakeLists.txt b/include/torch-mlir-dialects/CMakeLists.txt similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/CMakeLists.txt rename to include/torch-mlir-dialects/CMakeLists.txt diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/CMakeLists.txt b/include/torch-mlir-dialects/Dialect/CMakeLists.txt similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/CMakeLists.txt rename to include/torch-mlir-dialects/Dialect/CMakeLists.txt diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/CMakeLists.txt b/include/torch-mlir-dialects/Dialect/TMTensor/CMakeLists.txt similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/CMakeLists.txt rename to include/torch-mlir-dialects/Dialect/TMTensor/CMakeLists.txt diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/CMakeLists.txt b/include/torch-mlir-dialects/Dialect/TMTensor/IR/CMakeLists.txt similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/CMakeLists.txt rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/CMakeLists.txt diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h b/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td b/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorBase.td b/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorBase.td similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorBase.td rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorBase.td diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h b/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.h b/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.h similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.h rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.h diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td b/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterface.h b/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterface.h similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterface.h rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterface.h diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h b/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td b/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td rename to include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/CMakeLists.txt b/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/CMakeLists.txt similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/CMakeLists.txt rename to include/torch-mlir-dialects/Dialect/TMTensor/Transforms/CMakeLists.txt diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/PassDetail.h b/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/PassDetail.h similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/PassDetail.h rename to include/torch-mlir-dialects/Dialect/TMTensor/Transforms/PassDetail.h diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h b/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h rename to include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h diff --git a/externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td b/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td rename to include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td diff --git a/include/torch-mlir/InitAll.h b/include/torch-mlir/InitAll.h index ecced42cd..42eb3c6a1 100644 --- a/include/torch-mlir/InitAll.h +++ b/include/torch-mlir/InitAll.h @@ -15,7 +15,13 @@ namespace mlir { namespace torch { +// Registers all dialects that this project produces and any dependencies. void registerAllDialects(mlir::DialectRegistry ®istry); + +// Registers dialects that may be needed to parse torch-mlir inputs and +// test cases. +void registerOptionalInputDialects(mlir::DialectRegistry ®istry); + void registerAllPasses(); } // namespace torch diff --git a/lib/CAPI/CMakeLists.txt b/lib/CAPI/CMakeLists.txt index d71796ae8..927fb7d3c 100644 --- a/lib/CAPI/CMakeLists.txt +++ b/lib/CAPI/CMakeLists.txt @@ -9,8 +9,6 @@ add_mlir_public_c_api_library(TorchMLIRCAPI ${PROJECT_SOURCE_DIR}/include/torch-mlir-c/ ENABLE_AGGREGATION - LINK_COMPONENTS - Core LINK_LIBS PUBLIC MLIRIR diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 03123d2ed..8956066b8 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,14 +1,18 @@ add_subdirectory(CAPI) add_subdirectory(Conversion) add_subdirectory(Dialect) -add_subdirectory(RefBackend) -get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS) set(LinkedLibs + MLIRComplexDialect MLIRFuncDialect + MLIRFuncInlinerExtension MLIRIR + MLIRMLProgramDialect + MLIRMemRefDialect + MLIRSCFDialect + MLIRTensorDialect + MLIRTosaDialect MLIRSupport - ${extension_libs} TorchMLIRTorchPasses TorchMLIRTorchConversionDialect @@ -20,15 +24,16 @@ set(LinkedLibs TorchMLIRTMTensorDialect TorchMLIRConversionPasses - TorchMLIRRefBackend ) +if(TORCH_MLIR_ENABLE_REFBACKEND) + add_subdirectory(RefBackend) + list(APPEND LinkedLibs TorchMLIRRefBackend) +endif() + add_mlir_library(TorchMLIRInitAll InitAll.cpp - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC ${LinkedLibs} ) diff --git a/lib/Conversion/CMakeLists.txt b/lib/Conversion/CMakeLists.txt index d72563b1e..f26b4d6e8 100644 --- a/lib/Conversion/CMakeLists.txt +++ b/lib/Conversion/CMakeLists.txt @@ -27,10 +27,6 @@ add_mlir_library(TorchMLIRConversionPasses DEPENDS TorchMLIRConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC ${linked_libs} - #${torch_mlir_conversion_libs} ) diff --git a/lib/Conversion/TorchConversionToMLProgram/CMakeLists.txt b/lib/Conversion/TorchConversionToMLProgram/CMakeLists.txt index b89ffbb43..3546861ce 100644 --- a/lib/Conversion/TorchConversionToMLProgram/CMakeLists.txt +++ b/lib/Conversion/TorchConversionToMLProgram/CMakeLists.txt @@ -7,9 +7,6 @@ add_mlir_conversion_library(TorchMLIRTorchConversionToMLProgram DEPENDS TorchMLIRConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRLinalgDialect diff --git a/lib/Conversion/TorchToArith/CMakeLists.txt b/lib/Conversion/TorchToArith/CMakeLists.txt index 4524c3b07..b345f3c96 100644 --- a/lib/Conversion/TorchToArith/CMakeLists.txt +++ b/lib/Conversion/TorchToArith/CMakeLists.txt @@ -7,9 +7,6 @@ add_mlir_conversion_library(TorchMLIRTorchToArith DEPENDS TorchMLIRConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRPass diff --git a/lib/Conversion/TorchToLinalg/CMakeLists.txt b/lib/Conversion/TorchToLinalg/CMakeLists.txt index ece929597..fbf66556e 100644 --- a/lib/Conversion/TorchToLinalg/CMakeLists.txt +++ b/lib/Conversion/TorchToLinalg/CMakeLists.txt @@ -17,9 +17,6 @@ add_mlir_conversion_library(TorchMLIRTorchToLinalg DEPENDS TorchMLIRConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRPass diff --git a/lib/Conversion/TorchToSCF/CMakeLists.txt b/lib/Conversion/TorchToSCF/CMakeLists.txt index 06a888b3e..7a6d21cd6 100644 --- a/lib/Conversion/TorchToSCF/CMakeLists.txt +++ b/lib/Conversion/TorchToSCF/CMakeLists.txt @@ -7,9 +7,6 @@ add_mlir_conversion_library(TorchMLIRTorchToSCF DEPENDS TorchMLIRConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRPass diff --git a/lib/Conversion/TorchToStablehlo/CMakeLists.txt b/lib/Conversion/TorchToStablehlo/CMakeLists.txt index 0f9b8faba..07ef1e2ea 100644 --- a/lib/Conversion/TorchToStablehlo/CMakeLists.txt +++ b/lib/Conversion/TorchToStablehlo/CMakeLists.txt @@ -14,9 +14,6 @@ add_mlir_conversion_library(TorchMLIRTorchToStablehlo DEPENDS TorchMLIRConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRPass diff --git a/lib/Conversion/TorchToTMTensor/CMakeLists.txt b/lib/Conversion/TorchToTMTensor/CMakeLists.txt index d05d8277c..3f0cf9de9 100644 --- a/lib/Conversion/TorchToTMTensor/CMakeLists.txt +++ b/lib/Conversion/TorchToTMTensor/CMakeLists.txt @@ -7,9 +7,6 @@ TorchToTMTensor.cpp DEPENDS TorchMLIRConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRPass diff --git a/lib/Conversion/TorchToTosa/CMakeLists.txt b/lib/Conversion/TorchToTosa/CMakeLists.txt index 909ee3bcb..24f349902 100644 --- a/lib/Conversion/TorchToTosa/CMakeLists.txt +++ b/lib/Conversion/TorchToTosa/CMakeLists.txt @@ -9,9 +9,6 @@ add_mlir_conversion_library(TorchMLIRTorchToTosa DEPENDS TorchMLIRConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRPass diff --git a/lib/Dialect/CMakeLists.txt b/lib/Dialect/CMakeLists.txt index 2e7a62207..724be45e7 100644 --- a/lib/Dialect/CMakeLists.txt +++ b/lib/Dialect/CMakeLists.txt @@ -1,2 +1,3 @@ +add_subdirectory(TMTensor) add_subdirectory(Torch) add_subdirectory(TorchConversion) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/CMakeLists.txt b/lib/Dialect/TMTensor/CMakeLists.txt similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/CMakeLists.txt rename to lib/Dialect/TMTensor/CMakeLists.txt diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/CMakeLists.txt b/lib/Dialect/TMTensor/IR/CMakeLists.txt similarity index 89% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/CMakeLists.txt rename to lib/Dialect/TMTensor/IR/CMakeLists.txt index 682769c47..867d17219 100644 --- a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/CMakeLists.txt +++ b/lib/Dialect/TMTensor/IR/CMakeLists.txt @@ -26,4 +26,4 @@ add_mlir_library(TorchMLIRTMTensorDialect MLIRViewLikeInterface ) -torch_mlir_dialects_target_includes(TorchMLIRTMTensorDialect) +torch_mlir_target_includes(TorchMLIRTMTensorDialect) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp b/lib/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp rename to lib/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorDialect.cpp b/lib/Dialect/TMTensor/IR/TMTensorDialect.cpp similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorDialect.cpp rename to lib/Dialect/TMTensor/IR/TMTensorDialect.cpp diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorInterfaces.cpp b/lib/Dialect/TMTensor/IR/TMTensorInterfaces.cpp similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorInterfaces.cpp rename to lib/Dialect/TMTensor/IR/TMTensorInterfaces.cpp diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorOps.cpp b/lib/Dialect/TMTensor/IR/TMTensorOps.cpp similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorOps.cpp rename to lib/Dialect/TMTensor/IR/TMTensorOps.cpp diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/Bufferize.cpp b/lib/Dialect/TMTensor/Transforms/Bufferize.cpp similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/Bufferize.cpp rename to lib/Dialect/TMTensor/Transforms/Bufferize.cpp diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/CMakeLists.txt b/lib/Dialect/TMTensor/Transforms/CMakeLists.txt similarity index 88% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/CMakeLists.txt rename to lib/Dialect/TMTensor/Transforms/CMakeLists.txt index 848b416a8..0ae893421 100644 --- a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/CMakeLists.txt +++ b/lib/Dialect/TMTensor/Transforms/CMakeLists.txt @@ -21,3 +21,5 @@ add_mlir_library(TorchMLIRTMTensorPasses MLIRTensorDialect MLIRTransforms ) + +torch_mlir_target_includes(TorchMLIRTMTensorPasses) \ No newline at end of file diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/ConvertToLoops.cpp b/lib/Dialect/TMTensor/Transforms/ConvertToLoops.cpp similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/ConvertToLoops.cpp rename to lib/Dialect/TMTensor/Transforms/ConvertToLoops.cpp diff --git a/externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/Passes.cpp b/lib/Dialect/TMTensor/Transforms/Passes.cpp similarity index 100% rename from externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/Passes.cpp rename to lib/Dialect/TMTensor/Transforms/Passes.cpp diff --git a/lib/Dialect/Torch/IR/CMakeLists.txt b/lib/Dialect/Torch/IR/CMakeLists.txt index 00210e4fd..58b7cdd0b 100644 --- a/lib/Dialect/Torch/IR/CMakeLists.txt +++ b/lib/Dialect/Torch/IR/CMakeLists.txt @@ -12,9 +12,6 @@ add_mlir_library(TorchMLIRTorchDialect MLIRTorchOpsIncGen MLIRTorchTypesIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRBytecodeOpInterface MLIRBytecodeReader diff --git a/lib/Dialect/Torch/Transforms/CMakeLists.txt b/lib/Dialect/Torch/Transforms/CMakeLists.txt index 9c8bcda94..0f7621ff0 100644 --- a/lib/Dialect/Torch/Transforms/CMakeLists.txt +++ b/lib/Dialect/Torch/Transforms/CMakeLists.txt @@ -26,9 +26,6 @@ add_mlir_library(TorchMLIRTorchPasses DEPENDS TorchMLIRTorchPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRPass diff --git a/lib/Dialect/TorchConversion/IR/CMakeLists.txt b/lib/Dialect/TorchConversion/IR/CMakeLists.txt index 38f6f3268..cfe7006f7 100644 --- a/lib/Dialect/TorchConversion/IR/CMakeLists.txt +++ b/lib/Dialect/TorchConversion/IR/CMakeLists.txt @@ -9,9 +9,6 @@ add_mlir_dialect_library(TorchMLIRTorchConversionDialect MLIRTorchConversionOpsIncGen MLIRTorchTypesIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC MLIRIR MLIRSupport diff --git a/lib/Dialect/TorchConversion/Transforms/CMakeLists.txt b/lib/Dialect/TorchConversion/Transforms/CMakeLists.txt index a286d5bbd..5858e29a4 100644 --- a/lib/Dialect/TorchConversion/Transforms/CMakeLists.txt +++ b/lib/Dialect/TorchConversion/Transforms/CMakeLists.txt @@ -39,9 +39,6 @@ add_mlir_library(TorchMLIRTorchConversionPasses DEPENDS TorchMLIRTorchConversionPassIncGen - LINK_COMPONENTS - Core - LINK_LIBS PUBLIC ${LinkedLibs} ) diff --git a/lib/InitAll.cpp b/lib/InitAll.cpp index 1d67bdfe2..0be0ec8ba 100644 --- a/lib/InitAll.cpp +++ b/lib/InitAll.cpp @@ -9,8 +9,15 @@ #include "torch-mlir/InitAll.h" +#include "mlir/Dialect/Complex/IR/Complex.h" #include "mlir/Dialect/Func/Extensions/InlinerExtension.h" #include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/Linalg/IR/Linalg.h" +#include "mlir/Dialect/MLProgram/IR/MLProgram.h" +#include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Dialect/Tensor/IR/Tensor.h" +#include "mlir/Dialect/Tosa/IR/TosaOps.h" #include "mlir/IR/Dialect.h" #include "torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h" #include "torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h" @@ -29,11 +36,22 @@ void mlir::torch::registerAllDialects(mlir::DialectRegistry ®istry) { mlir::func::registerInlinerExtension(registry); } +// TODO: Break this up when backends are separated. +void mlir::torch::registerOptionalInputDialects( + mlir::DialectRegistry ®istry) { + registry.insert(); +} + void mlir::torch::registerAllPasses() { mlir::torch::registerTorchPasses(); mlir::torch::registerTorchConversionPasses(); mlir::torch::registerConversionPasses(); - mlir::torch::RefBackend::registerRefBackendPasses(); mlir::torch::TMTensor::registerPasses(); + +#ifdef TORCH_MLIR_ENABLE_REFBACKEND + mlir::torch::RefBackend::registerRefBackendPasses(); +#endif } diff --git a/projects/pt1/CMakeLists.txt b/projects/pt1/CMakeLists.txt new file mode 100644 index 000000000..160197b21 --- /dev/null +++ b/projects/pt1/CMakeLists.txt @@ -0,0 +1,27 @@ +message(STATUS "Building PyTorch1 compatibility project") + +if(TORCH_MLIR_ENABLE_LTC) + set(ENV{TORCH_MLIR_ENABLE_LTC} 1) + message(STATUS "LTC Backend build is enabled") +else() + set(ENV{TORCH_MLIR_ENABLE_LTC} 0) + message(STATUS "LTC Backend build is disabled") +endif() + + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/python/torch_mlir/cmake/modules") + +################################################################################ +# Setup python. +################################################################################ + +if(MLIR_ENABLE_BINDINGS_PYTHON) + add_dependencies(check-torch-mlir-all + check-torch-mlir-pt1 + ) + add_subdirectory(python) +else() + add_custom_target(TorchMLIRPythonModules) +endif() + +add_subdirectory(test) diff --git a/e2e_testing/main.py b/projects/pt1/e2e_testing/main.py similarity index 100% rename from e2e_testing/main.py rename to projects/pt1/e2e_testing/main.py diff --git a/e2e_testing/xfail_sets.py b/projects/pt1/e2e_testing/xfail_sets.py similarity index 100% rename from e2e_testing/xfail_sets.py rename to projects/pt1/e2e_testing/xfail_sets.py diff --git a/examples/ltc_backend_bert.py b/projects/pt1/examples/ltc_backend_bert.py similarity index 100% rename from examples/ltc_backend_bert.py rename to projects/pt1/examples/ltc_backend_bert.py diff --git a/examples/ltc_backend_mnist.py b/projects/pt1/examples/ltc_backend_mnist.py similarity index 100% rename from examples/ltc_backend_mnist.py rename to projects/pt1/examples/ltc_backend_mnist.py diff --git a/examples/torchdynamo_resnet18.py b/projects/pt1/examples/torchdynamo_resnet18.py similarity index 100% rename from examples/torchdynamo_resnet18.py rename to projects/pt1/examples/torchdynamo_resnet18.py diff --git a/examples/torchscript_resnet18.py b/projects/pt1/examples/torchscript_resnet18.py similarity index 100% rename from examples/torchscript_resnet18.py rename to projects/pt1/examples/torchscript_resnet18.py diff --git a/examples/torchscript_resnet18_all_output_types.py b/projects/pt1/examples/torchscript_resnet18_all_output_types.py similarity index 100% rename from examples/torchscript_resnet18_all_output_types.py rename to projects/pt1/examples/torchscript_resnet18_all_output_types.py diff --git a/examples/torchscript_resnet_inference.ipynb b/projects/pt1/examples/torchscript_resnet_inference.ipynb similarity index 100% rename from examples/torchscript_resnet_inference.ipynb rename to projects/pt1/examples/torchscript_resnet_inference.ipynb diff --git a/examples/torchscript_stablehlo_backend_resnet.py b/projects/pt1/examples/torchscript_stablehlo_backend_resnet.py similarity index 100% rename from examples/torchscript_stablehlo_backend_resnet.py rename to projects/pt1/examples/torchscript_stablehlo_backend_resnet.py diff --git a/examples/torchscript_stablehlo_backend_tinybert.py b/projects/pt1/examples/torchscript_stablehlo_backend_tinybert.py similarity index 100% rename from examples/torchscript_stablehlo_backend_tinybert.py rename to projects/pt1/examples/torchscript_stablehlo_backend_tinybert.py diff --git a/python/CMakeLists.txt b/projects/pt1/python/CMakeLists.txt similarity index 98% rename from python/CMakeLists.txt rename to projects/pt1/python/CMakeLists.txt index 157b5f912..dd2864013 100644 --- a/python/CMakeLists.txt +++ b/projects/pt1/python/CMakeLists.txt @@ -29,7 +29,7 @@ if (NOT TORCH_MLIR_USE_INSTALLED_PYTORCH) set(ENV{CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER_LAUNCHER}) set(ENV{CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER_LAUNCHER}) execute_process( - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../build_tools/build_libtorch.sh + COMMAND ${TORCH_MLIR_SOURCE_DIR}/build_tools/build_libtorch.sh RESULT_VARIABLE _result ) if(_result) diff --git a/python/TorchMLIRModule.cpp b/projects/pt1/python/TorchMLIRModule.cpp similarity index 100% rename from python/TorchMLIRModule.cpp rename to projects/pt1/python/TorchMLIRModule.cpp diff --git a/python/test/CMakeLists.txt b/projects/pt1/python/test/CMakeLists.txt similarity index 100% rename from python/test/CMakeLists.txt rename to projects/pt1/python/test/CMakeLists.txt diff --git a/python/test/annotations-sugar.py b/projects/pt1/python/test/annotations-sugar.py similarity index 100% rename from python/test/annotations-sugar.py rename to projects/pt1/python/test/annotations-sugar.py diff --git a/python/test/compile_api/already_scripted.py b/projects/pt1/python/test/compile_api/already_scripted.py similarity index 100% rename from python/test/compile_api/already_scripted.py rename to projects/pt1/python/test/compile_api/already_scripted.py diff --git a/python/test/compile_api/already_traced.py b/projects/pt1/python/test/compile_api/already_traced.py similarity index 100% rename from python/test/compile_api/already_traced.py rename to projects/pt1/python/test/compile_api/already_traced.py diff --git a/python/test/compile_api/backend_legal_ops.py b/projects/pt1/python/test/compile_api/backend_legal_ops.py similarity index 100% rename from python/test/compile_api/backend_legal_ops.py rename to projects/pt1/python/test/compile_api/backend_legal_ops.py diff --git a/python/test/compile_api/basic.py b/projects/pt1/python/test/compile_api/basic.py similarity index 100% rename from python/test/compile_api/basic.py rename to projects/pt1/python/test/compile_api/basic.py diff --git a/python/test/compile_api/make_fx.py b/projects/pt1/python/test/compile_api/make_fx.py similarity index 100% rename from python/test/compile_api/make_fx.py rename to projects/pt1/python/test/compile_api/make_fx.py diff --git a/python/test/compile_api/multiple_methods.py b/projects/pt1/python/test/compile_api/multiple_methods.py similarity index 100% rename from python/test/compile_api/multiple_methods.py rename to projects/pt1/python/test/compile_api/multiple_methods.py diff --git a/python/test/compile_api/output_type_spec.py b/projects/pt1/python/test/compile_api/output_type_spec.py similarity index 100% rename from python/test/compile_api/output_type_spec.py rename to projects/pt1/python/test/compile_api/output_type_spec.py diff --git a/python/test/compile_api/tracing.py b/projects/pt1/python/test/compile_api/tracing.py similarity index 100% rename from python/test/compile_api/tracing.py rename to projects/pt1/python/test/compile_api/tracing.py diff --git a/python/test/debug/lockstep_basic.py b/projects/pt1/python/test/debug/lockstep_basic.py similarity index 100% rename from python/test/debug/lockstep_basic.py rename to projects/pt1/python/test/debug/lockstep_basic.py diff --git a/python/test/dynamo_fx_importer/basic.py b/projects/pt1/python/test/dynamo_fx_importer/basic.py similarity index 100% rename from python/test/dynamo_fx_importer/basic.py rename to projects/pt1/python/test/dynamo_fx_importer/basic.py diff --git a/python/test/lazy_backend/device_data_name.py b/projects/pt1/python/test/lazy_backend/device_data_name.py similarity index 100% rename from python/test/lazy_backend/device_data_name.py rename to projects/pt1/python/test/lazy_backend/device_data_name.py diff --git a/python/test/lazy_backend/run_test.py b/projects/pt1/python/test/lazy_backend/run_test.py similarity index 100% rename from python/test/lazy_backend/run_test.py rename to projects/pt1/python/test/lazy_backend/run_test.py diff --git a/python/test/lit.cfg.py b/projects/pt1/python/test/lit.cfg.py similarity index 100% rename from python/test/lit.cfg.py rename to projects/pt1/python/test/lit.cfg.py diff --git a/python/test/lit.site.cfg.py.in b/projects/pt1/python/test/lit.site.cfg.py.in similarity index 100% rename from python/test/lit.site.cfg.py.in rename to projects/pt1/python/test/lit.site.cfg.py.in diff --git a/python/test/torchscript_e2e_test/README.md b/projects/pt1/python/test/torchscript_e2e_test/README.md similarity index 100% rename from python/test/torchscript_e2e_test/README.md rename to projects/pt1/python/test/torchscript_e2e_test/README.md diff --git a/python/test/torchscript_e2e_test/basic.py b/projects/pt1/python/test/torchscript_e2e_test/basic.py similarity index 100% rename from python/test/torchscript_e2e_test/basic.py rename to projects/pt1/python/test/torchscript_e2e_test/basic.py diff --git a/python/test/torchscript_e2e_test/compilation_failure.py b/projects/pt1/python/test/torchscript_e2e_test/compilation_failure.py similarity index 100% rename from python/test/torchscript_e2e_test/compilation_failure.py rename to projects/pt1/python/test/torchscript_e2e_test/compilation_failure.py diff --git a/python/test/torchscript_e2e_test/error_reports.py b/projects/pt1/python/test/torchscript_e2e_test/error_reports.py similarity index 100% rename from python/test/torchscript_e2e_test/error_reports.py rename to projects/pt1/python/test/torchscript_e2e_test/error_reports.py diff --git a/python/test/torchscript_e2e_test/non_tensor_values.py b/projects/pt1/python/test/torchscript_e2e_test/non_tensor_values.py similarity index 100% rename from python/test/torchscript_e2e_test/non_tensor_values.py rename to projects/pt1/python/test/torchscript_e2e_test/non_tensor_values.py diff --git a/python/test/torchscript_e2e_test/runtime_failure.py b/projects/pt1/python/test/torchscript_e2e_test/runtime_failure.py similarity index 100% rename from python/test/torchscript_e2e_test/runtime_failure.py rename to projects/pt1/python/test/torchscript_e2e_test/runtime_failure.py diff --git a/python/test/torchscript_e2e_test/submodule.py b/projects/pt1/python/test/torchscript_e2e_test/submodule.py similarity index 100% rename from python/test/torchscript_e2e_test/submodule.py rename to projects/pt1/python/test/torchscript_e2e_test/submodule.py diff --git a/python/torch_mlir/__init__.py b/projects/pt1/python/torch_mlir/__init__.py similarity index 100% rename from python/torch_mlir/__init__.py rename to projects/pt1/python/torch_mlir/__init__.py diff --git a/python/torch_mlir/_dynamo_fx_importer.py b/projects/pt1/python/torch_mlir/_dynamo_fx_importer.py similarity index 100% rename from python/torch_mlir/_dynamo_fx_importer.py rename to projects/pt1/python/torch_mlir/_dynamo_fx_importer.py diff --git a/python/torch_mlir/_torch_mlir_custom_op_example/CMakeLists.txt b/projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/CMakeLists.txt similarity index 93% rename from python/torch_mlir/_torch_mlir_custom_op_example/CMakeLists.txt rename to projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/CMakeLists.txt index a5a011b55..383f9b66b 100644 --- a/python/torch_mlir/_torch_mlir_custom_op_example/CMakeLists.txt +++ b/projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/CMakeLists.txt @@ -1,5 +1,4 @@ # Setup PyTorch -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules") include(TorchMLIRPyTorch) TorchMLIRProbeForPyTorchInstall() find_package(Torch 1.8 REQUIRED) diff --git a/python/torch_mlir/_torch_mlir_custom_op_example/README.md b/projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/README.md similarity index 100% rename from python/torch_mlir/_torch_mlir_custom_op_example/README.md rename to projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/README.md diff --git a/python/torch_mlir/_torch_mlir_custom_op_example/__init__.py b/projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/__init__.py similarity index 100% rename from python/torch_mlir/_torch_mlir_custom_op_example/__init__.py rename to projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/__init__.py diff --git a/python/torch_mlir/_torch_mlir_custom_op_example/torch_mlir_custom_op_example.cpp b/projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/torch_mlir_custom_op_example.cpp similarity index 100% rename from python/torch_mlir/_torch_mlir_custom_op_example/torch_mlir_custom_op_example.cpp rename to projects/pt1/python/torch_mlir/_torch_mlir_custom_op_example/torch_mlir_custom_op_example.cpp diff --git a/python/torch_mlir/_version.py b/projects/pt1/python/torch_mlir/_version.py similarity index 100% rename from python/torch_mlir/_version.py rename to projects/pt1/python/torch_mlir/_version.py diff --git a/python/torch_mlir/cmake/modules/TorchMLIRPyTorch.cmake b/projects/pt1/python/torch_mlir/cmake/modules/TorchMLIRPyTorch.cmake similarity index 100% rename from python/torch_mlir/cmake/modules/TorchMLIRPyTorch.cmake rename to projects/pt1/python/torch_mlir/cmake/modules/TorchMLIRPyTorch.cmake diff --git a/python/torch_mlir/compiler_utils.py b/projects/pt1/python/torch_mlir/compiler_utils.py similarity index 100% rename from python/torch_mlir/compiler_utils.py rename to projects/pt1/python/torch_mlir/compiler_utils.py diff --git a/python/torch_mlir/csrc/.clang-format b/projects/pt1/python/torch_mlir/csrc/.clang-format similarity index 100% rename from python/torch_mlir/csrc/.clang-format rename to projects/pt1/python/torch_mlir/csrc/.clang-format diff --git a/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt similarity index 85% rename from python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt index 81a838394..2087f99eb 100644 --- a/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt +++ b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt @@ -2,15 +2,15 @@ # Setup PyTorch/LTC #------------------------------------------------------------------------------- - -list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/python/torch_mlir/cmake/modules") include(TorchMLIRPyTorch) TorchMLIRProbeForPyTorchInstall() if(TORCH_MLIR_USE_INSTALLED_PYTORCH) TorchMLIRConfigurePyTorch() else() - set(Torch_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../libtorch/share/cmake/Torch") + # Assume it is a sibling to the overall project. + set(Torch_DIR "${PROJECT_SOURCE_DIR}/../libtorch/share/cmake/Torch") + message(STATUS "Attempting to locate libtorch as a sibling to the project: ${Torch_DIR}") endif() find_package(Torch 1.11 REQUIRED) @@ -22,7 +22,7 @@ include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${Python3_INCLUDE_DIRS} - ${PROJECT_SOURCE_DIR}/python + ${PROJECT_SOURCE_DIR}/projects/pt1/python ) link_directories("${TORCH_INSTALL_PREFIX}/lib") @@ -112,13 +112,13 @@ add_custom_command( add_custom_command( TARGET torch_mlir_ltc_backend POST_BUILD COMMAND cp - ${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/*.h + ${PROJECT_SOURCE_DIR}/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/*.h ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/) add_custom_command( TARGET torch_mlir_ltc_backend POST_BUILD COMMAND cp - ${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/generated/*.h + ${PROJECT_SOURCE_DIR}/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/generated/*.h ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/generated/) add_custom_command( @@ -129,7 +129,7 @@ add_custom_command( add_custom_command( TARGET torch_mlir_ltc_backend POST_BUILD COMMAND cp - ${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/ops/*.h + ${PROJECT_SOURCE_DIR}/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/*.h ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/ops/) add_custom_command( @@ -140,5 +140,5 @@ add_custom_command( add_custom_command( TARGET torch_mlir_ltc_backend POST_BUILD COMMAND cp - ${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/utils/*.h + ${PROJECT_SOURCE_DIR}/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/*.h ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/utils/) diff --git a/python/torch_mlir/csrc/base_lazy_backend/README.md b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/README.md similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/README.md rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/README.md diff --git a/python/torch_mlir/csrc/base_lazy_backend/backend_impl.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/backend_impl.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/backend_impl.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/backend_impl.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/backend_impl.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/backend_impl.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/backend_impl.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/backend_impl.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/dynamic_ir.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/dynamic_ir.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/dynamic_ir.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/dynamic_ir.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/dynamic_ir.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/dynamic_ir.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/dynamic_ir.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/dynamic_ir.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/ir_builder.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ir_builder.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ir_builder.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ir_builder.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_lowering_context.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/mlir_native_functions.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_native_functions.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/mlir_native_functions.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_native_functions.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/mlir_node.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_node.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/mlir_node.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_node.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/mlir_node.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_node.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/mlir_node.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_node.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/mlir_node_lowering.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/device_data.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/device_data.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/device_data.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/device_data.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/device_data.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/device_data.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/device_data.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/device_data.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/generic.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/generic.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/generic.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/generic.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/generic.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/generic.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/generic.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/generic.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/index.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/index.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/index.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/index.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/index.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/index.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/index.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/index.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/ivalue.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/ivalue.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/ivalue.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/ivalue.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/ivalue.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/ivalue.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/ivalue.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/ivalue.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/split.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/split.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/split.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/split.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/split.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/split.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/split.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/split.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/to_copy.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/to_copy.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/to_copy.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/to_copy.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/unbind_int.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/shape_inference.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/shape_inference.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/shape_inference.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/shape_inference.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/tensor.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/tensor.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/tensor.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/tensor.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/tensor.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/tensor.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/tensor.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/tensor.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/utils/debug.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/debug.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/utils/debug.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/debug.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/utils/exception.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/exception.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/utils/exception.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/exception.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/jit_utils.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/utils/string_utils.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/string_utils.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/utils/string_utils.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/string_utils.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/utils/sys_utils.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/sys_utils.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/utils/sys_utils.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/sys_utils.h diff --git a/python/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.cpp b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.cpp similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.cpp rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.cpp diff --git a/python/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.h b/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.h similarity index 100% rename from python/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.h rename to projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/tensor_utils.h diff --git a/python/torch_mlir/csrc/reference_lazy_backend/CMakeLists.txt b/projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/CMakeLists.txt similarity index 91% rename from python/torch_mlir/csrc/reference_lazy_backend/CMakeLists.txt rename to projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/CMakeLists.txt index dcfce9e89..fdef27143 100644 --- a/python/torch_mlir/csrc/reference_lazy_backend/CMakeLists.txt +++ b/projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/CMakeLists.txt @@ -2,14 +2,15 @@ # Setup PyTorch ########################################################################### -list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/python/torch_mlir/cmake/modules") include(TorchMLIRPyTorch) TorchMLIRProbeForPyTorchInstall() if(TORCH_MLIR_USE_INSTALLED_PYTORCH) TorchMLIRConfigurePyTorch() else() - set(Torch_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../libtorch/share/cmake/Torch") + # Assume it is a sibling to the overall project. + set(Torch_DIR "${PROJECT_SOURCE_DIR}/../libtorch/share/cmake/Torch") + message(STATUS "Attempting to locate libtorch as a sibling to the project: ${Torch_DIR}") endif() find_package(Torch 1.11 REQUIRED) @@ -38,7 +39,7 @@ if(TORCH_MLIR_ENABLE_LTC) ${CMAKE_CURRENT_BINARY_DIR} ${Python3_INCLUDE_DIRS} ${PYTHON_H_DIR} - ${PROJECT_SOURCE_DIR}/python + ${PROJECT_SOURCE_DIR}/projects/pt1/python ) link_directories("${TORCH_INSTALL_PREFIX}/lib") link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib) diff --git a/python/torch_mlir/csrc/reference_lazy_backend/__init__.py b/projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/__init__.py similarity index 100% rename from python/torch_mlir/csrc/reference_lazy_backend/__init__.py rename to projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/__init__.py diff --git a/python/torch_mlir/csrc/reference_lazy_backend/backend_impl.cpp b/projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/backend_impl.cpp similarity index 100% rename from python/torch_mlir/csrc/reference_lazy_backend/backend_impl.cpp rename to projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/backend_impl.cpp diff --git a/python/torch_mlir/csrc/reference_lazy_backend/backend_impl.h b/projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/backend_impl.h similarity index 100% rename from python/torch_mlir/csrc/reference_lazy_backend/backend_impl.h rename to projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/backend_impl.h diff --git a/python/torch_mlir/csrc/reference_lazy_backend/gen_dummy_lib.py b/projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/gen_dummy_lib.py similarity index 100% rename from python/torch_mlir/csrc/reference_lazy_backend/gen_dummy_lib.py rename to projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/gen_dummy_lib.py diff --git a/python/torch_mlir/csrc/reference_lazy_backend/reference_lazy_backend_pybind.cpp b/projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/reference_lazy_backend_pybind.cpp similarity index 100% rename from python/torch_mlir/csrc/reference_lazy_backend/reference_lazy_backend_pybind.cpp rename to projects/pt1/python/torch_mlir/csrc/reference_lazy_backend/reference_lazy_backend_pybind.cpp diff --git a/python/torch_mlir/dialects/TorchBinding.td b/projects/pt1/python/torch_mlir/dialects/TorchBinding.td similarity index 100% rename from python/torch_mlir/dialects/TorchBinding.td rename to projects/pt1/python/torch_mlir/dialects/TorchBinding.td diff --git a/python/torch_mlir/dialects/torch/__init__.py b/projects/pt1/python/torch_mlir/dialects/torch/__init__.py similarity index 100% rename from python/torch_mlir/dialects/torch/__init__.py rename to projects/pt1/python/torch_mlir/dialects/torch/__init__.py diff --git a/python/torch_mlir/dialects/torch/importer/__init__.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/__init__.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/__init__.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/__init__.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt similarity index 79% rename from python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt index 72fde4f56..30bb4cb31 100644 --- a/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt +++ b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt @@ -2,14 +2,15 @@ # Setup PyTorch #------------------------------------------------------------------------------- -list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/python/torch_mlir/cmake/modules") include(TorchMLIRPyTorch) TorchMLIRProbeForPyTorchInstall() if(TORCH_MLIR_USE_INSTALLED_PYTORCH) TorchMLIRConfigurePyTorch() -else() - set(Torch_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../libtorch/share/cmake/Torch") +else() + # Assume it is a sibling to the overall project. + set(Torch_DIR "${PROJECT_SOURCE_DIR}/../libtorch/share/cmake/Torch") + message(STATUS "Attempting to locate libtorch as a sibling to the project: ${Torch_DIR}") endif() find_package(Torch 1.11 REQUIRED) diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/__init__.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/__init__.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/__init__.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/__init__.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/__init__.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/__init__.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/__init__.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/__init__.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/library_generator.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/library_generator.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/library_generator.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/library_generator.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/testing_framework.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/testing_framework.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/testing_framework.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/testing_framework.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/torch_ods_gen.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/torch_ods_gen.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/torch_ods_gen.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/torch_ods_gen.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/utils.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/utils.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/utils.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/utils.py diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator_pybind.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/function_importer.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/get_registered_ops.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/import_options_pybind.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/init_python_bindings.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/init_python_bindings.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/init_python_bindings.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/init_python_bindings.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/mlir_utils.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/mlir_utils.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/mlir_utils.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/mlir_utils.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/module_builder.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.cpp b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.cpp similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.cpp rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.cpp diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.h b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.h similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.h rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/torch_to_mlir_utils.h diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py b/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py similarity index 100% rename from python/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py rename to projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py diff --git a/python/torch_mlir/dynamo.py b/projects/pt1/python/torch_mlir/dynamo.py similarity index 100% rename from python/torch_mlir/dynamo.py rename to projects/pt1/python/torch_mlir/dynamo.py diff --git a/python/torch_mlir_e2e_test/CMakeLists.txt b/projects/pt1/python/torch_mlir_e2e_test/CMakeLists.txt similarity index 100% rename from python/torch_mlir_e2e_test/CMakeLists.txt rename to projects/pt1/python/torch_mlir_e2e_test/CMakeLists.txt diff --git a/python/torch_mlir_e2e_test/__init__.py b/projects/pt1/python/torch_mlir_e2e_test/__init__.py similarity index 100% rename from python/torch_mlir_e2e_test/__init__.py rename to projects/pt1/python/torch_mlir_e2e_test/__init__.py diff --git a/python/torch_mlir_e2e_test/annotations.py b/projects/pt1/python/torch_mlir_e2e_test/annotations.py similarity index 100% rename from python/torch_mlir_e2e_test/annotations.py rename to projects/pt1/python/torch_mlir_e2e_test/annotations.py diff --git a/python/torch_mlir_e2e_test/configs/__init__.py b/projects/pt1/python/torch_mlir_e2e_test/configs/__init__.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/__init__.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/__init__.py diff --git a/python/torch_mlir_e2e_test/configs/lazy_tensor_core.py b/projects/pt1/python/torch_mlir_e2e_test/configs/lazy_tensor_core.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/lazy_tensor_core.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/lazy_tensor_core.py diff --git a/python/torch_mlir_e2e_test/configs/linalg_on_tensors_backend.py b/projects/pt1/python/torch_mlir_e2e_test/configs/linalg_on_tensors_backend.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/linalg_on_tensors_backend.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/linalg_on_tensors_backend.py diff --git a/python/torch_mlir_e2e_test/configs/native_torch.py b/projects/pt1/python/torch_mlir_e2e_test/configs/native_torch.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/native_torch.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/native_torch.py diff --git a/python/torch_mlir_e2e_test/configs/stablehlo_backend.py b/projects/pt1/python/torch_mlir_e2e_test/configs/stablehlo_backend.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/stablehlo_backend.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/stablehlo_backend.py diff --git a/python/torch_mlir_e2e_test/configs/torchdynamo.py b/projects/pt1/python/torch_mlir_e2e_test/configs/torchdynamo.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/torchdynamo.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/torchdynamo.py diff --git a/python/torch_mlir_e2e_test/configs/torchscript.py b/projects/pt1/python/torch_mlir_e2e_test/configs/torchscript.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/torchscript.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/torchscript.py diff --git a/python/torch_mlir_e2e_test/configs/tosa_backend.py b/projects/pt1/python/torch_mlir_e2e_test/configs/tosa_backend.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/tosa_backend.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/tosa_backend.py diff --git a/python/torch_mlir_e2e_test/configs/utils.py b/projects/pt1/python/torch_mlir_e2e_test/configs/utils.py similarity index 100% rename from python/torch_mlir_e2e_test/configs/utils.py rename to projects/pt1/python/torch_mlir_e2e_test/configs/utils.py diff --git a/python/torch_mlir_e2e_test/debug/lockstep.py b/projects/pt1/python/torch_mlir_e2e_test/debug/lockstep.py similarity index 100% rename from python/torch_mlir_e2e_test/debug/lockstep.py rename to projects/pt1/python/torch_mlir_e2e_test/debug/lockstep.py diff --git a/python/torch_mlir_e2e_test/framework.py b/projects/pt1/python/torch_mlir_e2e_test/framework.py similarity index 100% rename from python/torch_mlir_e2e_test/framework.py rename to projects/pt1/python/torch_mlir_e2e_test/framework.py diff --git a/python/torch_mlir_e2e_test/linalg_on_tensors_backends/__init__.py b/projects/pt1/python/torch_mlir_e2e_test/linalg_on_tensors_backends/__init__.py similarity index 100% rename from python/torch_mlir_e2e_test/linalg_on_tensors_backends/__init__.py rename to projects/pt1/python/torch_mlir_e2e_test/linalg_on_tensors_backends/__init__.py diff --git a/python/torch_mlir_e2e_test/linalg_on_tensors_backends/abc.py b/projects/pt1/python/torch_mlir_e2e_test/linalg_on_tensors_backends/abc.py similarity index 100% rename from python/torch_mlir_e2e_test/linalg_on_tensors_backends/abc.py rename to projects/pt1/python/torch_mlir_e2e_test/linalg_on_tensors_backends/abc.py diff --git a/python/torch_mlir_e2e_test/linalg_on_tensors_backends/refbackend.py b/projects/pt1/python/torch_mlir_e2e_test/linalg_on_tensors_backends/refbackend.py similarity index 100% rename from python/torch_mlir_e2e_test/linalg_on_tensors_backends/refbackend.py rename to projects/pt1/python/torch_mlir_e2e_test/linalg_on_tensors_backends/refbackend.py diff --git a/python/torch_mlir_e2e_test/registry.py b/projects/pt1/python/torch_mlir_e2e_test/registry.py similarity index 100% rename from python/torch_mlir_e2e_test/registry.py rename to projects/pt1/python/torch_mlir_e2e_test/registry.py diff --git a/python/torch_mlir_e2e_test/reporting.py b/projects/pt1/python/torch_mlir_e2e_test/reporting.py similarity index 100% rename from python/torch_mlir_e2e_test/reporting.py rename to projects/pt1/python/torch_mlir_e2e_test/reporting.py diff --git a/python/torch_mlir_e2e_test/stablehlo_backends/__init__.py b/projects/pt1/python/torch_mlir_e2e_test/stablehlo_backends/__init__.py similarity index 100% rename from python/torch_mlir_e2e_test/stablehlo_backends/__init__.py rename to projects/pt1/python/torch_mlir_e2e_test/stablehlo_backends/__init__.py diff --git a/python/torch_mlir_e2e_test/stablehlo_backends/abc.py b/projects/pt1/python/torch_mlir_e2e_test/stablehlo_backends/abc.py similarity index 100% rename from python/torch_mlir_e2e_test/stablehlo_backends/abc.py rename to projects/pt1/python/torch_mlir_e2e_test/stablehlo_backends/abc.py diff --git a/python/torch_mlir_e2e_test/test_suite/__init__.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/__init__.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/__init__.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/__init__.py diff --git a/python/torch_mlir_e2e_test/test_suite/arange.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/arange.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/arange.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/arange.py diff --git a/python/torch_mlir_e2e_test/test_suite/argmax.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/argmax.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/argmax.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/argmax.py diff --git a/python/torch_mlir_e2e_test/test_suite/backprop.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/backprop.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/backprop.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/backprop.py diff --git a/python/torch_mlir_e2e_test/test_suite/basic.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/basic.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/basic.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/basic.py diff --git a/python/torch_mlir_e2e_test/test_suite/cast.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/cast.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/cast.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/cast.py diff --git a/python/torch_mlir_e2e_test/test_suite/constant_alloc.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/constant_alloc.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/constant_alloc.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/constant_alloc.py diff --git a/python/torch_mlir_e2e_test/test_suite/control_flow.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/control_flow.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/control_flow.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/control_flow.py diff --git a/python/torch_mlir_e2e_test/test_suite/conv.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/conv.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/conv.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/conv.py diff --git a/python/torch_mlir_e2e_test/test_suite/custom_op_example.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/custom_op_example.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/custom_op_example.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/custom_op_example.py diff --git a/python/torch_mlir_e2e_test/test_suite/elementwise.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/elementwise.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/elementwise.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/elementwise.py diff --git a/python/torch_mlir_e2e_test/test_suite/elementwise_comparison.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/elementwise_comparison.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/elementwise_comparison.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/elementwise_comparison.py diff --git a/python/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py diff --git a/python/torch_mlir_e2e_test/test_suite/index_select.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/index_select.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/index_select.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/index_select.py diff --git a/python/torch_mlir_e2e_test/test_suite/matmul.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/matmul.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/matmul.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/matmul.py diff --git a/python/torch_mlir_e2e_test/test_suite/mlp.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/mlp.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/mlp.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/mlp.py diff --git a/python/torch_mlir_e2e_test/test_suite/nll_loss.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/nll_loss.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/nll_loss.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/nll_loss.py diff --git a/python/torch_mlir_e2e_test/test_suite/norm_like.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/norm_like.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/norm_like.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/norm_like.py diff --git a/python/torch_mlir_e2e_test/test_suite/pooling.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/pooling.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/pooling.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/pooling.py diff --git a/python/torch_mlir_e2e_test/test_suite/quantized_models.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/quantized_models.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/quantized_models.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/quantized_models.py diff --git a/python/torch_mlir_e2e_test/test_suite/reduction.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/reduction.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/reduction.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/reduction.py diff --git a/python/torch_mlir_e2e_test/test_suite/reshape_like.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/reshape_like.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/reshape_like.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/reshape_like.py diff --git a/python/torch_mlir_e2e_test/test_suite/return_types.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/return_types.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/return_types.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/return_types.py diff --git a/python/torch_mlir_e2e_test/test_suite/rng.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/rng.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/rng.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/rng.py diff --git a/python/torch_mlir_e2e_test/test_suite/scalar.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/scalar.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/scalar.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/scalar.py diff --git a/python/torch_mlir_e2e_test/test_suite/scalar_comparison.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/scalar_comparison.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/scalar_comparison.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/scalar_comparison.py diff --git a/python/torch_mlir_e2e_test/test_suite/scatter.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/scatter.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/scatter.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/scatter.py diff --git a/python/torch_mlir_e2e_test/test_suite/slice_like.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/slice_like.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/slice_like.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/slice_like.py diff --git a/python/torch_mlir_e2e_test/test_suite/squeeze.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/squeeze.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/squeeze.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/squeeze.py diff --git a/python/torch_mlir_e2e_test/test_suite/stats.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/stats.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/stats.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/stats.py diff --git a/python/torch_mlir_e2e_test/test_suite/threshold.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/threshold.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/threshold.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/threshold.py diff --git a/python/torch_mlir_e2e_test/test_suite/type_conversion.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/type_conversion.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/type_conversion.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/type_conversion.py diff --git a/python/torch_mlir_e2e_test/test_suite/type_promotion.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/type_promotion.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/type_promotion.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/type_promotion.py diff --git a/python/torch_mlir_e2e_test/test_suite/vision_models.py b/projects/pt1/python/torch_mlir_e2e_test/test_suite/vision_models.py similarity index 100% rename from python/torch_mlir_e2e_test/test_suite/vision_models.py rename to projects/pt1/python/torch_mlir_e2e_test/test_suite/vision_models.py diff --git a/python/torch_mlir_e2e_test/tosa_backends/__init__.py b/projects/pt1/python/torch_mlir_e2e_test/tosa_backends/__init__.py similarity index 100% rename from python/torch_mlir_e2e_test/tosa_backends/__init__.py rename to projects/pt1/python/torch_mlir_e2e_test/tosa_backends/__init__.py diff --git a/python/torch_mlir_e2e_test/tosa_backends/abc.py b/projects/pt1/python/torch_mlir_e2e_test/tosa_backends/abc.py similarity index 100% rename from python/torch_mlir_e2e_test/tosa_backends/abc.py rename to projects/pt1/python/torch_mlir_e2e_test/tosa_backends/abc.py diff --git a/python/torch_mlir_e2e_test/tosa_backends/linalg_on_tensors.py b/projects/pt1/python/torch_mlir_e2e_test/tosa_backends/linalg_on_tensors.py similarity index 100% rename from python/torch_mlir_e2e_test/tosa_backends/linalg_on_tensors.py rename to projects/pt1/python/torch_mlir_e2e_test/tosa_backends/linalg_on_tensors.py diff --git a/python/torch_mlir_e2e_test/utils.py b/projects/pt1/python/torch_mlir_e2e_test/utils.py similarity index 100% rename from python/torch_mlir_e2e_test/utils.py rename to projects/pt1/python/torch_mlir_e2e_test/utils.py diff --git a/projects/pt1/test/CMakeLists.txt b/projects/pt1/test/CMakeLists.txt new file mode 100644 index 000000000..1419b245e --- /dev/null +++ b/projects/pt1/test/CMakeLists.txt @@ -0,0 +1,26 @@ +llvm_canonicalize_cmake_booleans( + MLIR_ENABLE_BINDINGS_PYTHON + TORCH_MLIR_ENABLE_JIT_IR_IMPORTER +) + +configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py +) + +set(TORCH_MLIR_TEST_DEPENDS + FileCheck count not + TorchMLIRPythonModules + torch-mlir-opt + torch-mlir-capi-torch-test + ) + +add_lit_testsuite(check-torch-mlir-pt1 "Running the torch-mlir PT1 regression tests" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${TORCH_MLIR_TEST_DEPENDS} + ) +set_target_properties(check-torch-mlir-pt1 PROPERTIES FOLDER "Tests") + +add_lit_testsuites(TORCH_MLIR ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${TORCH_MLIR_TEST_DEPENDS}) diff --git a/externals/llvm-external-projects/torch-mlir-dialects/test/lit.cfg.py b/projects/pt1/test/lit.cfg.py similarity index 63% rename from externals/llvm-external-projects/torch-mlir-dialects/test/lit.cfg.py rename to projects/pt1/test/lit.cfg.py index 272718b68..a9753bf22 100644 --- a/externals/llvm-external-projects/torch-mlir-dialects/test/lit.cfg.py +++ b/projects/pt1/test/lit.cfg.py @@ -1,4 +1,3 @@ -# -*- Python -*- # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -20,7 +19,7 @@ from lit.llvm.subst import FindTool # Configuration file for the 'lit' test runner. # name: The name of this test suite. -config.name = 'TORCH_MLIR_DIALECTS' +config.name = 'TORCH_MLIR' config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell) @@ -31,13 +30,10 @@ config.suffixes = ['.mlir', '.py'] config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.torch_mlir_dialects_obj_root, 'test') +config.test_exec_root = os.path.join(config.torch_mlir_obj_root, 'test') config.substitutions.append(('%PATH%', config.environment['PATH'])) config.substitutions.append(('%shlibext', config.llvm_shlib_ext)) -config.substitutions.append( - ('%resources_dir', os.path.join(config.torch_mlir_dialects_obj_root, - 'resources'))) llvm_config.with_system_environment(['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP']) @@ -55,15 +51,30 @@ config.excludes = [ config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.torch_mlir_dialects_obj_root, 'test') -config.standalone_tools_dir = os.path.join(config.torch_mlir_dialects_obj_root, 'bin') +config.test_exec_root = os.path.join(config.torch_mlir_obj_root, 'test') +config.standalone_tools_dir = os.path.join(config.torch_mlir_obj_root, 'bin') # Tweak the PATH to include the tools dir. llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True) -tool_dirs = [config.torch_mlir_dialects_tools_dir, config.llvm_tools_dir] +# Tweak the PATH to include the binary build dir, in order to pick up CAPI tests during out-of-tree. +llvm_config.with_environment('PATH', os.path.join(config.llvm_build_dir, 'bin'), append_path=True) + +# On Windows the path to python could contains spaces in which case it needs to +# be provided in quotes. This is the equivalent of how %python is setup in +# llvm/utils/lit/lit/llvm/config.py. +if "Windows" in config.host_os: + config.python_executable = '"%s"' % (config.python_executable) + +tool_dirs = [config.standalone_tools_dir, config.llvm_tools_dir, config.torch_mlir_obj_root] tools = [ - "torch-mlir-dialects-opt", + 'torch-mlir-opt', ToolSubst('%PYTHON', config.python_executable, unresolved='ignore'), ] llvm_config.add_tool_substitutions(tools, tool_dirs) + +if config.enable_bindings_python: + llvm_config.with_environment('PYTHONPATH', [ + os.path.join(config.torch_mlir_python_packages_dir, 'torch_mlir'), + ], + append_path=True) diff --git a/projects/pt1/test/lit.site.cfg.py.in b/projects/pt1/test/lit.site.cfg.py.in new file mode 100644 index 000000000..3b3ef59bd --- /dev/null +++ b/projects/pt1/test/lit.site.cfg.py.in @@ -0,0 +1,25 @@ +@LIT_SITE_CFG_IN_HEADER@ + +import sys + +config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@ +config.torch_mlir_obj_root = "@TORCH_MLIR_BINARY_DIR@" +config.torch_mlir_python_packages_dir = "@TORCH_MLIR_PYTHON_PACKAGES_DIR@" +config.host_os = "@HOST_OS@" +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.llvm_build_dir = "@CMAKE_BINARY_DIR@" +config.llvm_lib_dir = "@LLVM_LIBS_DIR@" +config.llvm_shlib_dir = "@SHLIBDIR@" +config.llvm_shlib_ext = "@SHLIBEXT@" +config.llvm_exe_ext = "@EXEEXT@" +config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" +config.python_executable = "@Python3_EXECUTABLE@" +config.enable_jit_ir_importer = @TORCH_MLIR_ENABLE_JIT_IR_IMPORTER@ + +import lit.llvm +lit.llvm.initialize(lit_config, config) + +# Let the main config do the real work. +lit_config.load_config(config, "@TORCH_MLIR_SOURCE_DIR@/projects/pt1/test/lit.cfg.py") diff --git a/test/python/custom_op_shape_dtype_fn.py b/projects/pt1/test/python/custom_op_shape_dtype_fn.py similarity index 100% rename from test/python/custom_op_shape_dtype_fn.py rename to projects/pt1/test/python/custom_op_shape_dtype_fn.py diff --git a/test/python/importer/jit_ir/get_registered_ops.py b/projects/pt1/test/python/importer/jit_ir/get_registered_ops.py similarity index 100% rename from test/python/importer/jit_ir/get_registered_ops.py rename to projects/pt1/test/python/importer/jit_ir/get_registered_ops.py diff --git a/test/python/importer/jit_ir/ivalue_import/README.md b/projects/pt1/test/python/importer/jit_ir/ivalue_import/README.md similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/README.md rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/README.md diff --git a/test/python/importer/jit_ir/ivalue_import/annotations/arg-error.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/arg-error.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/annotations/arg-error.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/arg-error.py diff --git a/test/python/importer/jit_ir/ivalue_import/annotations/arg-tensor-type-bound.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/arg-tensor-type-bound.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/annotations/arg-tensor-type-bound.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/arg-tensor-type-bound.py diff --git a/test/python/importer/jit_ir/ivalue_import/annotations/class-annotator-repr.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/class-annotator-repr.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/annotations/class-annotator-repr.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/class-annotator-repr.py diff --git a/test/python/importer/jit_ir/ivalue_import/annotations/export-error.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/export-error.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/annotations/export-error.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/export-error.py diff --git a/test/python/importer/jit_ir/ivalue_import/annotations/export-recursive.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/export-recursive.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/annotations/export-recursive.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/export-recursive.py diff --git a/test/python/importer/jit_ir/ivalue_import/annotations/export.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/export.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/annotations/export.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/annotations/export.py diff --git a/test/python/importer/jit_ir/ivalue_import/debug-module-name.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/debug-module-name.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/debug-module-name.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/debug-module-name.py diff --git a/test/python/importer/jit_ir/ivalue_import/dict.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/dict.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/dict.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/dict.py diff --git a/test/python/importer/jit_ir/ivalue_import/functions-that-call-methods.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/functions-that-call-methods.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/functions-that-call-methods.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/functions-that-call-methods.py diff --git a/test/python/importer/jit_ir/ivalue_import/functions.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/functions.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/functions.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/functions.py diff --git a/test/python/importer/jit_ir/ivalue_import/list.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/list.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/list.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/list.py diff --git a/test/python/importer/jit_ir/ivalue_import/methods-derefine.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/methods-derefine.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/methods-derefine.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/methods-derefine.py diff --git a/test/python/importer/jit_ir/ivalue_import/methods-locations.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/methods-locations.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/methods-locations.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/methods-locations.py diff --git a/test/python/importer/jit_ir/ivalue_import/methods.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/methods.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/methods.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/methods.py diff --git a/test/python/importer/jit_ir/ivalue_import/object-identity-error-submodule.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/object-identity-error-submodule.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/object-identity-error-submodule.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/object-identity-error-submodule.py diff --git a/test/python/importer/jit_ir/ivalue_import/object-identity-error.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/object-identity-error.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/object-identity-error.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/object-identity-error.py diff --git a/test/python/importer/jit_ir/ivalue_import/object-identity-torch-bug.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/object-identity-torch-bug.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/object-identity-torch-bug.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/object-identity-torch-bug.py diff --git a/test/python/importer/jit_ir/ivalue_import/object-identity.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/object-identity.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/object-identity.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/object-identity.py diff --git a/test/python/importer/jit_ir/ivalue_import/prim.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/prim.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/prim.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/prim.py diff --git a/test/python/importer/jit_ir/ivalue_import/primitives.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/primitives.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/primitives.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/primitives.py diff --git a/test/python/importer/jit_ir/ivalue_import/quantization.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/quantization.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/quantization.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/quantization.py diff --git a/test/python/importer/jit_ir/ivalue_import/strings.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/strings.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/strings.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/strings.py diff --git a/test/python/importer/jit_ir/ivalue_import/submodules-select.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/submodules-select.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/submodules-select.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/submodules-select.py diff --git a/test/python/importer/jit_ir/ivalue_import/submodules.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/submodules.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/submodules.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/submodules.py diff --git a/test/python/importer/jit_ir/ivalue_import/tensors-value-semantics.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/tensors-value-semantics.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/tensors-value-semantics.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/tensors-value-semantics.py diff --git a/test/python/importer/jit_ir/ivalue_import/tensors.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/tensors.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/tensors.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/tensors.py diff --git a/test/python/importer/jit_ir/ivalue_import/tuple.py b/projects/pt1/test/python/importer/jit_ir/ivalue_import/tuple.py similarity index 100% rename from test/python/importer/jit_ir/ivalue_import/tuple.py rename to projects/pt1/test/python/importer/jit_ir/ivalue_import/tuple.py diff --git a/test/python/importer/jit_ir/lit.local.cfg b/projects/pt1/test/python/importer/jit_ir/lit.local.cfg similarity index 100% rename from test/python/importer/jit_ir/lit.local.cfg rename to projects/pt1/test/python/importer/jit_ir/lit.local.cfg diff --git a/test/python/importer/jit_ir/node_import/README.md b/projects/pt1/test/python/importer/jit_ir/node_import/README.md similarity index 100% rename from test/python/importer/jit_ir/node_import/README.md rename to projects/pt1/test/python/importer/jit_ir/node_import/README.md diff --git a/test/python/importer/jit_ir/node_import/classes.py b/projects/pt1/test/python/importer/jit_ir/node_import/classes.py similarity index 100% rename from test/python/importer/jit_ir/node_import/classes.py rename to projects/pt1/test/python/importer/jit_ir/node_import/classes.py diff --git a/test/python/importer/jit_ir/node_import/debug-info.py b/projects/pt1/test/python/importer/jit_ir/node_import/debug-info.py similarity index 100% rename from test/python/importer/jit_ir/node_import/debug-info.py rename to projects/pt1/test/python/importer/jit_ir/node_import/debug-info.py diff --git a/test/python/importer/jit_ir/node_import/dict.py b/projects/pt1/test/python/importer/jit_ir/node_import/dict.py similarity index 100% rename from test/python/importer/jit_ir/node_import/dict.py rename to projects/pt1/test/python/importer/jit_ir/node_import/dict.py diff --git a/test/python/importer/jit_ir/node_import/elif.py b/projects/pt1/test/python/importer/jit_ir/node_import/elif.py similarity index 100% rename from test/python/importer/jit_ir/node_import/elif.py rename to projects/pt1/test/python/importer/jit_ir/node_import/elif.py diff --git a/test/python/importer/jit_ir/node_import/errors.py b/projects/pt1/test/python/importer/jit_ir/node_import/errors.py similarity index 100% rename from test/python/importer/jit_ir/node_import/errors.py rename to projects/pt1/test/python/importer/jit_ir/node_import/errors.py diff --git a/test/python/importer/jit_ir/node_import/function-block-arg-adjustment.py b/projects/pt1/test/python/importer/jit_ir/node_import/function-block-arg-adjustment.py similarity index 100% rename from test/python/importer/jit_ir/node_import/function-block-arg-adjustment.py rename to projects/pt1/test/python/importer/jit_ir/node_import/function-block-arg-adjustment.py diff --git a/test/python/importer/jit_ir/node_import/function-derefine.py b/projects/pt1/test/python/importer/jit_ir/node_import/function-derefine.py similarity index 100% rename from test/python/importer/jit_ir/node_import/function-derefine.py rename to projects/pt1/test/python/importer/jit_ir/node_import/function-derefine.py diff --git a/test/python/importer/jit_ir/node_import/if.py b/projects/pt1/test/python/importer/jit_ir/node_import/if.py similarity index 100% rename from test/python/importer/jit_ir/node_import/if.py rename to projects/pt1/test/python/importer/jit_ir/node_import/if.py diff --git a/test/python/importer/jit_ir/node_import/list.py b/projects/pt1/test/python/importer/jit_ir/node_import/list.py similarity index 100% rename from test/python/importer/jit_ir/node_import/list.py rename to projects/pt1/test/python/importer/jit_ir/node_import/list.py diff --git a/test/python/importer/jit_ir/node_import/loop.py b/projects/pt1/test/python/importer/jit_ir/node_import/loop.py similarity index 100% rename from test/python/importer/jit_ir/node_import/loop.py rename to projects/pt1/test/python/importer/jit_ir/node_import/loop.py diff --git a/test/python/importer/jit_ir/node_import/prim.py b/projects/pt1/test/python/importer/jit_ir/node_import/prim.py similarity index 100% rename from test/python/importer/jit_ir/node_import/prim.py rename to projects/pt1/test/python/importer/jit_ir/node_import/prim.py diff --git a/test/python/importer/jit_ir/node_import/tuple.py b/projects/pt1/test/python/importer/jit_ir/node_import/tuple.py similarity index 100% rename from test/python/importer/jit_ir/node_import/tuple.py rename to projects/pt1/test/python/importer/jit_ir/node_import/tuple.py diff --git a/test/python/importer/jit_ir/node_import/types-bool.py b/projects/pt1/test/python/importer/jit_ir/node_import/types-bool.py similarity index 100% rename from test/python/importer/jit_ir/node_import/types-bool.py rename to projects/pt1/test/python/importer/jit_ir/node_import/types-bool.py diff --git a/test/python/importer/jit_ir/node_import/types-none.py b/projects/pt1/test/python/importer/jit_ir/node_import/types-none.py similarity index 100% rename from test/python/importer/jit_ir/node_import/types-none.py rename to projects/pt1/test/python/importer/jit_ir/node_import/types-none.py diff --git a/test/python/importer/jit_ir/node_import/unimplemented.py b/projects/pt1/test/python/importer/jit_ir/node_import/unimplemented.py similarity index 100% rename from test/python/importer/jit_ir/node_import/unimplemented.py rename to projects/pt1/test/python/importer/jit_ir/node_import/unimplemented.py diff --git a/test/python/importer/jit_ir/node_import/union.py b/projects/pt1/test/python/importer/jit_ir/node_import/union.py similarity index 100% rename from test/python/importer/jit_ir/node_import/union.py rename to projects/pt1/test/python/importer/jit_ir/node_import/union.py diff --git a/test/python/importer/jit_ir/node_import/utils.py b/projects/pt1/test/python/importer/jit_ir/node_import/utils.py similarity index 100% rename from test/python/importer/jit_ir/node_import/utils.py rename to projects/pt1/test/python/importer/jit_ir/node_import/utils.py diff --git a/test/python/lit.local.cfg b/projects/pt1/test/python/lit.local.cfg similarity index 100% rename from test/python/lit.local.cfg rename to projects/pt1/test/python/lit.local.cfg diff --git a/test/python/smoketest.py b/projects/pt1/test/python/smoketest.py similarity index 100% rename from test/python/smoketest.py rename to projects/pt1/test/python/smoketest.py diff --git a/tools/e2e_test.sh b/projects/pt1/tools/e2e_test.sh similarity index 80% rename from tools/e2e_test.sh rename to projects/pt1/tools/e2e_test.sh index cddd1543b..a16929302 100755 --- a/tools/e2e_test.sh +++ b/projects/pt1/tools/e2e_test.sh @@ -2,11 +2,12 @@ set -euo pipefail src_dir="$(realpath "$(dirname "$0")"/..)" +project_dir="$src_dir/../.." cd "$src_dir" # Ensure PYTHONPATH is set for export to child processes, even if empty. export PYTHONPATH=${PYTHONPATH-} -source .env +source $project_dir/.env python -m e2e_testing.main "$@" diff --git a/setup.py b/setup.py index 6b8484e05..46217d307 100644 --- a/setup.py +++ b/setup.py @@ -84,9 +84,8 @@ class CMakeBuild(build_py): f"-DMLIR_ENABLE_BINDINGS_PYTHON=ON", f"-DLLVM_ENABLE_PROJECTS=mlir", f"-DLLVM_ENABLE_ZSTD=OFF", - f"-DLLVM_EXTERNAL_PROJECTS=torch-mlir;torch-mlir-dialects", + f"-DLLVM_EXTERNAL_PROJECTS=torch-mlir", f"-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR={src_dir}", - f"-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR={src_dir}/externals/llvm-external-projects/torch-mlir-dialects", # Optimization options for building wheels. f"-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON", f"-DCMAKE_C_VISIBILITY_PRESET=hidden", diff --git a/test/CAPI/CMakeLists.txt b/test/CAPI/CMakeLists.txt index 812e31289..0f3bd8fa9 100644 --- a/test/CAPI/CMakeLists.txt +++ b/test/CAPI/CMakeLists.txt @@ -4,12 +4,5 @@ target_link_libraries( torch-mlir-capi-torch-test PRIVATE MLIRCAPIIR - MLIRCAPIRegisterEverything TorchMLIRCAPI ) - -add_lit_testsuite(check-torch-mlir-capi "Running the torch-mlir CAPI tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS torch-mlir-capi-torch-test FileCheck - ) -set_target_properties(check-torch-mlir-capi PROPERTIES FOLDER "Tests") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 51407b488..8997cfba2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ llvm_canonicalize_cmake_booleans( MLIR_ENABLE_BINDINGS_PYTHON - TORCH_MLIR_ENABLE_JIT_IR_IMPORTER + TORCH_MLIR_ENABLE_REFBACKEND TORCH_MLIR_ENABLE_STABLEHLO ) @@ -13,7 +13,9 @@ configure_lit_site_cfg( set(TORCH_MLIR_TEST_DEPENDS FileCheck count not - torch-mlir-opt TorchMLIRPythonModules + TorchMLIRPythonModules + torch-mlir-opt + torch-mlir-capi-torch-test ) add_lit_testsuite(check-torch-mlir "Running the torch-mlir regression tests" diff --git a/externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/bufferize.mlir b/test/Dialect/TMTensor/bufferize.mlir similarity index 98% rename from externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/bufferize.mlir rename to test/Dialect/TMTensor/bufferize.mlir index 7059524fe..3e60814fa 100644 --- a/externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/bufferize.mlir +++ b/test/Dialect/TMTensor/bufferize.mlir @@ -1,4 +1,4 @@ -// RUN: torch-mlir-dialects-opt -split-input-file -tm-tensor-bufferize %s | FileCheck %s +// RUN: torch-mlir-opt -split-input-file -tm-tensor-bufferize %s | FileCheck %s // ----- // CHECK-LABEL: func.func @scan_1d_inclusive( diff --git a/externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/canonicalize.mlir b/test/Dialect/TMTensor/canonicalize.mlir similarity index 91% rename from externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/canonicalize.mlir rename to test/Dialect/TMTensor/canonicalize.mlir index b660b5161..1ffc0731b 100644 --- a/externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/canonicalize.mlir +++ b/test/Dialect/TMTensor/canonicalize.mlir @@ -1,4 +1,4 @@ -// RUN: torch-mlir-dialects-opt -canonicalize -split-input-file %s | FileCheck %s +// RUN: torch-mlir-opt -canonicalize -split-input-file %s | FileCheck %s // CHECK-LABEL: func.func @tensor.cast( func.func @tensor.cast(%arg0: tensor<128xi32>) -> tensor<128xi32> { diff --git a/externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/convert_to_loops.mlir b/test/Dialect/TMTensor/convert_to_loops.mlir similarity index 99% rename from externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/convert_to_loops.mlir rename to test/Dialect/TMTensor/convert_to_loops.mlir index 6994ce3ad..e9c160f99 100644 --- a/externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/convert_to_loops.mlir +++ b/test/Dialect/TMTensor/convert_to_loops.mlir @@ -1,4 +1,4 @@ -// RUN: torch-mlir-dialects-opt -split-input-file -tm-tensor-to-loops %s | FileCheck %s +// RUN: torch-mlir-opt -split-input-file -tm-tensor-to-loops %s | FileCheck %s func.func @scan_1d_inclusive(%0: memref<128xi32>, %1: memref<128xi32>) { %c0 = memref.alloc() : memref diff --git a/externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/invalid.mlir b/test/Dialect/TMTensor/invalid.mlir similarity index 99% rename from externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/invalid.mlir rename to test/Dialect/TMTensor/invalid.mlir index db343c6c3..bfcd1adb8 100644 --- a/externals/llvm-external-projects/torch-mlir-dialects/test/tmtensor/invalid.mlir +++ b/test/Dialect/TMTensor/invalid.mlir @@ -1,4 +1,4 @@ -// RUN: torch-mlir-dialects-opt -split-input-file -verify-diagnostics %s +// RUN: torch-mlir-opt -split-input-file -verify-diagnostics %s func.func @scatter_mixed_tensor_memref( %update : memref, %indices : tensor, diff --git a/test/RefBackend/lit.local.cfg b/test/RefBackend/lit.local.cfg new file mode 100644 index 000000000..344ff6e4c --- /dev/null +++ b/test/RefBackend/lit.local.cfg @@ -0,0 +1,2 @@ +if not config.torch_mlir_enable_refbackend: + config.unsupported = True diff --git a/test/lit.site.cfg.py.in b/test/lit.site.cfg.py.in index f7ac86747..1be54aaf6 100644 --- a/test/lit.site.cfg.py.in +++ b/test/lit.site.cfg.py.in @@ -5,6 +5,7 @@ import sys config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@ config.torch_mlir_obj_root = "@TORCH_MLIR_BINARY_DIR@" config.torch_mlir_python_packages_dir = "@TORCH_MLIR_PYTHON_PACKAGES_DIR@" +config.torch_mlir_enable_refbackend = @TORCH_MLIR_ENABLE_REFBACKEND@ config.host_os = "@HOST_OS@" config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" @@ -16,7 +17,6 @@ config.llvm_shlib_ext = "@SHLIBEXT@" config.llvm_exe_ext = "@EXEEXT@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.python_executable = "@Python3_EXECUTABLE@" -config.enable_jit_ir_importer = @TORCH_MLIR_ENABLE_JIT_IR_IMPORTER@ config.enable_stablehlo = @TORCH_MLIR_ENABLE_STABLEHLO@ import lit.llvm diff --git a/tools/torch-mlir-lsp-server/CMakeLists.txt b/tools/torch-mlir-lsp-server/CMakeLists.txt index d53519c8a..55dbd3e41 100644 --- a/tools/torch-mlir-lsp-server/CMakeLists.txt +++ b/tools/torch-mlir-lsp-server/CMakeLists.txt @@ -7,18 +7,18 @@ EXPORT TorchMLIRTargets RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR} COMPONENT torch-mlir-lsp-server) -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) -get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) -get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS) +# get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) +# get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) +# get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS) target_link_libraries(torch-mlir-lsp-server PRIVATE MLIRLspServerLib TorchMLIRInitAll - # TODO: Remove these in favor of interface deps. - ${dialect_libs} - ${conversion_libs} - ${extension_libs} + # # TODO: Remove these in favor of interface deps. + # ${dialect_libs} + # ${conversion_libs} + # ${extension_libs} ) mlir_check_all_link_libraries(torch-mlir-lsp-server) diff --git a/tools/torch-mlir-lsp-server/torch-mlir-lsp-server.cpp b/tools/torch-mlir-lsp-server/torch-mlir-lsp-server.cpp index a6d88a355..4b66b2797 100644 --- a/tools/torch-mlir-lsp-server/torch-mlir-lsp-server.cpp +++ b/tools/torch-mlir-lsp-server/torch-mlir-lsp-server.cpp @@ -9,8 +9,6 @@ #include "mlir/IR/Dialect.h" #include "mlir/IR/MLIRContext.h" -#include "mlir/InitAllDialects.h" -#include "mlir/InitAllExtensions.h" #include "mlir/Tools/mlir-lsp-server/MlirLspServerMain.h" #include "torch-mlir/InitAll.h" @@ -18,8 +16,7 @@ using namespace mlir; int main(int argc, char **argv) { DialectRegistry registry; - registerAllDialects(registry); - registerAllExtensions(registry); mlir::torch::registerAllDialects(registry); + mlir::torch::registerOptionalInputDialects(registry); return failed(MlirLspServerMain(argc, argv, registry)); } diff --git a/tools/torch-mlir-opt/CMakeLists.txt b/tools/torch-mlir-opt/CMakeLists.txt index 94c547d0e..5e2a81e04 100644 --- a/tools/torch-mlir-opt/CMakeLists.txt +++ b/tools/torch-mlir-opt/CMakeLists.txt @@ -5,10 +5,6 @@ EXPORT TorchMLIRTargets RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR} COMPONENT torch-mlir-opt) -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) -get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) -get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS) - set(dependency_libraries) if(TORCH_MLIR_ENABLE_STABLEHLO) list(APPEND dependency_libraries StablehloRegister) @@ -16,11 +12,9 @@ endif() target_link_libraries(torch-mlir-opt PRIVATE MLIROptLib + MLIRTransforms TorchMLIRInitAll TorchMLIRTorchDialect TorchMLIRTorchPasses - ${dialect_libs} - ${conversion_libs} - ${extension_libs} ${dependency_libraries} ) diff --git a/tools/torch-mlir-opt/torch-mlir-opt.cpp b/tools/torch-mlir-opt/torch-mlir-opt.cpp index fa6a41a70..2750ee2b7 100644 --- a/tools/torch-mlir-opt/torch-mlir-opt.cpp +++ b/tools/torch-mlir-opt/torch-mlir-opt.cpp @@ -7,10 +7,10 @@ // //===----------------------------------------------------------------------===// -#include "mlir/InitAllDialects.h" -#include "mlir/InitAllExtensions.h" -#include "mlir/InitAllPasses.h" +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/Tools/mlir-opt/MlirOptMain.h" +#include "mlir/Transforms/Passes.h" #include "torch-mlir/InitAll.h" #ifdef TORCH_MLIR_ENABLE_STABLEHLO @@ -20,14 +20,23 @@ using namespace mlir; int main(int argc, char **argv) { - registerAllPasses(); mlir::torch::registerAllPasses(); + // Core Transforms + registerCanonicalizerPass(); + registerCSEPass(); + registerInlinerPass(); + registerLocationSnapshotPass(); + registerLoopInvariantCodeMotionPass(); + registerPrintOpStatsPass(); + registerViewOpGraphPass(); + registerStripDebugInfoPass(); + registerSymbolDCEPass(); + DialectRegistry registry; - registerAllDialects(registry); - registerAllExtensions(registry); mlir::torch::registerAllDialects(registry); - + mlir::torch::registerOptionalInputDialects(registry); + #ifdef TORCH_MLIR_ENABLE_STABLEHLO mlir::stablehlo::registerAllDialects(registry); #endif