From f331a8e88d965b8ae07eef904ea29195990e0d72 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Sun, 16 Feb 2025 16:55:11 -0500 Subject: [PATCH 1/2] [Task] : Add ci for windows build. --- .github/workflows/ci.yml | 59 +++++++++++++++++++ build_tools/python_deploy/build_windows_ci.sh | 42 ++++++++++++- .../python/fx_importer/sparsity/lit.local.cfg | 2 +- test/python/fx_importer/v2.3/lit.local.cfg | 2 +- test/python/lit.local.cfg | 2 +- 5 files changed, 101 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae0d57f31efa..c58a8cead89f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,3 +79,62 @@ jobs: if: ${{ matrix.torch-version == 'nightly' }} run: | bash build_tools/ci/check_generated_sources.sh + + build-test-windows: + strategy: + fail-fast: true + matrix: + torch-version: [nightly] + name: Build (Windows, torch-${{ matrix.torch-version }}) + runs-on: windows-latest + defaults: + run: + shell: bash + env: + CACHE_DIR: ${{ github.workspace }}\.container-cache + steps: + - name: "Checking out repository" + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true + + - name: Setup workspace + uses: ./.github/actions/setup-build + + - name: Enable cache + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ${{ env.CACHE_DIR }} + key: build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2-${{ github.sha }} + restore-keys: | + build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2- + + - name: "Configuring MSVC" + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + + - name: Install python deps (torch-${{ matrix.torch-version }}) + run: | + ./build_tools/ci/install_python_deps.sh ${{ matrix.torch-version }} + + - name: ccache + uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16 + with: + key: ${{ github.job }}-${{ matrix.torch-version }} + save: ${{ needs.setup.outputs.write-caches == 1 }} + + - name: Build project + run: | + cache_dir="${{ env.CACHE_DIR }}" \ + ./build_tools/python_deploy/build_windows_ci.sh + + - name: Save cache + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + if: ${{ !cancelled() }} + with: + path: ${{ env.CACHE_DIR }} + key: build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2-${{ github.sha }} + + # todo: enable when use of `signal` for timeout is enhanced to be platform-agnostic + # - name: Integration tests (torch-${{ matrix.torch-version }}) + # run: | + # ./build_tools/ci/test_posix.sh ${{ matrix.torch-version }} diff --git a/build_tools/python_deploy/build_windows_ci.sh b/build_tools/python_deploy/build_windows_ci.sh index 2e1648679c57..c678eaf79a04 100644 --- a/build_tools/python_deploy/build_windows_ci.sh +++ b/build_tools/python_deploy/build_windows_ci.sh @@ -1,8 +1,30 @@ #!/usr/bin/env bash -set -eo pipefail +set -eu -o errtrace echo "Building torch-mlir" +cache_dir="${cache_dir:-}" +this_dir="$(cd $(dirname $0) && pwd)" +repo_root="$(cd ${this_dir}/../.. && pwd)" + +# Setup cache dir. +if [ -z "${cache_dir}" ]; then + cache_dir="${repo_root}/.build-cache" + mkdir -p "${cache_dir}" + cache_dir="$(cd ${cache_dir} && pwd)" +fi + +echo "Caching to ${cache_dir}" +mkdir -p "${cache_dir}/ccache" +mkdir -p "${cache_dir}/pip" + +export CCACHE_DIR="${cache_dir}/ccache" +export CCACHE_MAXSIZE="350M" + +# Clear ccache stats. +ccache -z + +echo "::group::CMake configure" cmake -GNinja -Bbuild \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ @@ -14,9 +36,23 @@ cmake -GNinja -Bbuild \ -DLLVM_EXTERNAL_PROJECTS="torch-mlir" \ -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \ -DPython3_EXECUTABLE="$(which python)" \ + -DPython_EXECUTABLE="$(which python)" \ -DTORCH_MLIR_ENABLE_STABLEHLO=OFF \ - $GITHUB_WORKSPACE/externals/llvm-project/llvm + -DTORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS=ON \ + -DTORCH_MLIR_ENABLE_LTC=OFF \ + -DTORCH_MLIR_ENABLE_JIT_IR_IMPORTER=ON \ + ${repo_root}/externals/llvm-project/llvm +echo "::endgroup::" -cmake --build build --config Release +echo "::group::Build" +cmake --build ${repo_root}/build --target tools/torch-mlir/all -- -k 0 +echo "::endgroup::" echo "Build completed successfully" + +echo "::group::Unit tests" +cmake --build ${repo_root}/build --target check-torch-mlir +echo "::endgroup::" + +# Show ccache stats. +ccache --show-stats diff --git a/test/python/fx_importer/sparsity/lit.local.cfg b/test/python/fx_importer/sparsity/lit.local.cfg index 274898b1438a..9477763e1b78 100644 --- a/test/python/fx_importer/sparsity/lit.local.cfg +++ b/test/python/fx_importer/sparsity/lit.local.cfg @@ -2,7 +2,7 @@ config.unsupported = True try: import torch - if "2.5.0" <= str(torch.__version__): + if "2.5.0" <= str(torch.__version__) and "Windows" not in config.host_os: print("Enabling sparsity propagation tests") config.unsupported = False diff --git a/test/python/fx_importer/v2.3/lit.local.cfg b/test/python/fx_importer/v2.3/lit.local.cfg index 312965e07fa7..bd8e251e61c5 100644 --- a/test/python/fx_importer/v2.3/lit.local.cfg +++ b/test/python/fx_importer/v2.3/lit.local.cfg @@ -2,7 +2,7 @@ config.unsupported = True try: import torch - if torch.__version__ >= "2.3.0": + if torch.__version__ >= "2.3.0" and "Windows" not in config.host_os: print("Enabling Torch v2.3+ tests") config.unsupported = False except ModuleNotFoundError: diff --git a/test/python/lit.local.cfg b/test/python/lit.local.cfg index 4cfe04325d94..93124164c7fa 100644 --- a/test/python/lit.local.cfg +++ b/test/python/lit.local.cfg @@ -1,2 +1,2 @@ -if not config.enable_bindings_python: +if not config.enable_bindings_python or "Windows" in config.host_os: config.unsupported = True From 5243bfe5870aea6b1d1f23f9956159c24ec0d59d Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Wed, 5 Mar 2025 08:47:14 -0500 Subject: [PATCH 2/2] [tosa] : Fix LIT test failures on Windows due emission order of tosa.const_shape --- .github/workflows/ci.yml | 59 ----------------- .github/workflows/ci_windows.yml | 77 ++++++++++++++++++++++ test/Conversion/TorchToTosa/basic.mlir | 88 +++++++++++++------------- 3 files changed, 121 insertions(+), 103 deletions(-) create mode 100644 .github/workflows/ci_windows.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c58a8cead89f..ae0d57f31efa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,62 +79,3 @@ jobs: if: ${{ matrix.torch-version == 'nightly' }} run: | bash build_tools/ci/check_generated_sources.sh - - build-test-windows: - strategy: - fail-fast: true - matrix: - torch-version: [nightly] - name: Build (Windows, torch-${{ matrix.torch-version }}) - runs-on: windows-latest - defaults: - run: - shell: bash - env: - CACHE_DIR: ${{ github.workspace }}\.container-cache - steps: - - name: "Checking out repository" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: true - - - name: Setup workspace - uses: ./.github/actions/setup-build - - - name: Enable cache - uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: ${{ env.CACHE_DIR }} - key: build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2-${{ github.sha }} - restore-keys: | - build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2- - - - name: "Configuring MSVC" - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - - - name: Install python deps (torch-${{ matrix.torch-version }}) - run: | - ./build_tools/ci/install_python_deps.sh ${{ matrix.torch-version }} - - - name: ccache - uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16 - with: - key: ${{ github.job }}-${{ matrix.torch-version }} - save: ${{ needs.setup.outputs.write-caches == 1 }} - - - name: Build project - run: | - cache_dir="${{ env.CACHE_DIR }}" \ - ./build_tools/python_deploy/build_windows_ci.sh - - - name: Save cache - uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - if: ${{ !cancelled() }} - with: - path: ${{ env.CACHE_DIR }} - key: build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2-${{ github.sha }} - - # todo: enable when use of `signal` for timeout is enhanced to be platform-agnostic - # - name: Integration tests (torch-${{ matrix.torch-version }}) - # run: | - # ./build_tools/ci/test_posix.sh ${{ matrix.torch-version }} diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml new file mode 100644 index 000000000000..663fbd235431 --- /dev/null +++ b/.github/workflows/ci_windows.yml @@ -0,0 +1,77 @@ +# yamllint disable rule:line-length +name: CI_WINDOWS + +on: + workflow_dispatch: + workflow_call: + push: + branches: [main] + +concurrency: + # A PR number if a pull request and otherwise the commit hash. This cancels + # queued and in-progress runs for the same PR (presubmit) or commit + # (postsubmit). + group: ci-build-test-cpp-windows-${{ github.event.number || github.sha }} + cancel-in-progress: true + +jobs: + + build-test-windows: + strategy: + fail-fast: true + matrix: + torch-version: [nightly] + name: Build (Windows, torch-${{ matrix.torch-version }}) + runs-on: windows-latest + defaults: + run: + shell: bash + env: + CACHE_DIR: ${{ github.workspace }}\.container-cache + steps: + - name: "Checking out repository" + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true + + - name: Setup workspace + uses: ./.github/actions/setup-build + + - name: Enable cache + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ${{ env.CACHE_DIR }} + # Use as cache key a PR number if a pull request and otherwise the commit hash. This reuses the cache for a PR irrespective of the commit hash. Otherwise, it uses commit hash for merges into the main branch + key: build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2-${{ github.event.number || github.sha }} + restore-keys: | + build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2- + + - name: "Configuring MSVC" + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + + - name: Install python deps (torch-${{ matrix.torch-version }}) + run: | + ./build_tools/ci/install_python_deps.sh ${{ matrix.torch-version }} + + - name: ccache + uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16 + with: + key: ${{ github.job }}-${{ matrix.torch-version }} + save: ${{ needs.setup.outputs.write-caches == 1 }} + + - name: Build project + run: | + cache_dir="${{ env.CACHE_DIR }}" \ + ./build_tools/python_deploy/build_windows_ci.sh + + - name: Save cache + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + if: ${{ !cancelled() }} + with: + path: ${{ env.CACHE_DIR }} + key: build-test-cpp-asserts-windows-${{ matrix.torch-version }}-v2-${{ github.event.number || github.sha }} + + # todo: enable when use of `signal` for timeout is enhanced to be platform-agnostic + # - name: Integration tests (torch-${{ matrix.torch-version }}) + # run: | + # ./build_tools/ci/test_posix.sh ${{ matrix.torch-version }} diff --git a/test/Conversion/TorchToTosa/basic.mlir b/test/Conversion/TorchToTosa/basic.mlir index 6b5ee5fb533b..a93529c61cca 100644 --- a/test/Conversion/TorchToTosa/basic.mlir +++ b/test/Conversion/TorchToTosa/basic.mlir @@ -1261,8 +1261,8 @@ func.func @torch.aten.Scalar$basic(%arg0: !torch.vtensor<[1,1,128,128],si64>) -> // CHECK: %[[VAL_3:.*]] = torch.constant.int 1 // CHECK: %[[VAL_4:.*]] = torch.constant.int 100 // CHECK: %[[VAL_5:.*]] = torch.constant.int -16 -// CHECK: %[[VAL_6:.*]] = tosa.const_shape {value = dense<[0, 49, 0]> : tensor<3xindex>} : () -> !tosa.shape<3> -// CHECK: %[[VAL_7:.*]] = tosa.const_shape {value = dense<[4, 16, 256]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_6:.*]] = tosa.const_shape {value = dense<[0, 49, 0]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_7:.*]] = tosa.const_shape {value = dense<[4, 16, 256]> : tensor<3xindex>} : () -> !tosa.shape<3> // CHECK: %[[VAL_8:.*]] = tosa.slice %[[VAL_1]], %[[VAL_6]], %[[VAL_7]] : (tensor<4x65x256xf32>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<4x16x256xf32> // CHECK: %[[VAL_9:.*]] = torch_c.from_builtin_tensor %[[VAL_8]] : tensor<4x16x256xf32> -> !torch.vtensor<[4,16,256],f32> // CHECK: return %[[VAL_9]] : !torch.vtensor<[4,16,256],f32> @@ -2087,8 +2087,8 @@ func.func @torch.aten.bitwise_right_shift.Tensor$basic(%arg0: !torch.vtensor<[?, // CHECK: %[[VAL_6:.*]] = "tosa.const"() <{value = dense<{{\[\[}}{{\[\[}}0, 0, 0], [0, 0, 0], [1, 0, 0], [0, 1, 0]]]]> : tensor<1x1x4x3xi32>}> : () -> tensor<1x1x4x3xi32> // CHECK: %[[VAL_7:.*]] = "tosa.const"() <{value = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8> // CHECK: %[[VAL_8:.*]] = tosa.mul %[[VAL_5]], %[[VAL_6]], %[[VAL_7]] : (tensor<5x6x4x3xi32>, tensor<1x1x4x3xi32>, tensor<1xi8>) -> tensor<5x6x4x3xi32> -// CHECK: %[[VAL_9:.*]] = tosa.const_shape {value = dense<[0, 0, 2, 0]> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_10:.*]] = tosa.const_shape {value = dense<[5, 6, 2, 3]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_9:.*]] = tosa.const_shape {value = dense<[0, 0, 2, 0]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_10:.*]] = tosa.const_shape {value = dense<[5, 6, 2, 3]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_11:.*]] = tosa.slice %[[VAL_8]], %[[VAL_9]], %[[VAL_10]] : (tensor<5x6x4x3xi32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<5x6x2x3xi32> // CHECK: %[[VAL_12:.*]] = tosa.reduce_sum %[[VAL_11]] {axis = 3 : i32} : (tensor<5x6x2x3xi32>) -> tensor<5x6x2x1xi32> // CHECK: %[[VAL_13:.*]] = tosa.const_shape {value = dense<[5, 6, 2]> : tensor<3xindex>} : () -> !tosa.shape<3> @@ -2781,12 +2781,12 @@ func.func @torch.aten.avg_pool1d.count_include_pad_unsupported_value(%arg0: !tor // CHECK: %[[VAL_2:.*]] = torch.constant.int 3 // CHECK: %[[VAL_3:.*]] = torch.constant.int 1 // CHECK: %[[VAL_4:.*]] = torch.prim.ListConstruct %[[VAL_2]], %[[VAL_3]] : (!torch.int, !torch.int) -> !torch.list -// CHECK: %[[VAL_5:.*]] = tosa.const_shape {value = dense<[0, 0, 1]> : tensor<3xindex>} : () -> !tosa.shape<3> -// CHECK: %[[VAL_6:.*]] = tosa.const_shape {value = dense<[1, 2, 3]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_5:.*]] = tosa.const_shape {value = dense<[0, 0, 1]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_6:.*]] = tosa.const_shape {value = dense<[1, 2, 3]> : tensor<3xindex>} : () -> !tosa.shape<3> // CHECK: %[[VAL_7:.*]] = tosa.slice %[[VAL_1]], %[[VAL_5]], %[[VAL_6]] : (tensor<1x2x4xf32>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<1x2x3xf32> // CHECK: %[[VAL_8:.*]] = tosa.reverse %[[VAL_7]] {axis = 2 : i32} : (tensor<1x2x3xf32>) -> tensor<1x2x3xf32> -// CHECK: %[[VAL_9:.*]] = tosa.const_shape {value = dense<[0, 0, 2]> : tensor<3xindex>} : () -> !tosa.shape<3> -// CHECK: %[[VAL_10:.*]] = tosa.const_shape {value = dense<[1, 2, 1]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_9:.*]] = tosa.const_shape {value = dense<[0, 0, 2]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_10:.*]] = tosa.const_shape {value = dense<[1, 2, 1]> : tensor<3xindex>} : () -> !tosa.shape<3> // CHECK: %[[VAL_11:.*]] = tosa.slice %[[VAL_1]], %[[VAL_9]], %[[VAL_10]] : (tensor<1x2x4xf32>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<1x2x1xf32> // CHECK: %[[VAL_12:.*]] = tosa.reverse %[[VAL_11]] {axis = 2 : i32} : (tensor<1x2x1xf32>) -> tensor<1x2x1xf32> // CHECK: %[[VAL_13:.*]] = tosa.concat %[[VAL_8]], %[[VAL_1]], %[[VAL_12]] {axis = 2 : i32} : (tensor<1x2x3xf32>, tensor<1x2x4xf32>, tensor<1x2x1xf32>) -> tensor<1x2x8xf32> @@ -2808,21 +2808,21 @@ func.func @torch.aten.reflection_pad1d$basic(%arg0: !torch.vtensor<[1,2,4],f32>) // CHECK: %[[VAL_1:.*]] = torch_c.to_builtin_tensor %[[VAL_0]] : !torch.vtensor<[1,20,20],f32> -> tensor<1x20x20xf32> // CHECK: %[[VAL_2:.*]] = torch.constant.int 10 // CHECK: %[[VAL_3:.*]] = torch.prim.ListConstruct %[[VAL_2]], %[[VAL_2]], %[[VAL_2]], %[[VAL_2]] : (!torch.int, !torch.int, !torch.int, !torch.int) -> !torch.list -// CHECK: %[[VAL_4:.*]] = tosa.const_shape {value = dense<[0, 0, 1]> : tensor<3xindex>} : () -> !tosa.shape<3> -// CHECK: %[[VAL_5:.*]] = tosa.const_shape {value = dense<[1, 20, 10]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_4:.*]] = tosa.const_shape {value = dense<[0, 0, 1]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_5:.*]] = tosa.const_shape {value = dense<[1, 20, 10]> : tensor<3xindex>} : () -> !tosa.shape<3> // CHECK: %[[VAL_6:.*]] = tosa.slice %[[VAL_1]], %[[VAL_4]], %[[VAL_5]] : (tensor<1x20x20xf32>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<1x20x10xf32> // CHECK: %[[VAL_7:.*]] = tosa.reverse %[[VAL_6]] {axis = 2 : i32} : (tensor<1x20x10xf32>) -> tensor<1x20x10xf32> -// CHECK: %[[VAL_8:.*]] = tosa.const_shape {value = dense<[0, 0, 9]> : tensor<3xindex>} : () -> !tosa.shape<3> -// CHECK: %[[VAL_9:.*]] = tosa.const_shape {value = dense<[1, 20, 10]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_8:.*]] = tosa.const_shape {value = dense<[0, 0, 9]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_9:.*]] = tosa.const_shape {value = dense<[1, 20, 10]> : tensor<3xindex>} : () -> !tosa.shape<3> // CHECK: %[[VAL_10:.*]] = tosa.slice %[[VAL_1]], %[[VAL_8]], %[[VAL_9]] : (tensor<1x20x20xf32>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<1x20x10xf32> // CHECK: %[[VAL_11:.*]] = tosa.reverse %[[VAL_10]] {axis = 2 : i32} : (tensor<1x20x10xf32>) -> tensor<1x20x10xf32> // CHECK: %[[VAL_12:.*]] = tosa.concat %[[VAL_7]], %[[VAL_1]], %[[VAL_11]] {axis = 2 : i32} : (tensor<1x20x10xf32>, tensor<1x20x20xf32>, tensor<1x20x10xf32>) -> tensor<1x20x40xf32> -// CHECK: %[[VAL_13:.*]] = tosa.const_shape {value = dense<[0, 1, 0]> : tensor<3xindex>} : () -> !tosa.shape<3> -// CHECK: %[[VAL_14:.*]] = tosa.const_shape {value = dense<[1, 10, 40]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_13:.*]] = tosa.const_shape {value = dense<[0, 1, 0]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_14:.*]] = tosa.const_shape {value = dense<[1, 10, 40]> : tensor<3xindex>} : () -> !tosa.shape<3> // CHECK: %[[VAL_15:.*]] = tosa.slice %[[VAL_12]], %[[VAL_13]], %[[VAL_14]] : (tensor<1x20x40xf32>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<1x10x40xf32> // CHECK: %[[VAL_16:.*]] = tosa.reverse %[[VAL_15]] {axis = 1 : i32} : (tensor<1x10x40xf32>) -> tensor<1x10x40xf32> -// CHECK: %[[VAL_17:.*]] = tosa.const_shape {value = dense<[0, 9, 0]> : tensor<3xindex>} : () -> !tosa.shape<3> -// CHECK: %[[VAL_18:.*]] = tosa.const_shape {value = dense<[1, 10, 40]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_17:.*]] = tosa.const_shape {value = dense<[0, 9, 0]> : tensor<3xindex>} : () -> !tosa.shape<3> +// CHECK-DAG: %[[VAL_18:.*]] = tosa.const_shape {value = dense<[1, 10, 40]> : tensor<3xindex>} : () -> !tosa.shape<3> // CHECK: %[[VAL_19:.*]] = tosa.slice %[[VAL_12]], %[[VAL_17]], %[[VAL_18]] : (tensor<1x20x40xf32>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<1x10x40xf32> // CHECK: %[[VAL_20:.*]] = tosa.reverse %[[VAL_19]] {axis = 1 : i32} : (tensor<1x10x40xf32>) -> tensor<1x10x40xf32> // CHECK: %[[VAL_21:.*]] = tosa.concat %[[VAL_16]], %[[VAL_12]], %[[VAL_20]] {axis = 1 : i32} : (tensor<1x10x40xf32>, tensor<1x20x40xf32>, tensor<1x10x40xf32>) -> tensor<1x40x40xf32> @@ -2843,30 +2843,30 @@ func.func @torch.aten.reflection_pad2d$basic(%arg0: !torch.vtensor<[1,20,20],f32 // CHECK: %[[VAL_1:.*]] = torch_c.to_builtin_tensor %[[VAL_0]] : !torch.vtensor<[4,5,7,3,4],f32> -> tensor<4x5x7x3x4xf32> // CHECK: %[[VAL_2:.*]] = torch.constant.int 2 // CHECK: %[[VAL_3:.*]] = torch.prim.ListConstruct %[[VAL_2]], %[[VAL_2]], %[[VAL_2]], %[[VAL_2]], %[[VAL_2]], %[[VAL_2]] : (!torch.int, !torch.int, !torch.int, !torch.int, !torch.int, !torch.int) -> !torch.list -// CHECK: %[[VAL_4:.*]] = tosa.const_shape {value = dense<[0, 0, 0, 0, 1]> : tensor<5xindex>} : () -> !tosa.shape<5> -// CHECK: %[[VAL_5:.*]] = tosa.const_shape {value = dense<[4, 5, 7, 3, 2]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_4:.*]] = tosa.const_shape {value = dense<[0, 0, 0, 0, 1]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_5:.*]] = tosa.const_shape {value = dense<[4, 5, 7, 3, 2]> : tensor<5xindex>} : () -> !tosa.shape<5> // CHECK: %[[VAL_6:.*]] = tosa.slice %[[VAL_1]], %[[VAL_4]], %[[VAL_5]] : (tensor<4x5x7x3x4xf32>, !tosa.shape<5>, !tosa.shape<5>) -> tensor<4x5x7x3x2xf32> // CHECK: %[[VAL_7:.*]] = tosa.reverse %[[VAL_6]] {axis = 4 : i32} : (tensor<4x5x7x3x2xf32>) -> tensor<4x5x7x3x2xf32> -// CHECK: %[[VAL_8:.*]] = tosa.const_shape {value = dense<[0, 0, 0, 0, 1]> : tensor<5xindex>} : () -> !tosa.shape<5> -// CHECK: %[[VAL_9:.*]] = tosa.const_shape {value = dense<[4, 5, 7, 3, 2]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_8:.*]] = tosa.const_shape {value = dense<[0, 0, 0, 0, 1]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_9:.*]] = tosa.const_shape {value = dense<[4, 5, 7, 3, 2]> : tensor<5xindex>} : () -> !tosa.shape<5> // CHECK: %[[VAL_10:.*]] = tosa.slice %[[VAL_1]], %[[VAL_8]], %[[VAL_9]] : (tensor<4x5x7x3x4xf32>, !tosa.shape<5>, !tosa.shape<5>) -> tensor<4x5x7x3x2xf32> // CHECK: %[[VAL_11:.*]] = tosa.reverse %[[VAL_10]] {axis = 4 : i32} : (tensor<4x5x7x3x2xf32>) -> tensor<4x5x7x3x2xf32> // CHECK: %[[VAL_12:.*]] = tosa.concat %[[VAL_7]], %[[VAL_1]], %[[VAL_11]] {axis = 4 : i32} : (tensor<4x5x7x3x2xf32>, tensor<4x5x7x3x4xf32>, tensor<4x5x7x3x2xf32>) -> tensor<4x5x7x3x8xf32> -// CHECK: %[[VAL_13:.*]] = tosa.const_shape {value = dense<[0, 0, 0, 1, 0]> : tensor<5xindex>} : () -> !tosa.shape<5> -// CHECK: %[[VAL_14:.*]] = tosa.const_shape {value = dense<[4, 5, 7, 2, 8]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_13:.*]] = tosa.const_shape {value = dense<[0, 0, 0, 1, 0]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_14:.*]] = tosa.const_shape {value = dense<[4, 5, 7, 2, 8]> : tensor<5xindex>} : () -> !tosa.shape<5> // CHECK: %[[VAL_15:.*]] = tosa.slice %[[VAL_12]], %[[VAL_13]], %[[VAL_14]] : (tensor<4x5x7x3x8xf32>, !tosa.shape<5>, !tosa.shape<5>) -> tensor<4x5x7x2x8xf32> // CHECK: %[[VAL_16:.*]] = tosa.reverse %[[VAL_15]] {axis = 3 : i32} : (tensor<4x5x7x2x8xf32>) -> tensor<4x5x7x2x8xf32> -// CHECK: %[[VAL_17:.*]] = tosa.const_shape {value = dense<0> : tensor<5xindex>} : () -> !tosa.shape<5> -// CHECK: %[[VAL_18:.*]] = tosa.const_shape {value = dense<[4, 5, 7, 2, 8]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_17:.*]] = tosa.const_shape {value = dense<0> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_18:.*]] = tosa.const_shape {value = dense<[4, 5, 7, 2, 8]> : tensor<5xindex>} : () -> !tosa.shape<5> // CHECK: %[[VAL_19:.*]] = tosa.slice %[[VAL_12]], %[[VAL_17]], %[[VAL_18]] : (tensor<4x5x7x3x8xf32>, !tosa.shape<5>, !tosa.shape<5>) -> tensor<4x5x7x2x8xf32> // CHECK: %[[VAL_20:.*]] = tosa.reverse %[[VAL_19]] {axis = 3 : i32} : (tensor<4x5x7x2x8xf32>) -> tensor<4x5x7x2x8xf32> // CHECK: %[[VAL_21:.*]] = tosa.concat %[[VAL_16]], %[[VAL_12]], %[[VAL_20]] {axis = 3 : i32} : (tensor<4x5x7x2x8xf32>, tensor<4x5x7x3x8xf32>, tensor<4x5x7x2x8xf32>) -> tensor<4x5x7x7x8xf32> -// CHECK: %[[VAL_22:.*]] = tosa.const_shape {value = dense<[0, 0, 1, 0, 0]> : tensor<5xindex>} : () -> !tosa.shape<5> -// CHECK: %[[VAL_23:.*]] = tosa.const_shape {value = dense<[4, 5, 2, 7, 8]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_22:.*]] = tosa.const_shape {value = dense<[0, 0, 1, 0, 0]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_23:.*]] = tosa.const_shape {value = dense<[4, 5, 2, 7, 8]> : tensor<5xindex>} : () -> !tosa.shape<5> // CHECK: %[[VAL_24:.*]] = tosa.slice %[[VAL_21]], %[[VAL_22]], %[[VAL_23]] : (tensor<4x5x7x7x8xf32>, !tosa.shape<5>, !tosa.shape<5>) -> tensor<4x5x2x7x8xf32> // CHECK: %[[VAL_25:.*]] = tosa.reverse %[[VAL_24]] {axis = 2 : i32} : (tensor<4x5x2x7x8xf32>) -> tensor<4x5x2x7x8xf32> -// CHECK: %[[VAL_26:.*]] = tosa.const_shape {value = dense<[0, 0, 4, 0, 0]> : tensor<5xindex>} : () -> !tosa.shape<5> -// CHECK: %[[VAL_27:.*]] = tosa.const_shape {value = dense<[4, 5, 2, 7, 8]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_26:.*]] = tosa.const_shape {value = dense<[0, 0, 4, 0, 0]> : tensor<5xindex>} : () -> !tosa.shape<5> +// CHECK-DAG: %[[VAL_27:.*]] = tosa.const_shape {value = dense<[4, 5, 2, 7, 8]> : tensor<5xindex>} : () -> !tosa.shape<5> // CHECK: %[[VAL_28:.*]] = tosa.slice %[[VAL_21]], %[[VAL_26]], %[[VAL_27]] : (tensor<4x5x7x7x8xf32>, !tosa.shape<5>, !tosa.shape<5>) -> tensor<4x5x2x7x8xf32> // CHECK: %[[VAL_29:.*]] = tosa.reverse %[[VAL_28]] {axis = 2 : i32} : (tensor<4x5x2x7x8xf32>) -> tensor<4x5x2x7x8xf32> // CHECK: %[[VAL_30:.*]] = tosa.concat %[[VAL_25]], %[[VAL_21]], %[[VAL_29]] {axis = 2 : i32} : (tensor<4x5x2x7x8xf32>, tensor<4x5x7x7x8xf32>, tensor<4x5x2x7x8xf32>) -> tensor<4x5x11x7x8xf32> @@ -2890,18 +2890,18 @@ func.func @torch.aten.reflection_pad3d$basic(%arg0: !torch.vtensor<[4,5,7,3,4],f // CHECK: %[[VAL_4:.*]] = torch.constant.int 3 // CHECK: %[[VAL_5:.*]] = torch.constant.int 4 // CHECK: %[[VAL_6:.*]] = torch.prim.ListConstruct %[[VAL_2]], %[[VAL_3]], %[[VAL_4]], %[[VAL_5]] : (!torch.int, !torch.int, !torch.int, !torch.int) -> !torch.list -// CHECK: %[[VAL_7:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_8:.*]] = tosa.const_shape {value = dense<[1, 1, 3, 1]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_7:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_8:.*]] = tosa.const_shape {value = dense<[1, 1, 3, 1]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_9:.*]] = tosa.slice %[[VAL_1]], %[[VAL_7]], %[[VAL_8]] : (tensor<1x1x3x3xf32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<1x1x3x1xf32> -// CHECK: %[[VAL_10:.*]] = tosa.const_shape {value = dense<[0, 0, 0, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_11:.*]] = tosa.const_shape {value = dense<[1, 1, 3, 1]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_10:.*]] = tosa.const_shape {value = dense<[0, 0, 0, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_11:.*]] = tosa.const_shape {value = dense<[1, 1, 3, 1]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_12:.*]] = tosa.slice %[[VAL_1]], %[[VAL_10]], %[[VAL_11]] : (tensor<1x1x3x3xf32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<1x1x3x1xf32> // CHECK: %[[VAL_13:.*]] = tosa.concat %[[VAL_9]], %[[VAL_1]], %[[VAL_12]], %[[VAL_12]] {axis = 3 : i32} : (tensor<1x1x3x1xf32>, tensor<1x1x3x3xf32>, tensor<1x1x3x1xf32>, tensor<1x1x3x1xf32>) -> tensor<1x1x3x6xf32> -// CHECK: %[[VAL_14:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_15:.*]] = tosa.const_shape {value = dense<[1, 1, 1, 6]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_14:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_15:.*]] = tosa.const_shape {value = dense<[1, 1, 1, 6]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_16:.*]] = tosa.slice %[[VAL_13]], %[[VAL_14]], %[[VAL_15]] : (tensor<1x1x3x6xf32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<1x1x1x6xf32> -// CHECK: %[[VAL_17:.*]] = tosa.const_shape {value = dense<[0, 0, 2, 0]> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_18:.*]] = tosa.const_shape {value = dense<[1, 1, 1, 6]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_17:.*]] = tosa.const_shape {value = dense<[0, 0, 2, 0]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_18:.*]] = tosa.const_shape {value = dense<[1, 1, 1, 6]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_19:.*]] = tosa.slice %[[VAL_13]], %[[VAL_17]], %[[VAL_18]] : (tensor<1x1x3x6xf32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<1x1x1x6xf32> // CHECK: %[[VAL_20:.*]] = tosa.concat %[[VAL_16]], %[[VAL_16]], %[[VAL_16]], %[[VAL_13]], %[[VAL_19]], %[[VAL_19]], %[[VAL_19]], %[[VAL_19]] {axis = 2 : i32} : (tensor<1x1x1x6xf32>, tensor<1x1x1x6xf32>, tensor<1x1x1x6xf32>, tensor<1x1x3x6xf32>, tensor<1x1x1x6xf32>, tensor<1x1x1x6xf32>, tensor<1x1x1x6xf32>, tensor<1x1x1x6xf32>) -> tensor<1x1x10x6xf32> // CHECK: %[[VAL_21:.*]] = torch_c.from_builtin_tensor %[[VAL_20]] : tensor<1x1x10x6xf32> -> !torch.vtensor<[1,1,10,6],f32> @@ -3611,11 +3611,11 @@ func.func @torch.aten.convolution$depthwise(%arg0: !torch.vtensor<[5,4,10,20],f3 // CHECK: %[[VAL_12:.*]] = "tosa.const"() <{value = dense<0.000000e+00> : tensor<128xf32>}> : () -> tensor<128xf32> // CHECK: %[[VAL_13:.*]] = tosa.transpose %[[VAL_1]] {perms = array} : (tensor<1x64x56x56xf32>) -> tensor<1x56x56x64xf32> // CHECK: %[[VAL_14:.*]] = tosa.transpose %[[VAL_5]] {perms = array} : (tensor<128x64x1x1xf32>) -> tensor<128x1x1x64xf32> -// CHECK: %[[VAL_15:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_16:.*]] = tosa.const_shape {value = dense<[1, 55, 56, 64]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_15:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_16:.*]] = tosa.const_shape {value = dense<[1, 55, 56, 64]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_17:.*]] = tosa.slice %[[VAL_13]], %[[VAL_15]], %[[VAL_16]] : (tensor<1x56x56x64xf32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<1x55x56x64xf32> -// CHECK: %[[VAL_18:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_19:.*]] = tosa.const_shape {value = dense<[1, 55, 55, 64]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_18:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_19:.*]] = tosa.const_shape {value = dense<[1, 55, 55, 64]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_20:.*]] = tosa.slice %[[VAL_17]], %[[VAL_18]], %[[VAL_19]] : (tensor<1x55x56x64xf32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<1x55x55x64xf32> // CHECK: %[[VAL_21:.*]] = "tosa.const"() <{value = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32> // CHECK: %[[VAL_22:.*]] = "tosa.const"() <{value = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32> @@ -3696,11 +3696,11 @@ func.func @torch.aten.convolution$full_dim_indivisible_by_stride_without_sliced_ // CHECK: %[[VAL_11:.*]] = "tosa.const"() <{value = dense<0.000000e+00> : tensor<32xf32>}> : () -> tensor<32xf32> // CHECK: %[[VAL_12:.*]] = tosa.transpose %[[VAL_1]] {perms = array} : (tensor<1x3x225x225xf32>) -> tensor<1x225x225x3xf32> // CHECK: %[[VAL_13:.*]] = tosa.transpose %[[VAL_4]] {perms = array} : (tensor<32x3x3x3xf32>) -> tensor<32x3x3x3xf32> -// CHECK: %[[VAL_14:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_15:.*]] = tosa.const_shape {value = dense<[1, 224, 225, 3]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_14:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_15:.*]] = tosa.const_shape {value = dense<[1, 224, 225, 3]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_16:.*]] = tosa.slice %[[VAL_12]], %[[VAL_14]], %[[VAL_15]] : (tensor<1x225x225x3xf32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<1x224x225x3xf32> -// CHECK: %[[VAL_17:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> -// CHECK: %[[VAL_18:.*]] = tosa.const_shape {value = dense<[1, 224, 224, 3]> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_17:.*]] = tosa.const_shape {value = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4> +// CHECK-DAG: %[[VAL_18:.*]] = tosa.const_shape {value = dense<[1, 224, 224, 3]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK: %[[VAL_19:.*]] = tosa.slice %[[VAL_16]], %[[VAL_17]], %[[VAL_18]] : (tensor<1x224x225x3xf32>, !tosa.shape<4>, !tosa.shape<4>) -> tensor<1x224x224x3xf32> // CHECK: %[[VAL_20:.*]] = "tosa.const"() <{value = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32> // CHECK: %[[VAL_21:.*]] = "tosa.const"() <{value = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32>