Skip to content

Commit

Permalink
Merge branch 'main' into onnx_slice
Browse files Browse the repository at this point in the history
  • Loading branch information
renxida authored Jan 13, 2025
2 parents 8df4d41 + 4a2cbb9 commit f3b4dbd
Show file tree
Hide file tree
Showing 152 changed files with 23,545 additions and 5,241 deletions.
4 changes: 2 additions & 2 deletions .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
steps:
- name: Set up Python
if: ${{ runner.arch == 'X64' }}
uses: actions/setup-python@v4
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'

Expand Down Expand Up @@ -74,7 +74,7 @@ runs:

- name: Enable ccache
if: ${{ inputs.cache-enabled == 'true' }}
uses: actions/cache@v3
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-${{ inputs.cache-suffix }}-${{ github.sha }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/RollPyTorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Get torch-mlir
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: 'false'
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Post issue comment on build failure
if: failure()
uses: peter-evans/create-or-update-comment@v2
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
issue-number: 1690
body: |
Expand All @@ -111,7 +111,7 @@ jobs:
- name: Update PyTorch Build Cache (if running on main branch)
if: github.ref_name == 'main'
id: cache-pytorch
uses: actions/cache@v3
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ github.workspace }}/build_tools/python_deploy/wheelhouse
key: ${{ runner.os }}-pytorch-${{ env.PT_HASH }}
Expand All @@ -127,7 +127,7 @@ jobs:
git pull origin main
- name: Create pull request
uses: peter-evans/create-pull-request@v5.0.1
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
author: Roll PyTorch Action <[email protected]>
branch: rollpytorch
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/bazelBuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ concurrency:
jobs:
ubuntu-build:
name: ubuntu-x86_64
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Prepare workspace
Expand All @@ -32,15 +32,15 @@ jobs:
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Checkout torch-mlir
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: 'true'

# Continually update cache even if there's a "hit" during
# restore to avoid the cache going stale over time
# https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache
- name: Setup cache for bazel
uses: actions/cache@v3
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/bazel
key: torch_mlir-bazel-build-cache-${{ runner.os }}-${{ github.sha }}
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
- name: Send mail
if: failure()
uses: dawidd6/action-send-mail@v3
uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde # v3.12.0
with:
server_address: ${{ secrets.SMTP_SERVER }}
server_port: ${{ secrets.SMTP_PORT }}
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/buildRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Get torch-mlir
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: 'true'
fetch-depth: 0
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Publish Release (if requested)
if: github.event.inputs.release_id != ''
id: publish_release
uses: eregon/publish-release@v1
uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # v1.0.6
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
with:
Expand All @@ -75,7 +75,7 @@ jobs:
#
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
- name: Store the binary wheel
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: wheels
path: dist
Expand All @@ -96,7 +96,7 @@ jobs:
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Get torch-mlir
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: 'true'
fetch-depth: 0
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
- name: Publish Release (if requested)
if: github.event.inputs.release_id != ''
id: publish_release
uses: eregon/publish-release@v1
uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # v1.0.6
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
with:
Expand All @@ -143,7 +143,7 @@ jobs:
#
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
- name: Store the binary wheel
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: wheels
path: dist
Expand All @@ -156,7 +156,7 @@ jobs:
package: [torch-mlir]
steps:
- name: Get torch-mlir
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: 'true'
- uses: ./.github/actions/setup-build
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
- name: Publish Release (if requested)
if: github.event.inputs.release_id != ''
id: publish_release
uses: eregon/publish-release@v1
uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # v1.0.6
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
with:
Expand All @@ -203,7 +203,7 @@ jobs:
#
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
- name: Store the binary wheel
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: wheels
path: dist
Expand All @@ -216,7 +216,7 @@ jobs:
package: [torch-mlir]
steps:
- name: Get torch-mlir
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: 'true'
- uses: ./.github/actions/setup-build
Expand Down Expand Up @@ -250,7 +250,7 @@ jobs:
- name: Publish Release (if requested)
if: github.event.inputs.release_id != ''
id: publish_release
uses: eregon/publish-release@v1
uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # v1.0.6
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
with:
Expand All @@ -267,13 +267,13 @@ jobs:
#
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
- name: Store the binary wheel
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: wheels
path: dist

publish_releases:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs:
- build_linux
- build_linux_arm64
Expand All @@ -285,7 +285,7 @@ jobs:

