From e16b43e20b770ebbdfb536ff539bec8847537b59 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Mon, 29 Aug 2022 20:32:18 +0000 Subject: [PATCH] Remove "torchscript" association from the e2e framework. We use it for more than TorchScript testing now. This is a purely mechanical change to adjust some file paths to remove "torchscript". The most perceptible change here is that now e2e tests are run with ``` ./tools/e2e_test.sh instead of: ./tools/torchscript_e2e_test.sh ``` --- .github/workflows/buildAndTest.yml | 10 +++++----- build_tools/torchscript_e2e_heavydep_tests/README.md | 10 +++++----- .../generate_serialized_tests.sh | 2 +- .../hf_sequence_classification.py | 6 +++--- build_tools/torchscript_e2e_heavydep_tests/main.py | 2 +- .../torchscript_e2e_heavydep_tests/train_models.py | 6 +++--- .../torchscript_e2e_heavydep_tests/vision_models.py | 6 +++--- docs/development.md | 10 +++++----- e2e_testing/{torchscript => }/main.py | 12 ++++++------ e2e_testing/{torchscript => }/xfail_sets.py | 0 python/test/annotations-sugar.py | 2 +- python/test/torchscript_e2e_test/basic.py | 8 ++++---- .../test/torchscript_e2e_test/compilation_failure.py | 8 ++++---- python/test/torchscript_e2e_test/error_reports.py | 8 ++++---- .../test/torchscript_e2e_test/non_tensor_values.py | 8 ++++---- python/test/torchscript_e2e_test/runtime_failure.py | 8 ++++---- python/test/torchscript_e2e_test/submodule.py | 8 ++++---- .../torch/importer/jit_ir/torchscript_annotations.py | 2 +- .../{torchscript => }/annotations.py | 0 .../{torchscript => }/configs/__init__.py | 0 .../{torchscript => }/configs/eager_mode.py | 2 +- .../{torchscript => }/configs/lazy_tensor_core.py | 2 +- .../configs/linalg_on_tensors_backend.py | 2 +- .../{torchscript => }/configs/mhlo_backend.py | 2 +- .../{torchscript => }/configs/native_torch.py | 2 +- .../{torchscript => }/configs/torchscript.py | 2 +- .../{torchscript => }/configs/tosa_backend.py | 2 +- .../{torchscript => }/configs/utils.py | 6 ------ .../{torchscript => }/framework.py | 0 .../{torchscript => }/registry.py | 0 .../{torchscript => }/reporting.py | 0 .../{torchscript => }/serialization.py | 0 python/torch_mlir_e2e_test/test_suite/arange.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/argmax.py | 7 +++---- python/torch_mlir_e2e_test/test_suite/backprop.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/basic.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/cast.py | 7 +++---- .../torch_mlir_e2e_test/test_suite/constant_alloc.py | 6 +++--- .../torch_mlir_e2e_test/test_suite/control_flow.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/conv.py | 8 ++++---- .../test_suite/custom_op_example.py | 7 +++---- python/torch_mlir_e2e_test/test_suite/elementwise.py | 6 +++--- .../test_suite/elementwise_comparison.py | 7 +++---- .../test_suite/histogram_binning_calibration.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/index_put.py | 6 +++--- .../torch_mlir_e2e_test/test_suite/index_select.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/matmul.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/mlp.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/nll_loss.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/norm_like.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/pooling.py | 6 +++--- .../test_suite/quantized_models.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/reduction.py | 6 +++--- .../torch_mlir_e2e_test/test_suite/reshape_like.py | 7 +++---- .../torch_mlir_e2e_test/test_suite/return_types.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/rng.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/scalar.py | 6 +++--- .../test_suite/scalar_comparison.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/slice_like.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/squeeze.py | 6 +++--- python/torch_mlir_e2e_test/test_suite/stats.py | 6 +++--- .../test_suite/table_batch_embedding.py | 7 +++---- python/torch_mlir_e2e_test/test_suite/threshold.py | 6 +++--- .../test_suite/type_conversion.py | 6 +++--- .../torch_mlir_e2e_test/test_suite/type_promotion.py | 8 +++----- .../torch_mlir_e2e_test/test_suite/vision_models.py | 6 +++--- .../torch_mlir_e2e_test/torchscript/CMakeLists.txt | 8 -------- python/torch_mlir_e2e_test/torchscript/__init__.py | 0 python/torch_mlir_e2e_test/utils.py | 2 +- tools/{torchscript_e2e_test.sh => e2e_test.sh} | 2 +- 70 files changed, 170 insertions(+), 192 deletions(-) rename e2e_testing/{torchscript => }/main.py (92%) rename e2e_testing/{torchscript => }/xfail_sets.py (100%) rename python/torch_mlir_e2e_test/{torchscript => }/annotations.py (100%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/__init__.py (100%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/eager_mode.py (96%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/lazy_tensor_core.py (94%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/linalg_on_tensors_backend.py (95%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/mhlo_backend.py (96%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/native_torch.py (92%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/torchscript.py (93%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/tosa_backend.py (95%) rename python/torch_mlir_e2e_test/{torchscript => }/configs/utils.py (85%) rename python/torch_mlir_e2e_test/{torchscript => }/framework.py (100%) rename python/torch_mlir_e2e_test/{torchscript => }/registry.py (100%) rename python/torch_mlir_e2e_test/{torchscript => }/reporting.py (100%) rename python/torch_mlir_e2e_test/{torchscript => }/serialization.py (100%) delete mode 100644 python/torch_mlir_e2e_test/torchscript/CMakeLists.txt delete mode 100644 python/torch_mlir_e2e_test/torchscript/__init__.py rename tools/{torchscript_e2e_test.sh => e2e_test.sh} (82%) diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index f1bf75245..a5e97b65b 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -173,29 +173,29 @@ jobs: if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }} run: | export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir" - python -m e2e_testing.torchscript.main --config=refbackend -v + python -m e2e_testing.main --config=refbackend -v - name: Run eager_mode e2e integration tests if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }} run: | export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir" - python -m e2e_testing.torchscript.main --config=eager_mode -v + python -m e2e_testing.main --config=eager_mode -v - name: Run mhlo e2e integration tests if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }} run: | export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir" - python -m e2e_testing.torchscript.main --config=mhlo -v + python -m e2e_testing.main --config=mhlo -v - name: Run tosa e2e integration tests if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }} run: | export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir" - python -m e2e_testing.torchscript.main --config=tosa -v + python -m e2e_testing.main --config=tosa -v - name: Run lazy_tensor_core e2e integration tests if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }} run: | export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir" echo "LTC tests disabled temporarily. https://github.com/llvm/torch-mlir/pull/1292" - # python -m e2e_testing.torchscript.main --config=lazy_tensor_core -v + # python -m e2e_testing.main --config=lazy_tensor_core -v diff --git a/build_tools/torchscript_e2e_heavydep_tests/README.md b/build_tools/torchscript_e2e_heavydep_tests/README.md index e469ef122..5c7a34bce 100644 --- a/build_tools/torchscript_e2e_heavydep_tests/README.md +++ b/build_tools/torchscript_e2e_heavydep_tests/README.md @@ -13,19 +13,19 @@ self-contained virtual environment. It can be used like so: # serialized test artifacts in the other specified directory. # This command is safe to re-run if you have already built the virtual # environment and just changed the tests. -build_tools/torchscript_e2e_heavydep_tests/generate_serialized_tests.sh \ +build_tools/e2e_heavydep_tests/generate_serialized_tests.sh \ path/to/heavydep_venv \ path/to/heavydep_serialized_tests # Add the --serialized-test-dir flag to point at the directory containing the # serialized tests. All other functionality is the same as the normal invocation -# of torchscript_e2e_test.sh, but the serialized tests will be available. -tools/torchscript_e2e_test.sh --serialized-test-dir=path/to/heavydep_serialized_tests +# of e2e_test.sh, but the serialized tests will be available. +tools/e2e_test.sh --serialized-test-dir=path/to/heavydep_serialized_tests ``` The tests use the same (pure-Python) test framework as the normal -torchscript_e2e_test.sh, but the tests are added in -`build_tools/torchscript_e2e_heavydep_tests` instead of +e2e_test.sh, but the tests are added in +`build_tools/e2e_heavydep_tests` instead of `frontends/pytorch/e2e_testing/torchscript`. We rely critically on serialized TorchScript compatibility across PyTorch diff --git a/build_tools/torchscript_e2e_heavydep_tests/generate_serialized_tests.sh b/build_tools/torchscript_e2e_heavydep_tests/generate_serialized_tests.sh index aa0d42953..ddda4d9a6 100755 --- a/build_tools/torchscript_e2e_heavydep_tests/generate_serialized_tests.sh +++ b/build_tools/torchscript_e2e_heavydep_tests/generate_serialized_tests.sh @@ -38,4 +38,4 @@ cd "$torch_mlir_src_root" export PYTHONPATH=${PYTHONPATH-} source "$torch_mlir_src_root/.env" -python3 -m build_tools.torchscript_e2e_heavydep_tests.main --output_dir="$serialized_test_dir" +python3 -m build_tools.e2e_heavydep_tests.main --output_dir="$serialized_test_dir" diff --git a/build_tools/torchscript_e2e_heavydep_tests/hf_sequence_classification.py b/build_tools/torchscript_e2e_heavydep_tests/hf_sequence_classification.py index 8f1f834be..f387dafca 100644 --- a/build_tools/torchscript_e2e_heavydep_tests/hf_sequence_classification.py +++ b/build_tools/torchscript_e2e_heavydep_tests/hf_sequence_classification.py @@ -6,9 +6,9 @@ import torch from transformers import AutoTokenizer, AutoModelForSequenceClassification -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export torch.manual_seed(0) diff --git a/build_tools/torchscript_e2e_heavydep_tests/main.py b/build_tools/torchscript_e2e_heavydep_tests/main.py index 48a409495..28e374628 100644 --- a/build_tools/torchscript_e2e_heavydep_tests/main.py +++ b/build_tools/torchscript_e2e_heavydep_tests/main.py @@ -5,7 +5,7 @@ import argparse -from torch_mlir_e2e_test.torchscript.serialization import serialize_all_tests_to +from torch_mlir_e2e_test.serialization import serialize_all_tests_to from . import hf_sequence_classification from . import vision_models diff --git a/build_tools/torchscript_e2e_heavydep_tests/train_models.py b/build_tools/torchscript_e2e_heavydep_tests/train_models.py index 29f5c4a8f..d4d9e3999 100644 --- a/build_tools/torchscript_e2e_heavydep_tests/train_models.py +++ b/build_tools/torchscript_e2e_heavydep_tests/train_models.py @@ -9,9 +9,9 @@ from functorch import make_fx from torch.nn.utils import _stateless from transformers import AutoTokenizer, AutoModelForSequenceClassification -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export from torch import fx import copy diff --git a/build_tools/torchscript_e2e_heavydep_tests/vision_models.py b/build_tools/torchscript_e2e_heavydep_tests/vision_models.py index 59ca23e12..71043eb98 100644 --- a/build_tools/torchscript_e2e_heavydep_tests/vision_models.py +++ b/build_tools/torchscript_e2e_heavydep_tests/vision_models.py @@ -6,9 +6,9 @@ import torch import torchvision.models as models -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export import timm torch.manual_seed(0) diff --git a/docs/development.md b/docs/development.md index ddd7777cc..231b9aba9 100644 --- a/docs/development.md +++ b/docs/development.md @@ -205,11 +205,11 @@ Torch-MLIR has two types of tests: ```shell # Run all tests on the reference backend -./tools/torchscript_e2e_test.sh +./tools/e2e_test.sh # Run tests that match the regex `Conv2d`, with verbose errors. -./tools/torchscript_e2e_test.sh --filter Conv2d --verbose +./tools/e2e_test.sh --filter Conv2d --verbose # Run tests on the TOSA backend. -./tools/torchscript_e2e_test.sh --config tosa +./tools/e2e_test.sh --config tosa ``` ## Running unit tests. @@ -310,10 +310,10 @@ Here are some examples of PRs updating the LLVM and MLIR-HLO submodules: To enable ASAN, pass `-DLLVM_USE_SANITIZER=Address` to CMake. This should "just work" with all C++ tools like `torch-mlir-opt`. When running a Python script -such as through `./tools/torchscript_e2e_test.sh`, you will need to do: +such as through `./tools/e2e_test.sh`, you will need to do: ``` -LD_PRELOAD="$(clang -print-file-name=libclang_rt.asan-x86_64.so)" ./tools/torchscript_e2e_test.sh -s +LD_PRELOAD="$(clang -print-file-name=libclang_rt.asan-x86_64.so)" ./tools/e2e_test.sh -s # See instructions here for how to get the libasan path for GCC: # https://stackoverflow.com/questions/48833176/get-location-of-libasan-from-gcc-clang ``` diff --git a/e2e_testing/torchscript/main.py b/e2e_testing/main.py similarity index 92% rename from e2e_testing/torchscript/main.py rename to e2e_testing/main.py index 3c1e85bcd..623a7739d 100644 --- a/e2e_testing/torchscript/main.py +++ b/e2e_testing/main.py @@ -7,14 +7,14 @@ import argparse import re import sys -from torch_mlir_e2e_test.torchscript.framework import run_tests -from torch_mlir_e2e_test.torchscript.reporting import report_results -from torch_mlir_e2e_test.torchscript.registry import GLOBAL_TEST_REGISTRY -from torch_mlir_e2e_test.torchscript.serialization import deserialize_all_tests_from +from torch_mlir_e2e_test.framework import run_tests +from torch_mlir_e2e_test.reporting import report_results +from torch_mlir_e2e_test.registry import GLOBAL_TEST_REGISTRY +from torch_mlir_e2e_test.serialization import deserialize_all_tests_from # Available test configs. -from torch_mlir_e2e_test.torchscript.configs import ( +from torch_mlir_e2e_test.configs import ( LazyTensorCoreTestConfig, LinalgOnTensorsBackendTestConfig, MhloBackendTestConfig, @@ -62,7 +62,7 @@ The directory containing serialized pre-built tests. Right now, these are additional tests which require heavy Python dependencies to generate (or cannot even be generated with the version of PyTorch used by torch-mlir). -See `build_tools/torchscript_e2e_heavydep_tests/generate_serialized_tests.sh` +See `build_tools/e2e_heavydep_tests/generate_serialized_tests.sh` for more information on building these artifacts. ''') parser.add_argument('-s', '--sequential', diff --git a/e2e_testing/torchscript/xfail_sets.py b/e2e_testing/xfail_sets.py similarity index 100% rename from e2e_testing/torchscript/xfail_sets.py rename to e2e_testing/xfail_sets.py diff --git a/python/test/annotations-sugar.py b/python/test/annotations-sugar.py index 60171daf6..98cbec74d 100644 --- a/python/test/annotations-sugar.py +++ b/python/test/annotations-sugar.py @@ -7,7 +7,7 @@ import torch -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.annotations import annotate_args, export from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator from torch_mlir.dialects.torch.importer.jit_ir.torchscript_annotations import extract_annotations diff --git a/python/test/torchscript_e2e_test/basic.py b/python/test/torchscript_e2e_test/basic.py index 438468c20..fa3f6f297 100644 --- a/python/test/torchscript_e2e_test/basic.py +++ b/python/test/torchscript_e2e_test/basic.py @@ -7,10 +7,10 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import run_tests, TestUtils -from torch_mlir_e2e_test.torchscript.reporting import report_results -from torch_mlir_e2e_test.torchscript.registry import register_test_case, GLOBAL_TEST_REGISTRY -from torch_mlir_e2e_test.torchscript.configs import TorchScriptTestConfig +from torch_mlir_e2e_test.framework import run_tests, TestUtils +from torch_mlir_e2e_test.reporting import report_results +from torch_mlir_e2e_test.registry import register_test_case, GLOBAL_TEST_REGISTRY +from torch_mlir_e2e_test.configs import TorchScriptTestConfig class MmModule(torch.nn.Module): diff --git a/python/test/torchscript_e2e_test/compilation_failure.py b/python/test/torchscript_e2e_test/compilation_failure.py index a47750caa..b53f31c49 100644 --- a/python/test/torchscript_e2e_test/compilation_failure.py +++ b/python/test/torchscript_e2e_test/compilation_failure.py @@ -7,10 +7,10 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import run_tests, TestUtils -from torch_mlir_e2e_test.torchscript.reporting import report_results -from torch_mlir_e2e_test.torchscript.registry import register_test_case, GLOBAL_TEST_REGISTRY -from torch_mlir_e2e_test.torchscript.configs import TorchScriptTestConfig +from torch_mlir_e2e_test.framework import run_tests, TestUtils +from torch_mlir_e2e_test.reporting import report_results +from torch_mlir_e2e_test.registry import register_test_case, GLOBAL_TEST_REGISTRY +from torch_mlir_e2e_test.configs import TorchScriptTestConfig class MmModule(torch.nn.Module): diff --git a/python/test/torchscript_e2e_test/error_reports.py b/python/test/torchscript_e2e_test/error_reports.py index af0d00999..f33212859 100644 --- a/python/test/torchscript_e2e_test/error_reports.py +++ b/python/test/torchscript_e2e_test/error_reports.py @@ -9,10 +9,10 @@ from typing import List, Tuple, Dict import torch -from torch_mlir_e2e_test.torchscript.framework import run_tests, TestUtils -from torch_mlir_e2e_test.torchscript.reporting import report_results -from torch_mlir_e2e_test.torchscript.registry import register_test_case, GLOBAL_TEST_REGISTRY -from torch_mlir_e2e_test.torchscript.configs import TorchScriptTestConfig +from torch_mlir_e2e_test.framework import run_tests, TestUtils +from torch_mlir_e2e_test.reporting import report_results +from torch_mlir_e2e_test.registry import register_test_case, GLOBAL_TEST_REGISTRY +from torch_mlir_e2e_test.configs import TorchScriptTestConfig # CHECK: Unexpected outcome summary: # CHECK: FAIL - "ErroneousModule_basic" diff --git a/python/test/torchscript_e2e_test/non_tensor_values.py b/python/test/torchscript_e2e_test/non_tensor_values.py index b5edc8335..a1c8c5adf 100644 --- a/python/test/torchscript_e2e_test/non_tensor_values.py +++ b/python/test/torchscript_e2e_test/non_tensor_values.py @@ -9,10 +9,10 @@ from typing import List, Tuple, Dict import torch -from torch_mlir_e2e_test.torchscript.framework import run_tests, TestUtils -from torch_mlir_e2e_test.torchscript.reporting import report_results -from torch_mlir_e2e_test.torchscript.registry import register_test_case, GLOBAL_TEST_REGISTRY -from torch_mlir_e2e_test.torchscript.configs import TorchScriptTestConfig +from torch_mlir_e2e_test.framework import run_tests, TestUtils +from torch_mlir_e2e_test.reporting import report_results +from torch_mlir_e2e_test.registry import register_test_case, GLOBAL_TEST_REGISTRY +from torch_mlir_e2e_test.configs import TorchScriptTestConfig class NonTensorValuesModule(torch.nn.Module): diff --git a/python/test/torchscript_e2e_test/runtime_failure.py b/python/test/torchscript_e2e_test/runtime_failure.py index 9bdd602ad..3581c1b6d 100644 --- a/python/test/torchscript_e2e_test/runtime_failure.py +++ b/python/test/torchscript_e2e_test/runtime_failure.py @@ -7,10 +7,10 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import run_tests, TestUtils -from torch_mlir_e2e_test.torchscript.reporting import report_results -from torch_mlir_e2e_test.torchscript.registry import register_test_case, GLOBAL_TEST_REGISTRY -from torch_mlir_e2e_test.torchscript.configs import TorchScriptTestConfig +from torch_mlir_e2e_test.framework import run_tests, TestUtils +from torch_mlir_e2e_test.reporting import report_results +from torch_mlir_e2e_test.registry import register_test_case, GLOBAL_TEST_REGISTRY +from torch_mlir_e2e_test.configs import TorchScriptTestConfig class MmModule(torch.nn.Module): diff --git a/python/test/torchscript_e2e_test/submodule.py b/python/test/torchscript_e2e_test/submodule.py index fa157b531..c88ad53b3 100644 --- a/python/test/torchscript_e2e_test/submodule.py +++ b/python/test/torchscript_e2e_test/submodule.py @@ -7,10 +7,10 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import run_tests, TestUtils -from torch_mlir_e2e_test.torchscript.reporting import report_results -from torch_mlir_e2e_test.torchscript.registry import register_test_case, GLOBAL_TEST_REGISTRY -from torch_mlir_e2e_test.torchscript.configs import TorchScriptTestConfig +from torch_mlir_e2e_test.framework import run_tests, TestUtils +from torch_mlir_e2e_test.reporting import report_results +from torch_mlir_e2e_test.registry import register_test_case, GLOBAL_TEST_REGISTRY +from torch_mlir_e2e_test.configs import TorchScriptTestConfig class Submodule2(torch.nn.Module): def __init__(self): diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py b/python/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py index 660063195..d495dda48 100644 --- a/python/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py +++ b/python/torch_mlir/dialects/torch/importer/jit_ir/torchscript_annotations.py @@ -18,7 +18,7 @@ from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator # to be expressed conveniently and gives clearer error reports when # the annotations aren't acceptable. -# This module is kept separate from torch_mlir_e2e_test.torchscript.annotations so that +# This module is kept separate from torch_mlir_e2e_test.annotations so that # we can use that module from code without C++ dependencies, which prevent us # from interfacing the test framework across environments. diff --git a/python/torch_mlir_e2e_test/torchscript/annotations.py b/python/torch_mlir_e2e_test/annotations.py similarity index 100% rename from python/torch_mlir_e2e_test/torchscript/annotations.py rename to python/torch_mlir_e2e_test/annotations.py diff --git a/python/torch_mlir_e2e_test/torchscript/configs/__init__.py b/python/torch_mlir_e2e_test/configs/__init__.py similarity index 100% rename from python/torch_mlir_e2e_test/torchscript/configs/__init__.py rename to python/torch_mlir_e2e_test/configs/__init__.py diff --git a/python/torch_mlir_e2e_test/torchscript/configs/eager_mode.py b/python/torch_mlir_e2e_test/configs/eager_mode.py similarity index 96% rename from python/torch_mlir_e2e_test/torchscript/configs/eager_mode.py rename to python/torch_mlir_e2e_test/configs/eager_mode.py index 2a81702b8..157ef0f36 100644 --- a/python/torch_mlir_e2e_test/torchscript/configs/eager_mode.py +++ b/python/torch_mlir_e2e_test/configs/eager_mode.py @@ -7,7 +7,7 @@ import torch from torch.utils._pytree import tree_map from torch_mlir.eager_mode.torch_mlir_tensor import TorchMLIRTensor -from torch_mlir_e2e_test.torchscript.framework import TestConfig, Trace, TraceItem +from torch_mlir_e2e_test.framework import TestConfig, Trace, TraceItem def wrap(e): diff --git a/python/torch_mlir_e2e_test/torchscript/configs/lazy_tensor_core.py b/python/torch_mlir_e2e_test/configs/lazy_tensor_core.py similarity index 94% rename from python/torch_mlir_e2e_test/torchscript/configs/lazy_tensor_core.py rename to python/torch_mlir_e2e_test/configs/lazy_tensor_core.py index 50b84e49a..29842ccfc 100644 --- a/python/torch_mlir_e2e_test/torchscript/configs/lazy_tensor_core.py +++ b/python/torch_mlir_e2e_test/configs/lazy_tensor_core.py @@ -7,7 +7,7 @@ import torch_mlir._mlir_libs._REFERENCE_LAZY_BACKEND as lazy_backend import torch from torch.utils._pytree import tree_map -from torch_mlir_e2e_test.torchscript.framework import TestConfig, Trace, TraceItem +from torch_mlir_e2e_test.framework import TestConfig, Trace, TraceItem def to_device(device): diff --git a/python/torch_mlir_e2e_test/torchscript/configs/linalg_on_tensors_backend.py b/python/torch_mlir_e2e_test/configs/linalg_on_tensors_backend.py similarity index 95% rename from python/torch_mlir_e2e_test/torchscript/configs/linalg_on_tensors_backend.py rename to python/torch_mlir_e2e_test/configs/linalg_on_tensors_backend.py index d846c200d..6ad41dd6d 100644 --- a/python/torch_mlir_e2e_test/torchscript/configs/linalg_on_tensors_backend.py +++ b/python/torch_mlir_e2e_test/configs/linalg_on_tensors_backend.py @@ -9,7 +9,7 @@ import torch import torch_mlir from torch_mlir_e2e_test.linalg_on_tensors_backends.abc import LinalgOnTensorsBackend -from torch_mlir_e2e_test.torchscript.framework import TestConfig, Trace, TraceItem +from torch_mlir_e2e_test.framework import TestConfig, Trace, TraceItem from torch_mlir_e2e_test.utils import convert_annotations_to_placeholders from .utils import ( diff --git a/python/torch_mlir_e2e_test/torchscript/configs/mhlo_backend.py b/python/torch_mlir_e2e_test/configs/mhlo_backend.py similarity index 96% rename from python/torch_mlir_e2e_test/torchscript/configs/mhlo_backend.py rename to python/torch_mlir_e2e_test/configs/mhlo_backend.py index ecbcba469..0b7b32534 100644 --- a/python/torch_mlir_e2e_test/torchscript/configs/mhlo_backend.py +++ b/python/torch_mlir_e2e_test/configs/mhlo_backend.py @@ -9,7 +9,7 @@ import torch import torch_mlir from torch_mlir_e2e_test.mhlo_backends.abc import MhloBackend -from torch_mlir_e2e_test.torchscript.framework import ( +from torch_mlir_e2e_test.framework import ( TestConfig, Trace, TraceItem diff --git a/python/torch_mlir_e2e_test/torchscript/configs/native_torch.py b/python/torch_mlir_e2e_test/configs/native_torch.py similarity index 92% rename from python/torch_mlir_e2e_test/torchscript/configs/native_torch.py rename to python/torch_mlir_e2e_test/configs/native_torch.py index 06115b34a..b85353f65 100644 --- a/python/torch_mlir_e2e_test/torchscript/configs/native_torch.py +++ b/python/torch_mlir_e2e_test/configs/native_torch.py @@ -8,7 +8,7 @@ from typing import Any import torch -from torch_mlir_e2e_test.torchscript.framework import TestConfig, Trace, TraceItem +from torch_mlir_e2e_test.framework import TestConfig, Trace, TraceItem class NativeTorchTestConfig(TestConfig): diff --git a/python/torch_mlir_e2e_test/torchscript/configs/torchscript.py b/python/torch_mlir_e2e_test/configs/torchscript.py similarity index 93% rename from python/torch_mlir_e2e_test/torchscript/configs/torchscript.py rename to python/torch_mlir_e2e_test/configs/torchscript.py index f79aa92cc..9d105557c 100644 --- a/python/torch_mlir_e2e_test/torchscript/configs/torchscript.py +++ b/python/torch_mlir_e2e_test/configs/torchscript.py @@ -8,7 +8,7 @@ from typing import Any import torch -from torch_mlir_e2e_test.torchscript.framework import TestConfig, Trace, TraceItem +from torch_mlir_e2e_test.framework import TestConfig, Trace, TraceItem class TorchScriptTestConfig(TestConfig): diff --git a/python/torch_mlir_e2e_test/torchscript/configs/tosa_backend.py b/python/torch_mlir_e2e_test/configs/tosa_backend.py similarity index 95% rename from python/torch_mlir_e2e_test/torchscript/configs/tosa_backend.py rename to python/torch_mlir_e2e_test/configs/tosa_backend.py index becfdcdfe..8b41cfeda 100644 --- a/python/torch_mlir_e2e_test/torchscript/configs/tosa_backend.py +++ b/python/torch_mlir_e2e_test/configs/tosa_backend.py @@ -9,7 +9,7 @@ import torch import torch_mlir from torch_mlir_e2e_test.tosa_backends.abc import TosaBackend -from torch_mlir_e2e_test.torchscript.framework import TestConfig, Trace, TraceItem +from torch_mlir_e2e_test.framework import TestConfig, Trace, TraceItem from torch_mlir_e2e_test.utils import convert_annotations_to_placeholders from .utils import ( recursively_convert_to_numpy, diff --git a/python/torch_mlir_e2e_test/torchscript/configs/utils.py b/python/torch_mlir_e2e_test/configs/utils.py similarity index 85% rename from python/torch_mlir_e2e_test/torchscript/configs/utils.py rename to python/torch_mlir_e2e_test/configs/utils.py index 63bbca7b0..c8f912f43 100644 --- a/python/torch_mlir_e2e_test/torchscript/configs/utils.py +++ b/python/torch_mlir_e2e_test/configs/utils.py @@ -3,17 +3,11 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # Also available under a BSD-style license. See LICENSE. -import sys from typing import Any -from io import StringIO import numpy as np import torch -from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder -from torch_mlir.dialects.torch.importer.jit_ir.torchscript_annotations import extract_annotations -from torch_mlir.compiler_utils import run_pipeline_with_repro_report - def recursively_convert_to_numpy(o: Any): if isinstance(o, torch.Tensor): diff --git a/python/torch_mlir_e2e_test/torchscript/framework.py b/python/torch_mlir_e2e_test/framework.py similarity index 100% rename from python/torch_mlir_e2e_test/torchscript/framework.py rename to python/torch_mlir_e2e_test/framework.py diff --git a/python/torch_mlir_e2e_test/torchscript/registry.py b/python/torch_mlir_e2e_test/registry.py similarity index 100% rename from python/torch_mlir_e2e_test/torchscript/registry.py rename to python/torch_mlir_e2e_test/registry.py diff --git a/python/torch_mlir_e2e_test/torchscript/reporting.py b/python/torch_mlir_e2e_test/reporting.py similarity index 100% rename from python/torch_mlir_e2e_test/torchscript/reporting.py rename to python/torch_mlir_e2e_test/reporting.py diff --git a/python/torch_mlir_e2e_test/torchscript/serialization.py b/python/torch_mlir_e2e_test/serialization.py similarity index 100% rename from python/torch_mlir_e2e_test/torchscript/serialization.py rename to python/torch_mlir_e2e_test/serialization.py diff --git a/python/torch_mlir_e2e_test/test_suite/arange.py b/python/torch_mlir_e2e_test/test_suite/arange.py index a22f5efa7..d7ca3b6e2 100644 --- a/python/torch_mlir_e2e_test/test_suite/arange.py +++ b/python/torch_mlir_e2e_test/test_suite/arange.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/argmax.py b/python/torch_mlir_e2e_test/test_suite/argmax.py index 575af604c..098ed508b 100644 --- a/python/torch_mlir_e2e_test/test_suite/argmax.py +++ b/python/torch_mlir_e2e_test/test_suite/argmax.py @@ -4,9 +4,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== @@ -63,4 +63,3 @@ class ArgmaxKeepDimsModule(torch.nn.Module): @register_test_case(module_factory=lambda: ArgmaxKeepDimsModule()) def ArgmaxModule_keepDim(module, tu: TestUtils): module.forward(tu.rand(4, 6)) - diff --git a/python/torch_mlir_e2e_test/test_suite/backprop.py b/python/torch_mlir_e2e_test/test_suite/backprop.py index 5a27bc7d3..bd5a01e59 100644 --- a/python/torch_mlir_e2e_test/test_suite/backprop.py +++ b/python/torch_mlir_e2e_test/test_suite/backprop.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/basic.py b/python/torch_mlir_e2e_test/test_suite/basic.py index 3ec6130d5..70981ead2 100644 --- a/python/torch_mlir_e2e_test/test_suite/basic.py +++ b/python/torch_mlir_e2e_test/test_suite/basic.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/cast.py b/python/torch_mlir_e2e_test/test_suite/cast.py index bbf732329..b6867ad31 100644 --- a/python/torch_mlir_e2e_test/test_suite/cast.py +++ b/python/torch_mlir_e2e_test/test_suite/cast.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== @@ -122,4 +122,3 @@ class TensorToBool(torch.nn.Module): @register_test_case(module_factory=lambda: TensorToBool()) def TensorToBool_basic(module, tu: TestUtils): module.forward(torch.tensor([[1]], dtype=torch.bool)) - diff --git a/python/torch_mlir_e2e_test/test_suite/constant_alloc.py b/python/torch_mlir_e2e_test/test_suite/constant_alloc.py index 149122540..292c0aacf 100644 --- a/python/torch_mlir_e2e_test/test_suite/constant_alloc.py +++ b/python/torch_mlir_e2e_test/test_suite/constant_alloc.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/control_flow.py b/python/torch_mlir_e2e_test/test_suite/control_flow.py index 6893f7137..5c00a75e0 100644 --- a/python/torch_mlir_e2e_test/test_suite/control_flow.py +++ b/python/torch_mlir_e2e_test/test_suite/control_flow.py @@ -7,9 +7,9 @@ from numpy import int64 import torch import random -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/conv.py b/python/torch_mlir_e2e_test/test_suite/conv.py index 5175adf20..66595be84 100644 --- a/python/torch_mlir_e2e_test/test_suite/conv.py +++ b/python/torch_mlir_e2e_test/test_suite/conv.py @@ -4,9 +4,9 @@ # Also available under a BSD-style license. See LICENSE. import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== @@ -704,4 +704,4 @@ class Conv_Transpose3dModule(torch.nn.Module): @register_test_case(module_factory=lambda: Conv_Transpose3dModule()) def Conv_Transpose3dModule_basic(module, tu: TestUtils): - module.forward(torch.randn(5, 2, 5, 6, 4), torch.randn(2, 5, 2, 2, 2)) \ No newline at end of file + module.forward(torch.randn(5, 2, 5, 6, 4), torch.randn(2, 5, 2, 2, 2)) diff --git a/python/torch_mlir_e2e_test/test_suite/custom_op_example.py b/python/torch_mlir_e2e_test/test_suite/custom_op_example.py index c67b7c8d8..3d08708d7 100644 --- a/python/torch_mlir_e2e_test/test_suite/custom_op_example.py +++ b/python/torch_mlir_e2e_test/test_suite/custom_op_example.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== @@ -33,4 +33,3 @@ class CustomOpExampleModule(torch.nn.Module): @register_test_case(module_factory=lambda: CustomOpExampleModule()) def CustomOpExampleModule_basic(module, tu: TestUtils): module.forward(tu.rand(3, 4)) - diff --git a/python/torch_mlir_e2e_test/test_suite/elementwise.py b/python/torch_mlir_e2e_test/test_suite/elementwise.py index 15912be5a..98f0a94fd 100644 --- a/python/torch_mlir_e2e_test/test_suite/elementwise.py +++ b/python/torch_mlir_e2e_test/test_suite/elementwise.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # TODO: Support scalar !torch.int/!torch.float variants. Add support to # ReduceOpVariants to implement them in terms of the tensor-only variants + diff --git a/python/torch_mlir_e2e_test/test_suite/elementwise_comparison.py b/python/torch_mlir_e2e_test/test_suite/elementwise_comparison.py index defd8bc51..89d334628 100644 --- a/python/torch_mlir_e2e_test/test_suite/elementwise_comparison.py +++ b/python/torch_mlir_e2e_test/test_suite/elementwise_comparison.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== @@ -571,4 +571,3 @@ class AllBoolFalseModule(torch.nn.Module): @register_test_case(module_factory=lambda: AllBoolFalseModule()) def AllBoolFalseModule_basic(module, tu: TestUtils): module.forward() - diff --git a/python/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py b/python/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py index 1cec5345a..ca95e36a3 100644 --- a/python/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py +++ b/python/torch_mlir_e2e_test/test_suite/histogram_binning_calibration.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/index_put.py b/python/torch_mlir_e2e_test/test_suite/index_put.py index 70e8b88c7..4fb74511b 100644 --- a/python/torch_mlir_e2e_test/test_suite/index_put.py +++ b/python/torch_mlir_e2e_test/test_suite/index_put.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/index_select.py b/python/torch_mlir_e2e_test/test_suite/index_select.py index c4693cc1a..1bb575ccb 100644 --- a/python/torch_mlir_e2e_test/test_suite/index_select.py +++ b/python/torch_mlir_e2e_test/test_suite/index_select.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/matmul.py b/python/torch_mlir_e2e_test/test_suite/matmul.py index 5b9502cae..e1ecfa6a3 100644 --- a/python/torch_mlir_e2e_test/test_suite/matmul.py +++ b/python/torch_mlir_e2e_test/test_suite/matmul.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/mlp.py b/python/torch_mlir_e2e_test/test_suite/mlp.py index 153f35759..faebcadf3 100644 --- a/python/torch_mlir_e2e_test/test_suite/mlp.py +++ b/python/torch_mlir_e2e_test/test_suite/mlp.py @@ -6,9 +6,9 @@ import torch import torch.nn as nn -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/nll_loss.py b/python/torch_mlir_e2e_test/test_suite/nll_loss.py index bc70fbbec..f5eeb1f2c 100644 --- a/python/torch_mlir_e2e_test/test_suite/nll_loss.py +++ b/python/torch_mlir_e2e_test/test_suite/nll_loss.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/norm_like.py b/python/torch_mlir_e2e_test/test_suite/norm_like.py index f8670654a..e8b006c30 100644 --- a/python/torch_mlir_e2e_test/test_suite/norm_like.py +++ b/python/torch_mlir_e2e_test/test_suite/norm_like.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/pooling.py b/python/torch_mlir_e2e_test/test_suite/pooling.py index 9858a304e..36ad29360 100644 --- a/python/torch_mlir_e2e_test/test_suite/pooling.py +++ b/python/torch_mlir_e2e_test/test_suite/pooling.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/quantized_models.py b/python/torch_mlir_e2e_test/test_suite/quantized_models.py index 7080a25fe..e4a118700 100644 --- a/python/torch_mlir_e2e_test/test_suite/quantized_models.py +++ b/python/torch_mlir_e2e_test/test_suite/quantized_models.py @@ -6,9 +6,9 @@ import torch from torch import nn -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/reduction.py b/python/torch_mlir_e2e_test/test_suite/reduction.py index 6481fd553..1eecb5186 100644 --- a/python/torch_mlir_e2e_test/test_suite/reduction.py +++ b/python/torch_mlir_e2e_test/test_suite/reduction.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/reshape_like.py b/python/torch_mlir_e2e_test/test_suite/reshape_like.py index 0396ca943..a8bdc5859 100644 --- a/python/torch_mlir_e2e_test/test_suite/reshape_like.py +++ b/python/torch_mlir_e2e_test/test_suite/reshape_like.py @@ -4,9 +4,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== @@ -561,4 +561,3 @@ class ReshapeAliasCollapseModule(torch.nn.Module): @register_test_case(module_factory=lambda: ReshapeAliasCollapseModule()) def ReshapeAliasCollapseModule_basic(module, tu: TestUtils): module.forward(tu.rand(2, 4)) - diff --git a/python/torch_mlir_e2e_test/test_suite/return_types.py b/python/torch_mlir_e2e_test/test_suite/return_types.py index 942f9bbd9..2acfacf98 100644 --- a/python/torch_mlir_e2e_test/test_suite/return_types.py +++ b/python/torch_mlir_e2e_test/test_suite/return_types.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/rng.py b/python/torch_mlir_e2e_test/test_suite/rng.py index ea13eadaf..dcbea55dd 100644 --- a/python/torch_mlir_e2e_test/test_suite/rng.py +++ b/python/torch_mlir_e2e_test/test_suite/rng.py @@ -1,8 +1,8 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/scalar.py b/python/torch_mlir_e2e_test/test_suite/scalar.py index 081690efc..cbf17a09a 100644 --- a/python/torch_mlir_e2e_test/test_suite/scalar.py +++ b/python/torch_mlir_e2e_test/test_suite/scalar.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/scalar_comparison.py b/python/torch_mlir_e2e_test/test_suite/scalar_comparison.py index e062b669b..d9d0bd121 100644 --- a/python/torch_mlir_e2e_test/test_suite/scalar_comparison.py +++ b/python/torch_mlir_e2e_test/test_suite/scalar_comparison.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/slice_like.py b/python/torch_mlir_e2e_test/test_suite/slice_like.py index c576d900c..d4dc44ea9 100644 --- a/python/torch_mlir_e2e_test/test_suite/slice_like.py +++ b/python/torch_mlir_e2e_test/test_suite/slice_like.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/squeeze.py b/python/torch_mlir_e2e_test/test_suite/squeeze.py index 0fa63601d..04bf6e97c 100644 --- a/python/torch_mlir_e2e_test/test_suite/squeeze.py +++ b/python/torch_mlir_e2e_test/test_suite/squeeze.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/stats.py b/python/torch_mlir_e2e_test/test_suite/stats.py index ebf9573bb..157b0c3f6 100644 --- a/python/torch_mlir_e2e_test/test_suite/stats.py +++ b/python/torch_mlir_e2e_test/test_suite/stats.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/table_batch_embedding.py b/python/torch_mlir_e2e_test/test_suite/table_batch_embedding.py index 7c53c1a1b..1ed41ffc1 100644 --- a/python/torch_mlir_e2e_test/test_suite/table_batch_embedding.py +++ b/python/torch_mlir_e2e_test/test_suite/table_batch_embedding.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== @@ -58,4 +58,3 @@ def TableBatchEmbeddingModule_basic(module, tu: TestUtils): offsets = torch.cumsum( torch.tensor([0] + [BAG_SIZE for _ in range(BATCH_SIZE - 1)], dtype=torch.int64), 0) module.forward(indices, offsets) - diff --git a/python/torch_mlir_e2e_test/test_suite/threshold.py b/python/torch_mlir_e2e_test/test_suite/threshold.py index ac784abb4..8efa7e7e2 100644 --- a/python/torch_mlir_e2e_test/test_suite/threshold.py +++ b/python/torch_mlir_e2e_test/test_suite/threshold.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/type_conversion.py b/python/torch_mlir_e2e_test/test_suite/type_conversion.py index 2bd0e8b68..cf41631f5 100644 --- a/python/torch_mlir_e2e_test/test_suite/type_conversion.py +++ b/python/torch_mlir_e2e_test/test_suite/type_conversion.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/test_suite/type_promotion.py b/python/torch_mlir_e2e_test/test_suite/type_promotion.py index 94a5ba18f..f2ff36fd8 100644 --- a/python/torch_mlir_e2e_test/test_suite/type_promotion.py +++ b/python/torch_mlir_e2e_test/test_suite/type_promotion.py @@ -5,9 +5,9 @@ import torch -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== @@ -111,5 +111,3 @@ class TypePromotionAlphaWiderModule(torch.nn.Module): @register_test_case(module_factory=lambda: TypePromotionAlphaWiderModule()) def TypePromotionAlphaWiderModule_basic(module, tu: TestUtils): module.forward(tu.rand(4), tu.rand()) - - diff --git a/python/torch_mlir_e2e_test/test_suite/vision_models.py b/python/torch_mlir_e2e_test/test_suite/vision_models.py index c06f1d918..43e81847e 100644 --- a/python/torch_mlir_e2e_test/test_suite/vision_models.py +++ b/python/torch_mlir_e2e_test/test_suite/vision_models.py @@ -6,9 +6,9 @@ import torch import torchvision.models as models -from torch_mlir_e2e_test.torchscript.framework import TestUtils -from torch_mlir_e2e_test.torchscript.registry import register_test_case -from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export +from torch_mlir_e2e_test.framework import TestUtils +from torch_mlir_e2e_test.registry import register_test_case +from torch_mlir_e2e_test.annotations import annotate_args, export # ============================================================================== diff --git a/python/torch_mlir_e2e_test/torchscript/CMakeLists.txt b/python/torch_mlir_e2e_test/torchscript/CMakeLists.txt deleted file mode 100644 index 9316fdb09..000000000 --- a/python/torch_mlir_e2e_test/torchscript/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -## Declare the sources of the Python module. - -declare_mlir_python_sources(TorchMLIRPythonSources.TorchScriptE2ETest - ROOT_DIR "${TORCH_MLIR_PYTHON_ROOT_DIR}" - ADD_TO_PARENT TorchMLIRPythonSources - SOURCES_GLOB - dialects/torch/e2e_test/torchscript/*.py -) diff --git a/python/torch_mlir_e2e_test/torchscript/__init__.py b/python/torch_mlir_e2e_test/torchscript/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/python/torch_mlir_e2e_test/utils.py b/python/torch_mlir_e2e_test/utils.py index 23d7fca84..403c455cb 100644 --- a/python/torch_mlir_e2e_test/utils.py +++ b/python/torch_mlir_e2e_test/utils.py @@ -4,7 +4,7 @@ # Also available under a BSD-style license. See LICENSE. from torch_mlir import TensorPlaceholder -from torch_mlir_e2e_test.torchscript.annotations import TORCH_MLIR_ARG_ANNOTATIONS_ATTR_NAME +from torch_mlir_e2e_test.annotations import TORCH_MLIR_ARG_ANNOTATIONS_ATTR_NAME def convert_annotations_to_placeholders(forward_method): """Converts the annotations on a forward method into tensor placeholders. diff --git a/tools/torchscript_e2e_test.sh b/tools/e2e_test.sh similarity index 82% rename from tools/torchscript_e2e_test.sh rename to tools/e2e_test.sh index 152075e63..cddd1543b 100755 --- a/tools/torchscript_e2e_test.sh +++ b/tools/e2e_test.sh @@ -9,4 +9,4 @@ cd "$src_dir" export PYTHONPATH=${PYTHONPATH-} source .env -python -m e2e_testing.torchscript.main "$@" +python -m e2e_testing.main "$@"