Skip to content

Commit 33337fc

Browse files
authored
Migrate ci.yml to AKS cpubuilder cluster. (#3967)
This commit contains the ccache and python changes neccessary to migrate the ci.yml workflow to an azure kubernetes cpubuilder cluster. Timings before and after the infra change are in the same ballpark (~10 mins). Previously, `test/python/compile.py` was unnecessarily excluding the python site packages, which needed to be changed for the cluster. We also make use of `hendrikmuhs/ccache-action` now and use a key of `${{ github.job }}-${{ matrix.torch-version }}` which works as intended: https://github.com/llvm/torch-mlir/actions/runs/12828039126/job/35771248056#step:7:4657
1 parent 09af3b6 commit 33337fc

File tree

7 files changed

+25
-21
lines changed

7 files changed

+25
-21
lines changed

.github/workflows/ci.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,10 @@ jobs:
2323
matrix:
2424
torch-version: [nightly, stable]
2525
name: Build and Test (Linux, torch-${{ matrix.torch-version }}, assertions)
26-
runs-on: torch-mlir-cpubuilder-manylinux-x86-64
26+
runs-on: torch-mlir-cpubuilder-linux-x86-64-scale
2727
env:
2828
CACHE_DIR: ${{ github.workspace }}/.container-cache
2929
steps:
30-
- name: Configure local git mirrors
31-
run: |
32-
# Our stock runners have access to certain local git caches. If these
33-
# files are available, it will prime the cache and configure git to
34-
# use them. Practically, this eliminates network/latency for cloning
35-
# llvm.
36-
if [[ -x /gitmirror/scripts/trigger_update_mirrors.sh ]]; then
37-
/gitmirror/scripts/trigger_update_mirrors.sh
38-
/gitmirror/scripts/git_config.sh
39-
fi
4030
- name: "Checking out repository"
4131
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
4232
with:
@@ -50,11 +40,25 @@ jobs:
5040
restore-keys: |
5141
build-test-cpp-asserts-manylinux-${{ matrix.torch-version }}-v2-
5242
43+
- name: "Setting up Python"
44+
run: |
45+
sudo apt update
46+
sudo apt install software-properties-common -y
47+
sudo add-apt-repository ppa:deadsnakes/ppa -y
48+
sudo apt install python3.11 python3-pip -y
49+
sudo apt-get install python3.11-dev python3.11-venv build-essential -y
50+
5351
- name: Install python deps (torch-${{ matrix.torch-version }})
5452
run: |
5553
export cache_dir="${{ env.CACHE_DIR }}"
5654
bash build_tools/ci/install_python_deps.sh ${{ matrix.torch-version }}
5755
56+
- name: ccache
57+
uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16
58+
with:
59+
key: ${{ github.job }}-${{ matrix.torch-version }}
60+
save: ${{ needs.setup.outputs.write-caches == 1 }}
61+
5862
- name: Build project
5963
run: |
6064
export cache_dir="${{ env.CACHE_DIR }}"

build_tools/ci/build_posix.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ echo "Caching to ${cache_dir}"
2020
mkdir -p "${cache_dir}/ccache"
2121
mkdir -p "${cache_dir}/pip"
2222

23-
python="$(which python)"
23+
python="$(which python3)"
2424
echo "Using python: $python"
2525

2626
export CMAKE_TOOLCHAIN_FILE="$this_dir/linux_default_toolchain.cmake"
@@ -40,7 +40,7 @@ echo "::group::CMake configure"
4040
cmake -S "$repo_root/externals/llvm-project/llvm" -B "$build_dir" \
4141
-GNinja \
4242
-DCMAKE_BUILD_TYPE=Release \
43-
-DPython3_EXECUTABLE="$(which python)" \
43+
-DPython3_EXECUTABLE="$(which python3)" \
4444
-DLLVM_ENABLE_ASSERTIONS=ON \
4545
-DTORCH_MLIR_ENABLE_WERROR_FLAG=ON \
4646
-DCMAKE_INSTALL_PREFIX="$install_dir" \

build_tools/ci/install_python_deps.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repo_root="$(cd $this_dir/../.. && pwd)"
77
torch_version="${1:-unknown}"
88

99
echo "::group::installing llvm python deps"
10-
python -m pip install --no-cache-dir -r $repo_root/externals/llvm-project/mlir/python/requirements.txt
10+
python3 -m pip install --no-cache-dir -r $repo_root/externals/llvm-project/mlir/python/requirements.txt
1111
echo "::endgroup::"
1212

1313
case $torch_version in
@@ -30,5 +30,5 @@ case $torch_version in
3030
esac
3131

3232
echo "::group::installing test requirements"
33-
python -m pip install --no-cache-dir -r $repo_root/test-requirements.txt
33+
python3 -m pip install --no-cache-dir -r $repo_root/test-requirements.txt
3434
echo "::endgroup::"

build_tools/ci/test_posix.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ torch_version="${1:-unknown}"
99
export PYTHONPATH="$repo_root/build/tools/torch-mlir/python_packages/torch_mlir:$repo_root/projects/pt1"
1010

1111
echo "::group::Run ONNX e2e integration tests"
12-
python -m e2e_testing.main --config=onnx -v
12+
python3 -m e2e_testing.main --config=onnx -v
1313
echo "::endgroup::"
1414

1515
case $torch_version in
@@ -23,12 +23,12 @@ case $torch_version in
2323

2424
# TODO: Need to verify in the stable version
2525
echo "::group::Run FxImporter e2e integration tests"
26-
python -m e2e_testing.main --config=fx_importer -v
26+
python3 -m e2e_testing.main --config=fx_importer -v
2727
echo "::endgroup::"
2828

2929
# TODO: Need to verify in the stable version
3030
echo "::group::Run FxImporter2Stablehlo e2e integration tests"
31-
python -m e2e_testing.main --config=fx_importer_stablehlo -v
31+
python3 -m e2e_testing.main --config=fx_importer_stablehlo -v
3232
echo "::endgroup::"
3333
;;
3434
stable)

build_tools/update_abstract_interp_lib.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fi
4444
# To enable this python package, manually build torch_mlir with:
4545
# -DTORCH_MLIR_ENABLE_JIT_IR_IMPORTER=ON
4646
# TODO: move this package out of JIT_IR_IMPORTER.
47-
PYTHONPATH="${pypath}" python \
47+
PYTHONPATH="${pypath}" python3 \
4848
-m torch_mlir.jit_ir_importer.build_tools.abstract_interp_lib_gen \
4949
--pytorch_op_extensions=${ext_module:-""} \
5050
--torch_transforms_cpp_dir="${torch_transforms_cpp_dir}"

build_tools/update_torch_ods.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ set +u
4545
# To enable this python package, manually build torch_mlir with:
4646
# -DTORCH_MLIR_ENABLE_PYTORCH_EXTENSIONS=ON
4747
# TODO: move this package out of JIT_IR_IMPORTER.
48-
PYTHONPATH="${PYTHONPATH}:${pypath}" python \
48+
PYTHONPATH="${PYTHONPATH}:${pypath}" python3 \
4949
-m torch_mlir.jit_ir_importer.build_tools.torch_ods_gen \
5050
--torch_ir_include_dir="${torch_ir_include_dir}" \
5151
--pytorch_op_extensions="${ext_module}" \

test/python/compile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: %PYTHON -s %s 2>&1 | FileCheck %s
1+
# RUN: %PYTHON %s 2>&1 | FileCheck %s
22

33
import gc
44
import sys

0 commit comments

Comments
 (0)