mirror of https://github.com/llvm/torch-mlir
[ci] Add lint job and enable yaml linting of GH files. (#2819)
parent
28c7051ceb
commit
4a4d80a6ad
|
@ -1,3 +1,4 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
name: "Setup build environment"
|
name: "Setup build environment"
|
||||||
description: "Setup the build environment. An action so that it can be shared between in-tree/out-of-tree jobs"
|
description: "Setup the build environment. An action so that it can be shared between in-tree/out-of-tree jobs"
|
||||||
|
|
||||||
|
@ -24,59 +25,59 @@ runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
if: ${{ runner.arch == 'X64' }}
|
if: ${{ runner.arch == 'X64' }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Install MLIR Python depends
|
- name: Install MLIR Python depends
|
||||||
if: ${{ runner.os != 'Linux' }}
|
if: ${{ runner.os != 'Linux' }}
|
||||||
run: |
|
run: |
|
||||||
python -m pip install -r $GITHUB_WORKSPACE/externals/llvm-project/mlir/python/requirements.txt
|
python -m pip install -r $GITHUB_WORKSPACE/externals/llvm-project/mlir/python/requirements.txt
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Install PyTorch nightly depends
|
- name: Install PyTorch nightly depends
|
||||||
if: ${{ runner.os != 'Linux' }}
|
if: ${{ runner.os != 'Linux' }}
|
||||||
run: |
|
run: |
|
||||||
python -m pip install -r pytorch-requirements.txt
|
python -m pip install -r pytorch-requirements.txt
|
||||||
python -m pip install -r build-requirements.txt
|
python -m pip install -r build-requirements.txt
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Install prerequisites (Linux)
|
- name: Install prerequisites (Linux)
|
||||||
if: ${{ runner.os == 'Linux' }}
|
if: ${{ runner.os == 'Linux' }}
|
||||||
run: sudo apt-get install --yes ccache ninja-build
|
run: sudo apt-get install --yes ccache ninja-build
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Install prerequisites (macOS)
|
- name: Install prerequisites (macOS)
|
||||||
if: ${{ runner.os == 'macOS' }}
|
if: ${{ runner.os == 'macOS' }}
|
||||||
run: brew install ccache ninja
|
run: brew install ccache ninja
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Install prerequisites (Windows)
|
- name: Install prerequisites (Windows)
|
||||||
if: ${{ runner.os == 'Windows' }}
|
if: ${{ runner.os == 'Windows' }}
|
||||||
run: |
|
run: |
|
||||||
pip install ninja
|
pip install ninja
|
||||||
choco install ccache --yes
|
choco install ccache --yes
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Configure ccache
|
- name: Configure ccache
|
||||||
if: ${{ inputs.cache-enabled == 'true' }}
|
if: ${{ inputs.cache-enabled == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
rm -rf ${{ github.workspace }}/.ccache
|
rm -rf ${{ github.workspace }}/.ccache
|
||||||
mkdir -p ${{ github.workspace }}/.ccache
|
mkdir -p ${{ github.workspace }}/.ccache
|
||||||
ccache --set-config "cache_dir=${{ github.workspace }}/.ccache"
|
ccache --set-config "cache_dir=${{ github.workspace }}/.ccache"
|
||||||
ccache --set-config "compression=true"
|
ccache --set-config "compression=true"
|
||||||
ccache --set-config "max_size=300M"
|
ccache --set-config "max_size=300M"
|
||||||
ccache --zero-stats
|
ccache --zero-stats
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Enable ccache
|
- name: Enable ccache
|
||||||
if: ${{ inputs.cache-enabled == 'true' }}
|
if: ${{ inputs.cache-enabled == 'true' }}
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/.ccache
|
path: ${{ github.workspace }}/.ccache
|
||||||
key: ${{ runner.os }}-${{ inputs.cache-suffix }}-${{ github.sha }}
|
key: ${{ runner.os }}-${{ inputs.cache-suffix }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-${{ inputs.cache-suffix }}-
|
${{ runner.os }}-${{ inputs.cache-suffix }}-
|
||||||
${{ runner.os }}-
|
${{ runner.os }}-
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
name: Roll PyTorch
|
name: Roll PyTorch
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
@ -14,133 +15,132 @@ jobs:
|
||||||
if: github.repository == 'llvm/torch-mlir'
|
if: github.repository == 'llvm/torch-mlir'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare workspace
|
||||||
|
run: |
|
||||||
|
# Clear the workspace directory so that we don't run into errors about
|
||||||
|
# existing lock files.
|
||||||
|
sudo rm -rf $GITHUB_WORKSPACE/*
|
||||||
|
|
||||||
- name: Prepare workspace
|
- name: Get torch-mlir
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
# Clear the workspace directory so that we don't run into errors about
|
with:
|
||||||
# existing lock files.
|
submodules: 'false'
|
||||||
sudo rm -rf $GITHUB_WORKSPACE/*
|
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
|
|
||||||
- name: Get torch-mlir
|
- name: Get LLVM and StableHlo submodules
|
||||||
uses: actions/checkout@v3
|
run: |
|
||||||
with:
|
set -eo pipefail
|
||||||
submodules: 'false'
|
cd ${GITHUB_WORKSPACE}
|
||||||
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
|
||||||
|
|
||||||
- name: Get LLVM and StableHlo submodules
|
# Fetching the submodules concurrently may cause problems, so we fetch
|
||||||
run: |
|
# them one after another.
|
||||||
set -eo pipefail
|
rm -f .git/modules/externals/llvm-project/index.lock
|
||||||
cd ${GITHUB_WORKSPACE}
|
rm -f .git/modules/externals/stablehlo/index.lock
|
||||||
|
git submodule update --init --recursive externals/llvm-project
|
||||||
|
git submodule update --init --recursive externals/stablehlo
|
||||||
|
|
||||||
# Fetching the submodules concurrently may cause problems, so we fetch
|
- name: Setup ccache
|
||||||
# them one after another.
|
uses: ./.github/actions/setup-build
|
||||||
rm -f .git/modules/externals/llvm-project/index.lock
|
with:
|
||||||
rm -f .git/modules/externals/stablehlo/index.lock
|
cache-suffix: 'rollPyTorch'
|
||||||
git submodule update --init --recursive externals/llvm-project
|
|
||||||
git submodule update --init --recursive externals/stablehlo
|
|
||||||
|
|
||||||
- name: Setup ccache
|
- name: Determine nightly PyTorch version
|
||||||
uses: ./.github/actions/setup-build
|
run: |
|
||||||
with:
|
set -eo pipefail
|
||||||
cache-suffix: 'rollPyTorch'
|
|
||||||
|
|
||||||
- name: Determine nightly PyTorch version
|
cd ${GITHUB_WORKSPACE}
|
||||||
run: |
|
python -m pip install wheel
|
||||||
set -eo pipefail
|
sudo apt-get install unzip
|
||||||
|
|
||||||
cd ${GITHUB_WORKSPACE}
|
# Fetch the most recent nightly torchvision release
|
||||||
python -m pip install wheel
|
VISION_RELEASE=$(python -m pip index versions -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --pre torchvision | grep "Available versions" | tr ' ' '\n' | grep "^[0-9]" | sort --version-sort --reverse | head -n1 | tr -d ',' | sed 's/\([^+]*\).*/\1/')
|
||||||
sudo apt-get install unzip
|
echo "Found torchvision release ${VISION_RELEASE}"
|
||||||
|
|
||||||
# Fetch the most recent nightly torchvision release
|
# Fetch the whl file associated with the nightly torchvision release
|
||||||
VISION_RELEASE=$(python -m pip index versions -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --pre torchvision | grep "Available versions" | tr ' ' '\n' | grep "^[0-9]" | sort --version-sort --reverse | head -n1 | tr -d ',' | sed 's/\([^+]*\).*/\1/')
|
rm -f torch*.whl
|
||||||
echo "Found torchvision release ${VISION_RELEASE}"
|
python -m pip download -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --pre "torchvision==${VISION_RELEASE}"
|
||||||
|
|
||||||
# Fetch the whl file associated with the nightly torchvision release
|
# Downloading the torchvision WHL also downloads the PyTorch WHL file
|
||||||
rm -f torch*.whl
|
# Read the version from the downloaded whl file without extracting it
|
||||||
python -m pip download -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --pre "torchvision==${VISION_RELEASE}"
|
PT_RELEASE=$(unzip -p torch-*.whl 'torch-*/METADATA' | grep "^Version:" | awk '{ print $2 }' | sed 's/\([^+]*\).*/\1/')
|
||||||
|
echo "Found torch release ${PT_RELEASE}"
|
||||||
|
printf -- "-f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html\n--pre\ntorch==%s\n" "${PT_RELEASE}" > pytorch-requirements.txt
|
||||||
|
printf -- "-f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html\n--pre\ntorchvision==%s\n" "${VISION_RELEASE}" > torchvision-requirements.txt
|
||||||
|
|
||||||
# Downloading the torchvision WHL also downloads the PyTorch WHL file
|
# Read the commit hash from the downloaded whl file without extracting it
|
||||||
# Read the version from the downloaded whl file without extracting it
|
PT_HASH=$(unzip -p torch-"${PT_RELEASE}"*.whl torch/version.py | grep git_version | tail -1 | awk '{ print $3 }' | tr -d "'")
|
||||||
PT_RELEASE=$(unzip -p torch-*.whl 'torch-*/METADATA' | grep "^Version:" | awk '{ print $2 }' | sed 's/\([^+]*\).*/\1/')
|
echo "Found torch commit hash ${PT_HASH}"
|
||||||
echo "Found torch release ${PT_RELEASE}"
|
|
||||||
printf -- "-f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html\n--pre\ntorch==%s\n" "${PT_RELEASE}" > pytorch-requirements.txt
|
|
||||||
printf -- "-f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html\n--pre\ntorchvision==%s\n" "${VISION_RELEASE}" > torchvision-requirements.txt
|
|
||||||
|
|
||||||
# Read the commit hash from the downloaded whl file without extracting it
|
PT_HASH_CHANGED=0
|
||||||
PT_HASH=$(unzip -p torch-"${PT_RELEASE}"*.whl torch/version.py | grep git_version | tail -1 | awk '{ print $3 }' | tr -d "'")
|
echo "${PT_HASH}" | cmp - pytorch-hash.txt --quiet || PT_HASH_CHANGED=$?
|
||||||
echo "Found torch commit hash ${PT_HASH}"
|
echo "${PT_HASH}" > pytorch-hash.txt
|
||||||
|
rm torch-"${PT_RELEASE}"*.whl
|
||||||
|
|
||||||
PT_HASH_CHANGED=0
|
# Write the release and hash to the environment file so that we can
|
||||||
echo "${PT_HASH}" | cmp - pytorch-hash.txt --quiet || PT_HASH_CHANGED=$?
|
# retrieve them when creating a PR
|
||||||
echo "${PT_HASH}" > pytorch-hash.txt
|
echo "PT_HASH=${PT_HASH}" >> ${GITHUB_ENV}
|
||||||
rm torch-"${PT_RELEASE}"*.whl
|
echo "PT_RELEASE=${PT_RELEASE}" >> ${GITHUB_ENV}
|
||||||
|
echo "PTVISION_RELEASE=${VISION_RELEASE}" >> ${GITHUB_ENV}
|
||||||
|
echo "PT_HASH_CHANGED=${PT_HASH_CHANGED}" >> ${GITHUB_ENV}
|
||||||
|
|
||||||
# Write the release and hash to the environment file so that we can
|
- name: Build and test (out-of-tree), also update ODS and abstract interpretation library
|
||||||
# retrieve them when creating a PR
|
if: env.PT_HASH_CHANGED != '0'
|
||||||
echo "PT_HASH=${PT_HASH}" >> ${GITHUB_ENV}
|
run: |
|
||||||
echo "PT_RELEASE=${PT_RELEASE}" >> ${GITHUB_ENV}
|
cd ${GITHUB_WORKSPACE}
|
||||||
echo "PTVISION_RELEASE=${VISION_RELEASE}" >> ${GITHUB_ENV}
|
TM_PACKAGES="out-of-tree" TM_USE_PYTORCH_BINARY="OFF" \
|
||||||
echo "PT_HASH_CHANGED=${PT_HASH_CHANGED}" >> ${GITHUB_ENV}
|
TORCH_MLIR_SRC_PYTORCH_BRANCH="${{ env.PT_HASH }}" \
|
||||||
|
TORCH_MLIR_SRC_PYTORCH_RELEASE="${{ env.PT_RELEASE }}" \
|
||||||
|
TM_UPDATE_ODS_AND_ABSTRACT_INTERP_LIB="ON" \
|
||||||
|
./build_tools/python_deploy/build_linux_packages.sh
|
||||||
|
|
||||||
- name: Build and test (out-of-tree), also update ODS and abstract interpretation library
|
- name: Post issue comment on build failure
|
||||||
if: env.PT_HASH_CHANGED != '0'
|
if: failure()
|
||||||
run: |
|
uses: peter-evans/create-or-update-comment@v2
|
||||||
cd ${GITHUB_WORKSPACE}
|
with:
|
||||||
TM_PACKAGES="out-of-tree" TM_USE_PYTORCH_BINARY="OFF" \
|
issue-number: 1690
|
||||||
TORCH_MLIR_SRC_PYTORCH_BRANCH="${{ env.PT_HASH }}" \
|
body: |
|
||||||
TORCH_MLIR_SRC_PYTORCH_RELEASE="${{ env.PT_RELEASE }}" \
|
The RollPyTorch action has failed. See [CI log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
|
||||||
TM_UPDATE_ODS_AND_ABSTRACT_INTERP_LIB="ON" \
|
|
||||||
./build_tools/python_deploy/build_linux_packages.sh
|
|
||||||
|
|
||||||
- name: Post issue comment on build failure
|
The following information may come handy when fixing the code.
|
||||||
if: failure()
|
```
|
||||||
uses: peter-evans/create-or-update-comment@v2
|
torch version: ${{ env.PT_RELEASE }}
|
||||||
with:
|
torch commit hash: ${{ env.PT_HASH }}
|
||||||
issue-number: 1690
|
torchvision version: ${{ env.PTVISION_RELEASE }}
|
||||||
body: |
|
```
|
||||||
The RollPyTorch action has failed. See [CI log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
|
|
||||||
|
|
||||||
The following information may come handy when fixing the code.
|
- name: Update PyTorch Build Cache (if running on main branch)
|
||||||
```
|
if: github.ref_name == 'main'
|
||||||
torch version: ${{ env.PT_RELEASE }}
|
id: cache-pytorch
|
||||||
torch commit hash: ${{ env.PT_HASH }}
|
uses: actions/cache@v3
|
||||||
torchvision version: ${{ env.PTVISION_RELEASE }}
|
with:
|
||||||
```
|
path: ${{ github.workspace }}/build_tools/python_deploy/wheelhouse
|
||||||
|
key: ${{ runner.os }}-pytorch-${{ env.PT_HASH }}
|
||||||
|
|
||||||
- name: Update PyTorch Build Cache (if running on main branch)
|
- name: Commit changes locally
|
||||||
if: github.ref_name == 'main'
|
if: env.PT_HASH_CHANGED != '0'
|
||||||
id: cache-pytorch
|
run: |
|
||||||
uses: actions/cache@v3
|
cd ${GITHUB_WORKSPACE}
|
||||||
with:
|
git config user.email "torch-mlir@users.noreply.github.com"
|
||||||
path: ${{ github.workspace }}/build_tools/python_deploy/wheelhouse
|
git config user.name "Roll PyTorch Action"
|
||||||
key: ${{ runner.os }}-pytorch-${{ env.PT_HASH }}
|
git fetch --recurse-submodules=no
|
||||||
|
git checkout main
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
- name: Commit changes locally
|
- name: Create pull request
|
||||||
if: env.PT_HASH_CHANGED != '0'
|
uses: peter-evans/create-pull-request@v5.0.1
|
||||||
run: |
|
with:
|
||||||
cd ${GITHUB_WORKSPACE}
|
author: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
|
||||||
git config user.email "torch-mlir@users.noreply.github.com"
|
branch: rollpytorch
|
||||||
git config user.name "Roll PyTorch Action"
|
body: |
|
||||||
git fetch --recurse-submodules=no
|
torch version: ${{ env.PT_RELEASE }}
|
||||||
git checkout main
|
torch commit hash: ${{ env.PT_HASH }}
|
||||||
git pull origin main
|
torchvision version: ${{ env.PTVISION_RELEASE }}
|
||||||
|
commit-message: |
|
||||||
|
update PyTorch version to ${{ env.PT_RELEASE }}
|
||||||
|
|
||||||
- name: Create pull request
|
- torch version: ${{ env.PT_RELEASE }}
|
||||||
uses: peter-evans/create-pull-request@v5.0.1
|
- torch commit hash: ${{ env.PT_HASH }}
|
||||||
with:
|
- torchvision version: ${{ env.PTVISION_RELEASE }}
|
||||||
author: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
|
committer: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
|
||||||
branch: rollpytorch
|
title: update PyTorch version to ${{ env.PT_RELEASE }}
|
||||||
body: |
|
token: ${{ secrets.ROLLPYTORCH_TOKEN0 }}
|
||||||
torch version: ${{ env.PT_RELEASE }}
|
|
||||||
torch commit hash: ${{ env.PT_HASH }}
|
|
||||||
torchvision version: ${{ env.PTVISION_RELEASE }}
|
|
||||||
commit-message: |
|
|
||||||
update PyTorch version to ${{ env.PT_RELEASE }}
|
|
||||||
|
|
||||||
- torch version: ${{ env.PT_RELEASE }}
|
|
||||||
- torch commit hash: ${{ env.PT_HASH }}
|
|
||||||
- torchvision version: ${{ env.PTVISION_RELEASE }}
|
|
||||||
committer: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
|
|
||||||
title: update PyTorch version to ${{ env.PT_RELEASE }}
|
|
||||||
token: ${{ secrets.ROLLPYTORCH_TOKEN0 }}
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
name: Bazel Build and Test
|
name: Bazel Build and Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [main]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Ensure that only a single job or workflow using the same
|
# Ensure that only a single job or workflow using the same
|
||||||
|
@ -24,90 +25,90 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Prepare workspace
|
- name: Prepare workspace
|
||||||
run: |
|
run: |
|
||||||
# Clear the workspace directory so that we don't run into errors about
|
# Clear the workspace directory so that we don't run into errors about
|
||||||
# existing lock files.
|
# existing lock files.
|
||||||
sudo rm -rf $GITHUB_WORKSPACE/*
|
sudo rm -rf $GITHUB_WORKSPACE/*
|
||||||
|
|
||||||
- name: Checkout torch-mlir
|
- name: Checkout torch-mlir
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
|
|
||||||
# Continually update cache even if there's a "hit" during
|
# Continually update cache even if there's a "hit" during
|
||||||
# restore to avoid the cache going stale over time
|
# restore to avoid the cache going stale over time
|
||||||
# https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache
|
# https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache
|
||||||
- name: Setup cache for bazel
|
- name: Setup cache for bazel
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/bazel
|
path: ~/.cache/bazel
|
||||||
key: torch_mlir-bazel-build-cache-${{ runner.os }}-${{ github.sha }}
|
key: torch_mlir-bazel-build-cache-${{ runner.os }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
torch_mlir-bazel-build-cache-${{ runner.os }}
|
torch_mlir-bazel-build-cache-${{ runner.os }}
|
||||||
|
|
||||||
# Change bazel cache directory to root ownership
|
# Change bazel cache directory to root ownership
|
||||||
# to allow writing to it from within the docker container.
|
# to allow writing to it from within the docker container.
|
||||||
# If no cache hits, this directory is not present
|
# If no cache hits, this directory is not present
|
||||||
# so don't run chown (will error otherwise).
|
# so don't run chown (will error otherwise).
|
||||||
- name: Set bazel cache permissions
|
- name: Set bazel cache permissions
|
||||||
run: |
|
run: |
|
||||||
if [ -d "${HOME}/.cache/bazel" ]; then
|
if [ -d "${HOME}/.cache/bazel" ]; then
|
||||||
sudo chown -R root:root "${HOME}/.cache/bazel"
|
sudo chown -R root:root "${HOME}/.cache/bazel"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build docker image
|
- name: Build docker image
|
||||||
run: |
|
run: |
|
||||||
docker build -f utils/bazel/docker/Dockerfile \
|
docker build -f utils/bazel/docker/Dockerfile \
|
||||||
-t torch-mlir:ci \
|
-t torch-mlir:ci \
|
||||||
.
|
.
|
||||||
|
|
||||||
- name: Verify buildifier was run (bazel lint)
|
- name: Verify buildifier was run (bazel lint)
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "$(pwd)":"/opt/src/torch-mlir" \
|
-v "$(pwd)":"/opt/src/torch-mlir" \
|
||||||
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
|
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
|
||||||
torch-mlir:ci \
|
torch-mlir:ci \
|
||||||
bazel run @torch-mlir//:buildifier
|
bazel run @torch-mlir//:buildifier
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
echo "Please 'bazel run @torch-mlir//:buildifier' and commit changes."
|
echo "Please 'bazel run @torch-mlir//:buildifier' and commit changes."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Bazel build torch-mlir
|
- name: Bazel build torch-mlir
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "$(pwd)":"/opt/src/torch-mlir" \
|
-v "$(pwd)":"/opt/src/torch-mlir" \
|
||||||
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
|
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
|
||||||
torch-mlir:ci \
|
torch-mlir:ci \
|
||||||
bazel build @torch-mlir//:torch-mlir-opt
|
bazel build @torch-mlir//:torch-mlir-opt
|
||||||
|
|
||||||
- name: Bazel test torch-mlir (lit tests)
|
- name: Bazel test torch-mlir (lit tests)
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "$(pwd)":"/opt/src/torch-mlir" \
|
-v "$(pwd)":"/opt/src/torch-mlir" \
|
||||||
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
|
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
|
||||||
torch-mlir:ci \
|
torch-mlir:ci \
|
||||||
bazel test @torch-mlir//test/...
|
bazel test @torch-mlir//test/...
|
||||||
|
|
||||||
# Switch back bazel cache directory to user ownership
|
# Switch back bazel cache directory to user ownership
|
||||||
# to allow GHA post-cache step to save cache without
|
# to allow GHA post-cache step to save cache without
|
||||||
# permissions issue.
|
# permissions issue.
|
||||||
- name: Switch bazel cache permissions
|
- name: Switch bazel cache permissions
|
||||||
run: |
|
run: |
|
||||||
if [ -d "${HOME}/.cache/bazel" ]; then
|
if [ -d "${HOME}/.cache/bazel" ]; then
|
||||||
sudo chown -R "$USER":"$USER" "${HOME}/.cache/bazel"
|
sudo chown -R "$USER":"$USER" "${HOME}/.cache/bazel"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Send mail
|
- name: Send mail
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: dawidd6/action-send-mail@v3
|
uses: dawidd6/action-send-mail@v3
|
||||||
with:
|
with:
|
||||||
server_address: ${{ secrets.SMTP_SERVER }}
|
server_address: ${{ secrets.SMTP_SERVER }}
|
||||||
server_port: ${{ secrets.SMTP_PORT }}
|
server_port: ${{ secrets.SMTP_PORT }}
|
||||||
username: ${{ secrets.SMTP_USERNAME }}
|
username: ${{ secrets.SMTP_USERNAME }}
|
||||||
password: ${{ secrets.SMTP_PASSWORD }}
|
password: ${{ secrets.SMTP_PASSWORD }}
|
||||||
subject: GitHub Action Bazel Build and Test failed!
|
subject: GitHub Action Bazel Build and Test failed!
|
||||||
body: Bazel Build job failed! See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} for more information.
|
body: Bazel Build job failed! See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} for more information.
|
||||||
to: ${{ secrets.MAIL_RECEIVER }}
|
to: ${{ secrets.MAIL_RECEIVER }}
|
||||||
from: Torch-MLIR Bazel Build GitHub Actions
|
from: Torch-MLIR Bazel Build GitHub Actions
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
name: Build and Test
|
name: Build and Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [main]
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [main]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Ensure that only a single job or workflow using the same
|
# Ensure that only a single job or workflow using the same
|
||||||
|
@ -57,102 +58,101 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare workspace
|
||||||
- name: Prepare workspace
|
if: ${{ matrix.os-arch == 'ubuntu-x86_64' }}
|
||||||
if: ${{ matrix.os-arch == 'ubuntu-x86_64' }}
|
run: |
|
||||||
run: |
|
# Clear the workspace directory so that we don't run into errors about
|
||||||
# Clear the workspace directory so that we don't run into errors about
|
# existing lock files.
|
||||||
# existing lock files.
|
sudo rm -rf $GITHUB_WORKSPACE/*
|
||||||
sudo rm -rf $GITHUB_WORKSPACE/*
|
|
||||||
|
|
||||||
- name: Checkout torch-mlir
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: 'true'
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Fetch PyTorch commit hash
|
- name: Checkout torch-mlir
|
||||||
if: ${{ matrix.os-arch != 'windows-x86_64' }}
|
uses: actions/checkout@v3
|
||||||
run: |
|
with:
|
||||||
PT_HASH="$(cat ${GITHUB_WORKSPACE}/pytorch-hash.txt)"
|
submodules: 'true'
|
||||||
echo "PT_HASH=${PT_HASH}" >> ${GITHUB_ENV}
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup ccache
|
- name: Fetch PyTorch commit hash
|
||||||
uses: ./.github/actions/setup-build
|
if: ${{ matrix.os-arch != 'windows-x86_64' }}
|
||||||
with:
|
run: |
|
||||||
cache-suffix: 'build-${{ matrix.llvm-build }}-${{ matrix.torch-version }}'
|
PT_HASH="$(cat ${GITHUB_WORKSPACE}/pytorch-hash.txt)"
|
||||||
torch-version: ${{ matrix.torch-version }}
|
echo "PT_HASH=${PT_HASH}" >> ${GITHUB_ENV}
|
||||||
|
|
||||||
- name: Set up Visual Studio shell
|
- name: Setup ccache
|
||||||
if: ${{ matrix.os-arch == 'windows-x86_64' }}
|
uses: ./.github/actions/setup-build
|
||||||
uses: egor-tensin/vs-shell@v2
|
with:
|
||||||
with:
|
cache-suffix: 'build-${{ matrix.llvm-build }}-${{ matrix.torch-version }}'
|
||||||
arch: x64
|
torch-version: ${{ matrix.torch-version }}
|
||||||
|
|
||||||
- name: Try to Restore PyTorch Build Cache
|
- name: Set up Visual Studio shell
|
||||||
if: ${{ matrix.torch-binary == 'OFF' }}
|
if: ${{ matrix.os-arch == 'windows-x86_64' }}
|
||||||
id: cache-pytorch
|
uses: egor-tensin/vs-shell@v2
|
||||||
uses: actions/cache/restore@v3
|
with:
|
||||||
with:
|
arch: x64
|
||||||
path: ${{ github.workspace }}/build_tools/python_deploy/wheelhouse
|
|
||||||
key: ${{ runner.os }}-pytorch-${{ env.PT_HASH }}
|
|
||||||
|
|
||||||
- name: Build and Test os-arch='ubuntu-x86_64' llvm-build='${{ matrix.llvm-build }}' torch-binary='${{ matrix.torch-binary }}'
|
- name: Try to Restore PyTorch Build Cache
|
||||||
if: ${{ matrix.os-arch == 'ubuntu-x86_64' }}
|
if: ${{ matrix.torch-binary == 'OFF' }}
|
||||||
run: |
|
id: cache-pytorch
|
||||||
cd $GITHUB_WORKSPACE
|
uses: actions/cache/restore@v3
|
||||||
TORCH_MLIR_SRC_PYTORCH_BRANCH="$(cat pytorch-hash.txt)" \
|
with:
|
||||||
TM_PACKAGES="${{ matrix.llvm-build }}" \
|
path: ${{ github.workspace }}/build_tools/python_deploy/wheelhouse
|
||||||
TM_USE_PYTORCH_BINARY="${{ matrix.torch-binary }}" \
|
key: ${{ runner.os }}-pytorch-${{ env.PT_HASH }}
|
||||||
TM_PYTORCH_INSTALL_WITHOUT_REBUILD="${{ steps.cache-pytorch.outputs.cache-hit }}" \
|
|
||||||
TM_TORCH_VERSION="${{ matrix.torch-version }}" \
|
|
||||||
./build_tools/python_deploy/build_linux_packages.sh
|
|
||||||
|
|
||||||
- name: Configure os-arch='macos-arm64' llvm-build='in-tree' torch-binary='${{ matrix.torch-binary }}'
|
- name: Build and Test os-arch='ubuntu-x86_64' llvm-build='${{ matrix.llvm-build }}' torch-binary='${{ matrix.torch-binary }}'
|
||||||
# cross compile, can't test arm64
|
if: ${{ matrix.os-arch == 'ubuntu-x86_64' }}
|
||||||
if: ${{ matrix.os-arch == 'macos-arm64' && matrix.llvm-build == 'in-tree' }}
|
run: |
|
||||||
run: |
|
cd $GITHUB_WORKSPACE
|
||||||
# TODO: Reenable LTC after build on macOS-arm64 is fixed (https://github.com/llvm/torch-mlir/issues/1253)
|
TORCH_MLIR_SRC_PYTORCH_BRANCH="$(cat pytorch-hash.txt)" \
|
||||||
cmake -GNinja -Bbuild_arm64 \
|
TM_PACKAGES="${{ matrix.llvm-build }}" \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
TM_USE_PYTORCH_BINARY="${{ matrix.torch-binary }}" \
|
||||||
-DCMAKE_C_COMPILER=clang \
|
TM_PYTORCH_INSTALL_WITHOUT_REBUILD="${{ steps.cache-pytorch.outputs.cache-hit }}" \
|
||||||
-DCMAKE_CXX_COMPILER=clang++ \
|
TM_TORCH_VERSION="${{ matrix.torch-version }}" \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
./build_tools/python_deploy/build_linux_packages.sh
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
||||||
-DCMAKE_LINKER=lld \
|
|
||||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
|
||||||
-DLLVM_ENABLE_ASSERTIONS=ON \
|
|
||||||
-DLLVM_ENABLE_PROJECTS=mlir \
|
|
||||||
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
|
|
||||||
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$GITHUB_WORKSPACE" \
|
|
||||||
-DLLVM_TARGETS_TO_BUILD=AArch64 \
|
|
||||||
-DLLVM_USE_HOST_TOOLS=ON \
|
|
||||||
-DLLVM_ENABLE_ZSTD=OFF \
|
|
||||||
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
|
|
||||||
-DTORCH_MLIR_ENABLE_STABLEHLO=OFF \
|
|
||||||
-DTORCH_MLIR_ENABLE_LTC=OFF \
|
|
||||||
-DTORCH_MLIR_USE_INSTALLED_PYTORCH="${{ matrix.torch-binary }}" \
|
|
||||||
-DMACOSX_DEPLOYMENT_TARGET=12.0 \
|
|
||||||
-DPython3_EXECUTABLE="$(which python)" \
|
|
||||||
$GITHUB_WORKSPACE/externals/llvm-project/llvm
|
|
||||||
|
|
||||||
- name: Build torch-mlir (cross-compile)
|
- name: Configure os-arch='macos-arm64' llvm-build='in-tree' torch-binary='${{ matrix.torch-binary }}'
|
||||||
if: ${{ matrix.os-arch == 'macos-arm64' }}
|
# cross compile, can't test arm64
|
||||||
run: |
|
if: ${{ matrix.os-arch == 'macos-arm64' && matrix.llvm-build == 'in-tree' }}
|
||||||
cmake --build build_arm64
|
run: |
|
||||||
|
# TODO: Reenable LTC after build on macOS-arm64 is fixed (https://github.com/llvm/torch-mlir/issues/1253)
|
||||||
|
cmake -GNinja -Bbuild_arm64 \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_C_COMPILER=clang \
|
||||||
|
-DCMAKE_CXX_COMPILER=clang++ \
|
||||||
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||||
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||||
|
-DCMAKE_LINKER=lld \
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||||
|
-DLLVM_ENABLE_ASSERTIONS=ON \
|
||||||
|
-DLLVM_ENABLE_PROJECTS=mlir \
|
||||||
|
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
|
||||||
|
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$GITHUB_WORKSPACE" \
|
||||||
|
-DLLVM_TARGETS_TO_BUILD=AArch64 \
|
||||||
|
-DLLVM_USE_HOST_TOOLS=ON \
|
||||||
|
-DLLVM_ENABLE_ZSTD=OFF \
|
||||||
|
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
|
||||||
|
-DTORCH_MLIR_ENABLE_STABLEHLO=OFF \
|
||||||
|
-DTORCH_MLIR_ENABLE_LTC=OFF \
|
||||||
|
-DTORCH_MLIR_USE_INSTALLED_PYTORCH="${{ matrix.torch-binary }}" \
|
||||||
|
-DMACOSX_DEPLOYMENT_TARGET=12.0 \
|
||||||
|
-DPython3_EXECUTABLE="$(which python)" \
|
||||||
|
$GITHUB_WORKSPACE/externals/llvm-project/llvm
|
||||||
|
|
||||||
- name: Build (Windows)
|
- name: Build torch-mlir (cross-compile)
|
||||||
if: ${{ matrix.os-arch == 'windows-x86_64' }}
|
if: ${{ matrix.os-arch == 'macos-arm64' }}
|
||||||
shell: bash
|
run: |
|
||||||
run: ./build_tools/python_deploy/build_windows_ci.sh
|
cmake --build build_arm64
|
||||||
|
|
||||||
- name: Save PyTorch Build Cache
|
- name: Build (Windows)
|
||||||
if: ${{ github.ref_name == 'main' && matrix.torch-binary == 'OFF' }}
|
if: ${{ matrix.os-arch == 'windows-x86_64' }}
|
||||||
uses: actions/cache/save@v3
|
shell: bash
|
||||||
with:
|
run: ./build_tools/python_deploy/build_windows_ci.sh
|
||||||
path: ${{ github.workspace }}/build_tools/python_deploy/wheelhouse
|
|
||||||
key: ${{ runner.os }}-pytorch-${{ env.PT_HASH }}
|
|
||||||
|
|
||||||
- name: Print ccache statistics
|
- name: Save PyTorch Build Cache
|
||||||
shell: bash
|
if: ${{ github.ref_name == 'main' && matrix.torch-binary == 'OFF' }}
|
||||||
run: ccache --show-stats
|
uses: actions/cache/save@v3
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/build_tools/python_deploy/wheelhouse
|
||||||
|
key: ${{ runner.os }}-pytorch-${{ env.PT_HASH }}
|
||||||
|
|
||||||
|
- name: Print ccache statistics
|
||||||
|
shell: bash
|
||||||
|
run: ccache --show-stats
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
name: Release Build
|
name: Release Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
@ -16,295 +17,293 @@ jobs:
|
||||||
runs-on: a100
|
runs-on: a100
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
package: [ torch-mlir ]
|
package: [torch-mlir]
|
||||||
py_version: [ cp38-cp38, cp311-cp311 ]
|
py_version: [cp38-cp38, cp311-cp311]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare workspace
|
||||||
|
run: |
|
||||||
|
# Clear the workspace directory so that we don't run into errors about
|
||||||
|
# existing lock files.
|
||||||
|
sudo rm -rf $GITHUB_WORKSPACE/*
|
||||||
|
|
||||||
- name: Prepare workspace
|
- name: Get torch-mlir
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
# Clear the workspace directory so that we don't run into errors about
|
with:
|
||||||
# existing lock files.
|
submodules: 'true'
|
||||||
sudo rm -rf $GITHUB_WORKSPACE/*
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get torch-mlir
|
- uses: ./.github/actions/setup-build
|
||||||
uses: actions/checkout@v3
|
with:
|
||||||
with:
|
cache-enabled: 'false'
|
||||||
submodules: 'true'
|
- name: Build Python wheels and smoke test.
|
||||||
fetch-depth: 0
|
run: |
|
||||||
|
cd $GITHUB_WORKSPACE
|
||||||
|
TM_PACKAGE_VERSION=${{ github.event.inputs.python_package_version }}
|
||||||
|
printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" $TM_PACKAGE_VERSION > ./torch_mlir_package_version
|
||||||
|
TM_PYTHON_VERSIONS=${{ matrix.py_version }} TM_PACKAGES=${{ matrix.package }} ./build_tools/python_deploy/build_linux_packages.sh
|
||||||
|
|
||||||
- uses: ./.github/actions/setup-build
|
# If we were given a release_id, then upload the package we just built
|
||||||
with:
|
# to the github releases page.
|
||||||
cache-enabled: 'false'
|
- name: Upload Release Assets (if requested)
|
||||||
- name: Build Python wheels and smoke test.
|
if: github.event.inputs.release_id != ''
|
||||||
run: |
|
id: upload-release-assets
|
||||||
cd $GITHUB_WORKSPACE
|
uses: dwenegar/upload-release-assets@v1
|
||||||
TM_PACKAGE_VERSION=${{ github.event.inputs.python_package_version }}
|
env:
|
||||||
printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" $TM_PACKAGE_VERSION > ./torch_mlir_package_version
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
TM_PYTHON_VERSIONS=${{ matrix.py_version }} TM_PACKAGES=${{ matrix.package }} ./build_tools/python_deploy/build_linux_packages.sh
|
with:
|
||||||
|
release_id: ${{ github.event.inputs.release_id }}
|
||||||
|
assets_path: ./build_tools/python_deploy/wheelhouse/torch*.whl
|
||||||
|
# Publishing is necessary to make the release visible to `pip`
|
||||||
|
# on the github releases page.
|
||||||
|
- name: Publish Release (if requested)
|
||||||
|
if: github.event.inputs.release_id != ''
|
||||||
|
id: publish_release
|
||||||
|
uses: eregon/publish-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
|
with:
|
||||||
|
release_id: ${{ github.event.inputs.release_id }}
|
||||||
|
- name: Create dist directory
|
||||||
|
if: github.event.inputs.release_id != ''
|
||||||
|
run: mkdir dist
|
||||||
|
- name: Copy releases to publish to dist directory
|
||||||
|
if: github.event.inputs.release_id != ''
|
||||||
|
run: cp build_tools/python_deploy/wheelhouse/torch_mlir*.whl dist/
|
||||||
|
|
||||||
# If we were given a release_id, then upload the package we just built
|
# Wheels must be published from a linux environment.
|
||||||
# to the github releases page.
|
#
|
||||||
- name: Upload Release Assets (if requested)
|
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
||||||
if: github.event.inputs.release_id != ''
|
- name: Store the binary wheel
|
||||||
id: upload-release-assets
|
uses: actions/upload-artifact@v2
|
||||||
uses: dwenegar/upload-release-assets@v1
|
with:
|
||||||
env:
|
name: wheels
|
||||||
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
path: dist
|
||||||
with:
|
|
||||||
release_id: ${{ github.event.inputs.release_id }}
|
|
||||||
assets_path: ./build_tools/python_deploy/wheelhouse/torch*.whl
|
|
||||||
# Publishing is necessary to make the release visible to `pip`
|
|
||||||
# on the github releases page.
|
|
||||||
- name: Publish Release (if requested)
|
|
||||||
if: github.event.inputs.release_id != ''
|
|
||||||
id: publish_release
|
|
||||||
uses: eregon/publish-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
|
||||||
with:
|
|
||||||
release_id: ${{ github.event.inputs.release_id }}
|
|
||||||
- name: Create dist directory
|
|
||||||
if: github.event.inputs.release_id != ''
|
|
||||||
run: mkdir dist
|
|
||||||
- name: Copy releases to publish to dist directory
|
|
||||||
if: github.event.inputs.release_id != ''
|
|
||||||
run: cp build_tools/python_deploy/wheelhouse/torch_mlir*.whl dist/
|
|
||||||
|
|
||||||
# Wheels must be published from a linux environment.
|
|
||||||
#
|
|
||||||
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
|
||||||
- name: Store the binary wheel
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: wheels
|
|
||||||
path: dist
|
|
||||||
|
|
||||||
build_linux_arm64:
|
build_linux_arm64:
|
||||||
name: Manylinux arm64 Build
|
name: Manylinux arm64 Build
|
||||||
runs-on: linux-arm64
|
runs-on: linux-arm64
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
package: [ torch-mlir ]
|
package: [torch-mlir]
|
||||||
py_version: [ cp311-cp311 ]
|
py_version: [cp311-cp311]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare workspace
|
||||||
|
run: |
|
||||||
|
# Clear the workspace directory so that we don't run into errors about
|
||||||
|
# existing lock files.
|
||||||
|
sudo rm -rf $GITHUB_WORKSPACE/*
|
||||||
|
|
||||||
- name: Prepare workspace
|
- name: Get torch-mlir
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
# Clear the workspace directory so that we don't run into errors about
|
with:
|
||||||
# existing lock files.
|
submodules: 'true'
|
||||||
sudo rm -rf $GITHUB_WORKSPACE/*
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get torch-mlir
|
- uses: ./.github/actions/setup-build
|
||||||
uses: actions/checkout@v3
|
with:
|
||||||
with:
|
cache-enabled: 'false'
|
||||||
submodules: 'true'
|
- name: Build Python wheels and smoke test.
|
||||||
fetch-depth: 0
|
run: |
|
||||||
|
cd $GITHUB_WORKSPACE
|
||||||
|
TM_PACKAGE_VERSION=${{ github.event.inputs.python_package_version }}
|
||||||
|
printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" $TM_PACKAGE_VERSION > ./torch_mlir_package_version
|
||||||
|
TM_PYTHON_VERSIONS=${{ matrix.py_version }} TM_PACKAGES=${{ matrix.package }} TORCH_MLIR_ENABLE_LTC='0' ./build_tools/python_deploy/build_linux_packages.sh
|
||||||
|
|
||||||
- uses: ./.github/actions/setup-build
|
# If we were given a release_id, then upload the package we just built
|
||||||
with:
|
# to the github releases page.
|
||||||
cache-enabled: 'false'
|
- name: Upload Release Assets (if requested)
|
||||||
- name: Build Python wheels and smoke test.
|
if: github.event.inputs.release_id != ''
|
||||||
run: |
|
id: upload-release-assets
|
||||||
cd $GITHUB_WORKSPACE
|
uses: dwenegar/upload-release-assets@v1
|
||||||
TM_PACKAGE_VERSION=${{ github.event.inputs.python_package_version }}
|
env:
|
||||||
printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" $TM_PACKAGE_VERSION > ./torch_mlir_package_version
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
TM_PYTHON_VERSIONS=${{ matrix.py_version }} TM_PACKAGES=${{ matrix.package }} TORCH_MLIR_ENABLE_LTC='0' ./build_tools/python_deploy/build_linux_packages.sh
|
with:
|
||||||
|
release_id: ${{ github.event.inputs.release_id }}
|
||||||
|
assets_path: ./build_tools/python_deploy/wheelhouse/torch*.whl
|
||||||
|
# Publishing is necessary to make the release visible to `pip`
|
||||||
|
# on the github releases page.
|
||||||
|
- name: Publish Release (if requested)
|
||||||
|
if: github.event.inputs.release_id != ''
|
||||||
|
id: publish_release
|
||||||
|
uses: eregon/publish-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
|
with:
|
||||||
|
release_id: ${{ github.event.inputs.release_id }}
|
||||||
|
- name: Create dist directory
|
||||||
|
if: github.event.inputs.release_id != ''
|
||||||
|
run: mkdir dist
|
||||||
|
- name: Copy releases to publish to dist directory
|
||||||
|
if: github.event.inputs.release_id != ''
|
||||||
|
run: cp build_tools/python_deploy/wheelhouse/torch_mlir*.whl dist/
|
||||||
|
|
||||||
# If we were given a release_id, then upload the package we just built
|
# Wheels must be published from a linux environment.
|
||||||
# to the github releases page.
|
#
|
||||||
- name: Upload Release Assets (if requested)
|
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
||||||
if: github.event.inputs.release_id != ''
|
- name: Store the binary wheel
|
||||||
id: upload-release-assets
|
uses: actions/upload-artifact@v2
|
||||||
uses: dwenegar/upload-release-assets@v1
|
with:
|
||||||
env:
|
name: wheels
|
||||||
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
path: dist
|
||||||
with:
|
|
||||||
release_id: ${{ github.event.inputs.release_id }}
|
|
||||||
assets_path: ./build_tools/python_deploy/wheelhouse/torch*.whl
|
|
||||||
# Publishing is necessary to make the release visible to `pip`
|
|
||||||
# on the github releases page.
|
|
||||||
- name: Publish Release (if requested)
|
|
||||||
if: github.event.inputs.release_id != ''
|
|
||||||
id: publish_release
|
|
||||||
uses: eregon/publish-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
|
||||||
with:
|
|
||||||
release_id: ${{ github.event.inputs.release_id }}
|
|
||||||
- name: Create dist directory
|
|
||||||
if: github.event.inputs.release_id != ''
|
|
||||||
run: mkdir dist
|
|
||||||
- name: Copy releases to publish to dist directory
|
|
||||||
if: github.event.inputs.release_id != ''
|
|
||||||
run: cp build_tools/python_deploy/wheelhouse/torch_mlir*.whl dist/
|
|
||||||
|
|
||||||
# Wheels must be published from a linux environment.
|
|
||||||
#
|
|
||||||
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
|
||||||
- name: Store the binary wheel
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: wheels
|
|
||||||
path: dist
|
|
||||||
|
|
||||||
build_macos:
|
build_macos:
|
||||||
name: MacOS Build
|
name: MacOS Build
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
package: [ torch-mlir ]
|
package: [torch-mlir]
|
||||||
steps:
|
steps:
|
||||||
- name: Get torch-mlir
|
- name: Get torch-mlir
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
- uses: ./.github/actions/setup-build
|
- uses: ./.github/actions/setup-build
|
||||||
with:
|
with:
|
||||||
cache-enabled: 'false'
|
cache-enabled: 'false'
|
||||||
- name: Build Python wheels and smoke test.
|
- name: Build Python wheels and smoke test.
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
python -m pip install wheel
|
python -m pip install wheel
|
||||||
TM_PACKAGE_VERSION=${{ github.event.inputs.python_package_version }}
|
TM_PACKAGE_VERSION=${{ github.event.inputs.python_package_version }}
|
||||||
printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" $TM_PACKAGE_VERSION > ./torch_mlir_package_version
|
printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" $TM_PACKAGE_VERSION > ./torch_mlir_package_version
|
||||||
sudo ./build_tools/python_deploy/install_macos_deps.sh
|
sudo ./build_tools/python_deploy/install_macos_deps.sh
|
||||||
packages=${{ matrix.package }} TORCH_MLIR_PYTHON_VERSIONS="3.11" ./build_tools/python_deploy/build_macos_packages.sh
|
packages=${{ matrix.package }} TORCH_MLIR_PYTHON_VERSIONS="3.11" ./build_tools/python_deploy/build_macos_packages.sh
|
||||||
|
|
||||||
# If we were given a release_id, then upload the package we just built
|
# If we were given a release_id, then upload the package we just built
|
||||||
# to the github releases page.
|
# to the github releases page.
|
||||||
- name: Upload Release Assets (if requested)
|
- name: Upload Release Assets (if requested)
|
||||||
if: github.event.inputs.release_id != ''
|
if: github.event.inputs.release_id != ''
|
||||||
id: upload-release-assets
|
id: upload-release-assets
|
||||||
uses: dwenegar/upload-release-assets@v1
|
uses: dwenegar/upload-release-assets@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
with:
|
with:
|
||||||
release_id: ${{ github.event.inputs.release_id }}
|
release_id: ${{ github.event.inputs.release_id }}
|
||||||
assets_path: ./build_tools/python_deploy/wheelhouse/torch*.whl
|
assets_path: ./build_tools/python_deploy/wheelhouse/torch*.whl
|
||||||
# Publishing is necessary to make the release visible to `pip`
|
# Publishing is necessary to make the release visible to `pip`
|
||||||
# on the github releases page.
|
# on the github releases page.
|
||||||
- name: Publish Release (if requested)
|
- name: Publish Release (if requested)
|
||||||
if: github.event.inputs.release_id != ''
|
if: github.event.inputs.release_id != ''
|
||||||
id: publish_release
|
id: publish_release
|
||||||
uses: eregon/publish-release@v1
|
uses: eregon/publish-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
with:
|
with:
|
||||||
release_id: ${{ github.event.inputs.release_id }}
|
release_id: ${{ github.event.inputs.release_id }}
|
||||||
- name: Create dist directory
|
- name: Create dist directory
|
||||||
if: github.event.inputs.release_id != ''
|
if: github.event.inputs.release_id != ''
|
||||||
run: mkdir dist
|
run: mkdir dist
|
||||||
- name: Copy releases to publish to dist directory
|
- name: Copy releases to publish to dist directory
|
||||||
if: github.event.inputs.release_id != ''
|
if: github.event.inputs.release_id != ''
|
||||||
run: cp build_tools/python_deploy/wheelhouse/torch_mlir*.whl dist/
|
run: cp build_tools/python_deploy/wheelhouse/torch_mlir*.whl dist/
|
||||||
|
|
||||||
# Wheels must be published from a linux environment.
|
# Wheels must be published from a linux environment.
|
||||||
#
|
#
|
||||||
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
||||||
- name: Store the binary wheel
|
- name: Store the binary wheel
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: wheels
|
name: wheels
|
||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
build_windows:
|
build_windows:
|
||||||
name: Windows Build
|
name: Windows Build
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
package: [ torch-mlir ]
|
package: [torch-mlir]
|
||||||
steps:
|
steps:
|
||||||
- name: Get torch-mlir
|
- name: Get torch-mlir
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
- uses: ./.github/actions/setup-build
|
- uses: ./.github/actions/setup-build
|
||||||
with:
|
with:
|
||||||
cache-enabled: 'false'
|
cache-enabled: 'false'
|
||||||
- name: Set up Visual Studio shell
|
- name: Set up Visual Studio shell
|
||||||
uses: egor-tensin/vs-shell@v2
|
uses: egor-tensin/vs-shell@v2
|
||||||
with:
|
with:
|
||||||
arch: x64
|
arch: x64
|
||||||
- name: Build Python wheels and smoke test.
|
- name: Build Python wheels and smoke test.
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$env:TORCH_MLIR_ENABLE_JIT_IR_IMPORTER='1'
|
$env:TORCH_MLIR_ENABLE_JIT_IR_IMPORTER='1'
|
||||||
$env:TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS='0'
|
$env:TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS='0'
|
||||||
$env:TORCH_MLIR_PYTHON_PACKAGE_VERSION = '${{ github.event.inputs.python_package_version }}'
|
$env:TORCH_MLIR_PYTHON_PACKAGE_VERSION = '${{ github.event.inputs.python_package_version }}'
|
||||||
./build_tools/python_deploy/build_windows.ps1
|
./build_tools/python_deploy/build_windows.ps1
|
||||||
|
|
||||||
# If we were given a release_id, then upload the package we just built
|
# If we were given a release_id, then upload the package we just built
|
||||||
# to the github releases page.
|
# to the github releases page.
|
||||||
- name: Upload Release Assets (if requested)
|
- name: Upload Release Assets (if requested)
|
||||||
if: github.event.inputs.release_id != ''
|
if: github.event.inputs.release_id != ''
|
||||||
id: upload-release-assets
|
id: upload-release-assets
|
||||||
uses: dwenegar/upload-release-assets@v1
|
uses: dwenegar/upload-release-assets@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
with:
|
with:
|
||||||
release_id: ${{ github.event.inputs.release_id }}
|
release_id: ${{ github.event.inputs.release_id }}
|
||||||
assets_path: ./wheelhouse/torch*.whl
|
assets_path: ./wheelhouse/torch*.whl
|
||||||
# Publishing is necessary to make the release visible to `pip`
|
# Publishing is necessary to make the release visible to `pip`
|
||||||
# on the github releases page.
|
# on the github releases page.
|
||||||
- name: Publish Release (if requested)
|
- name: Publish Release (if requested)
|
||||||
if: github.event.inputs.release_id != ''
|
if: github.event.inputs.release_id != ''
|
||||||
id: publish_release
|
id: publish_release
|
||||||
uses: eregon/publish-release@v1
|
uses: eregon/publish-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
with:
|
with:
|
||||||
release_id: ${{ github.event.inputs.release_id }}
|
release_id: ${{ github.event.inputs.release_id }}
|
||||||
- name: Create dist directory
|
- name: Create dist directory
|
||||||
if: github.event.inputs.release_id != ''
|
if: github.event.inputs.release_id != ''
|
||||||
run: mkdir dist
|
run: mkdir dist
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: Copy releases to publish to dist directory
|
- name: Copy releases to publish to dist directory
|
||||||
if: github.event.inputs.release_id != ''
|
if: github.event.inputs.release_id != ''
|
||||||
run: cp ./wheelhouse/torch_mlir*.whl dist/
|
run: cp ./wheelhouse/torch_mlir*.whl dist/
|
||||||
|
|
||||||
# Wheels must be published from a linux environment.
|
# Wheels must be published from a linux environment.
|
||||||
#
|
#
|
||||||
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
||||||
- name: Store the binary wheel
|
- name: Store the binary wheel
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: wheels
|
name: wheels
|
||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
publish_releases:
|
publish_releases:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- build_linux
|
- build_linux
|
||||||
- build_linux_arm64
|
- build_linux_arm64
|
||||||
- build_macos
|
- build_macos
|
||||||
- build_windows
|
- build_windows
|
||||||
|
|
||||||
# Publish even if one of the builds failed
|
# Publish even if one of the builds failed
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Invoke Publish Releases Page
|
- name: Invoke Publish Releases Page
|
||||||
uses: benc-uk/workflow-dispatch@v1
|
uses: benc-uk/workflow-dispatch@v1
|
||||||
with:
|
with:
|
||||||
workflow: Publish releases page
|
workflow: Publish releases page
|
||||||
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
|
|
||||||
# Wheels must be published from a linux environment.
|
# Wheels must be published from a linux environment.
|
||||||
#
|
#
|
||||||
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
|
||||||
#
|
#
|
||||||
# We're temporarily disabling pypi publishing until we can fix audit wheel
|
# We're temporarily disabling pypi publishing until we can fix audit wheel
|
||||||
# ODR torch issues. See https://github.com/llvm/torch-mlir/issues/1709
|
# ODR torch issues. See https://github.com/llvm/torch-mlir/issues/1709
|
||||||
#
|
#
|
||||||
#- name: Download wheels for publishing to PyPI
|
#- name: Download wheels for publishing to PyPI
|
||||||
# uses: actions/download-artifact@v3
|
# uses: actions/download-artifact@v3
|
||||||
# with:
|
# with:
|
||||||
# name: wheels
|
# name: wheels
|
||||||
# path: dist
|
# path: dist
|
||||||
#- name: Publish to PyPI
|
#- name: Publish to PyPI
|
||||||
# if: github.event.inputs.release_id != ''
|
# if: github.event.inputs.release_id != ''
|
||||||
# uses: pypa/gh-action-pypi-publish@v1.5.1
|
# uses: pypa/gh-action-pypi-publish@v1.5.1
|
||||||
# with:
|
# with:
|
||||||
# password: ${{ secrets.PYPI_API_TOKEN }}
|
# password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
# See: https://github.com/llvm/torch-mlir/issues/1374
|
# See: https://github.com/llvm/torch-mlir/issues/1374
|
||||||
name: Publish releases page
|
name: Publish releases page
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
name: Lint Checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
static_lint_checks:
|
||||||
|
name: Static Lint Checks
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Validate GitHub Actions yaml files
|
||||||
|
run: |
|
||||||
|
yamllint ./.github/workflows/ ./.github/actions/
|
|
@ -1,3 +1,4 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
name: RollPyTorch Merge
|
name: RollPyTorch Merge
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
@ -15,19 +16,19 @@ jobs:
|
||||||
github.event.workflow_run.conclusion == 'success'
|
github.event.workflow_run.conclusion == 'success'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Fetch the repo first so that the gh command knows where to look for the PR
|
# Fetch the repo first so that the gh command knows where to look for the PR
|
||||||
- name: Fetch Repo
|
- name: Fetch Repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
||||||
|
|
||||||
- name: Merge RollPyTorch PR
|
- name: Merge RollPyTorch PR
|
||||||
run: |
|
run: |
|
||||||
for pr_id in ${{ join(github.event.workflow_run.pull_requests.*.number, ' ') }}
|
for pr_id in ${{ join(github.event.workflow_run.pull_requests.*.number, ' ') }}
|
||||||
do
|
do
|
||||||
echo "Merging PR: $pr_id"
|
echo "Merging PR: $pr_id"
|
||||||
gh pr merge $pr_id --delete-branch --squash
|
gh pr merge $pr_id --delete-branch --squash
|
||||||
done
|
done
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.ROLLPYTORCH_TOKEN1 }}
|
GH_TOKEN: ${{ secrets.ROLLPYTORCH_TOKEN1 }}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
name: Release oneshot snapshot package
|
name: Release oneshot snapshot package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# yamllint disable rule:line-length
|
||||||
name: Release snapshot package
|
name: Release snapshot package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
Loading…
Reference in New Issue