steps:
- name: Invoke Publish Releases Page
uses: benc-uk/workflow-dispatch@v1
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
with:
workflow: Publish releases page
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
scrape_and_publish_releases:
name: "Scrape and publish releases"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

# Don't run this in everyone's forks.
if: github.repository == 'llvm/torch-mlir'
Expand All @@ -20,7 +20,7 @@ jobs:
# existing lock files.
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Checking out repository
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
- name: Run scrape releases script
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/merge-rollpytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
merge-pr:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: |
github.repository == 'llvm/torch-mlir' &&
github.event.workflow_run.actor.login == 'stellaraccident' &&
Expand All @@ -18,7 +18,7 @@ jobs:
steps:
# Fetch the repo first so that the gh command knows where to look for the PR
- name: Fetch Repo
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/oneshotSnapshotPackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Checking out repository
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

Expand All @@ -43,16 +43,15 @@ jobs:

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
tag_name: ${{ env.tag_name }}
release_name: torch-mlir snapshot ${{ env.tag_name }}
tag: ${{ env.tag_name }}
name: torch-mlir snapshot ${{ env.tag_name }}
body: |
Automatic snapshot release of torch-mlir.
draft: true
prerelease: false
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

- name: "Invoke workflow :: Build and Test"
uses: benc-uk/workflow-dispatch@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pre-commit-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:

jobs:
pre-commit:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: --color=always --all-files
8 changes: 4 additions & 4 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:

jobs:
pre-commit:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# requites to grab the history of the PR
fetch-depth: 0
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
17 changes: 8 additions & 9 deletions .github/workflows/releaseSnapshotPackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
release_snapshot_package:
name: "Tag snapshot release"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
# Don't run this in everyone's forks.
if: github.repository == 'llvm/torch-mlir'
steps:
Expand All @@ -21,7 +21,7 @@ jobs:
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Checking out repository
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

Expand All @@ -46,26 +46,25 @@ jobs:

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
tag_name: ${{ env.tag_name }}
release_name: torch-mlir snapshot ${{ env.tag_name }}
tag: ${{ env.tag_name }}
name: torch-mlir snapshot ${{ env.tag_name }}
body: |
Automatic snapshot release of torch-mlir.
draft: true
prerelease: false
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

- name: "Invoke workflow :: Build and Test"
uses: benc-uk/workflow-dispatch@v1
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
with:
workflow: Build and Test
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
ref: "${{ env.tag_name }}"

- name: "Invoke workflow :: Release Build"
uses: benc-uk/workflow-dispatch@v1
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
with:
workflow: Release Build
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
Expand Down
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,17 @@ endif()
option(TORCH_MLIR_OUT_OF_TREE_BUILD "Specifies an out of tree build" OFF)

# PyTorch native extension gate. If OFF, then no features which depend on
# native extensions will be built.
option(TORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS "Enables PyTorch native extension features" ON)
# native extensions will be built.TORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS is disabled by default.
# But it will be manually enabled in CI build to enable the jit_ir_importer.build_tools.torch_ods_gen
# and abstract_interp_lib_gen.py. Once pure python version of build_tools finished, no need to set it in CI.
option(TORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS "Enables PyTorch native extension features" OFF)
if(TORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS)
add_definitions(-DTORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS)
endif()
# NOTE: The JIT_IR_IMPORTER paths have become unsupportable due to age and lack of maintainers.
# Turning this off disables the old TorchScript path, leaving FX based import as the current supported option.
# The option will be retained for a time, and if a maintainer is interested in setting up testing for it,
# please reach out on the list and speak up for it. It will only be enabled in CI for test usage.
cmake_dependent_option(TORCH_MLIR_ENABLE_JIT_IR_IMPORTER "Enables JIT IR Importer" ON TORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS OFF)
cmake_dependent_option(TORCH_MLIR_ENABLE_LTC "Enables LTC backend" OFF TORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS OFF)

Expand All @@ -62,6 +71,10 @@ macro(torch_mlir_enable_werror)
endif()
endmacro()

if(MSVC)
add_definitions(-D_USE_MATH_DEFINES)
endif()

#-------------------------------------------------------------------------------
# Configure out-of-tree vs in-tree build
#-------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit f3b4dbd

Please sign in to comment.