2022-09-29 04:38:30 +08:00
|
|
|
name: Roll PyTorch
|
|
|
|
|
2022-09-30 06:15:32 +08:00
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 12 * * *'
|
|
|
|
workflow_dispatch:
|
2022-09-29 04:38:30 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_linux:
|
|
|
|
name: Manylinux Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-09-30 06:15:32 +08:00
|
|
|
|
2022-09-29 04:38:30 +08:00
|
|
|
- name: Get torch-mlir
|
2022-09-30 06:15:32 +08:00
|
|
|
uses: actions/checkout@v3
|
2022-09-29 04:38:30 +08:00
|
|
|
with:
|
|
|
|
submodules: 'true'
|
2022-09-30 06:15:32 +08:00
|
|
|
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
|
|
|
|
|
2022-09-29 04:38:30 +08:00
|
|
|
- name: Setup ccache
|
|
|
|
uses: ./.github/actions/setup-build
|
|
|
|
with:
|
|
|
|
cache-suffix: x86_64-out-of-tree-OFF
|
2022-09-30 06:15:32 +08:00
|
|
|
|
2022-09-29 04:38:30 +08:00
|
|
|
- name: Determine nightly PyTorch version
|
|
|
|
run: |
|
|
|
|
cd ${GITHUB_WORKSPACE}
|
|
|
|
python -m pip install wheel
|
|
|
|
# Fetch the most recent nightly PyTorch release
|
|
|
|
PT_RELEASE=$(python -m pip index versions -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --pre torch | grep "Available versions" | tr ' ' '\n' | grep "^[0-9]" | sort --version-sort --reverse | head -n1 | tr -d ',' | sed 's/\([^+]*\).*/\1/')
|
|
|
|
printf -- "-f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html\n--pre\ntorch==%s\n" "${PT_RELEASE}" > pytorch-requirements.txt
|
|
|
|
# Fetch the whl file associated with the nightly release
|
|
|
|
rm -f torch-"${PT_RELEASE}"*.whl
|
|
|
|
python -m pip download -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --pre "torch==${PT_RELEASE}"
|
|
|
|
# Read the commit hash from the downloaded whl file without extracting it
|
|
|
|
PT_HASH=$(unzip -p torch-"${PT_RELEASE}"*.whl torch/version.py | grep git_version | awk '{ print $3 }' | tr -d "'")
|
|
|
|
echo "${PT_HASH}" > pytorch-version.txt
|
|
|
|
rm torch-"${PT_RELEASE}"*.whl
|
|
|
|
# Write the release and hash to the environment file so that we can
|
|
|
|
# retrieve them when creating a PR
|
|
|
|
echo "PT_HASH=${PT_HASH}" >> ${GITHUB_ENV}
|
|
|
|
echo "PT_RELEASE=${PT_RELEASE}" >> ${GITHUB_ENV}
|
2022-09-30 06:15:32 +08:00
|
|
|
|
2022-09-29 04:38:30 +08:00
|
|
|
- name: Build and test
|
|
|
|
run: |
|
|
|
|
cd ${GITHUB_WORKSPACE}
|
|
|
|
TM_PACKAGES="out-of-tree" TM_USE_PYTORCH_BINARY="OFF" \
|
|
|
|
TORCH_MLIR_SRC_PYTORCH_BRANCH="${{ env.PT_HASH }}" \
|
|
|
|
TORCH_MLIR_SRC_PYTORCH_RELEASE="${{ env.PT_RELEASE }}" \
|
|
|
|
./build_tools/python_deploy/build_linux_packages.sh
|
2022-09-29 20:09:16 +08:00
|
|
|
|
2022-09-30 06:15:32 +08:00
|
|
|
- name: Push changes to main branch
|
|
|
|
run: |
|
|
|
|
cd ${GITHUB_WORKSPACE}
|
|
|
|
git config user.email "torch-mlir@users.noreply.github.com"
|
|
|
|
git config user.name "Roll PyTorch Action"
|
|
|
|
git fetch
|
|
|
|
git checkout main
|
|
|
|
git add pytorch-version.txt pytorch-requirements.txt
|
|
|
|
git commit -m "update PyTorch version to ${{ env.PT_RELEASE }}"
|
|
|
|
git push --set-upstream origin main
|