Skip to content

Commit eaa6bf4

Browse files
committed
[CI] Add standalone TIRx build, wheel, and docs pipelines
Build pinned FFI and TIRx wheels from the standalone root and run CPU, GPU, ARM, Windows, and macOS jobs. Build the Python API documentation alongside GPU tests using the built wheels, and publish only the tirx site subtree from an explicitly enabled main pipeline. Validate the archive revision and publication scope. Run the existing lint workflow on standalone branch pushes. Share environment setup, CPU detection, and release wheel builds through composite actions adapted to the standalone repository layout.
1 parent 9e1ffc5 commit eaa6bf4

40 files changed

Lines changed: 3271 additions & 37 deletions

‎.asf.yaml‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ github:
1919
description: "Open ML Compiler Foundation"
2020
homepage: https://tvm.apache.org/
2121
labels:
22-
- tvm
2322
- compiler
2423
- tirx
2524
- gpu
@@ -28,11 +27,6 @@ github:
2827
issues: true
2928
projects: true
3029

31-
protected_branches:
32-
main:
33-
required_pull_request_reviews:
34-
required_approving_review_count: 1
35-
3630
enabled_merge_buttons:
3731
squash: true
3832
squash_commit_message: PR_TITLE_AND_DESC
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Build TIRx Wheel
19+
description: >
20+
Build and test the standalone LLVM-enabled apache-tvm-tirx wheel for a given OS/architecture
21+
combination using cibuildwheel.
22+
23+
inputs:
24+
arch:
25+
description: "Target architecture for cibuildwheel (e.g., x86_64, aarch64, arm64, AMD64)"
26+
required: true
27+
build:
28+
description: "cibuildwheel build selector (e.g., cp310-manylinux_x86_64)"
29+
required: true
30+
cmake_defines:
31+
description: "Feature CMake defines that vary by wheel (e.g. -DTVM_TIRX_USE_METAL=ON on macOS)"
32+
required: false
33+
default: ""
34+
include_cuda_runtime:
35+
description: "Set to 1 to build and inject the CUDA runtime library (Linux only)"
36+
required: false
37+
default: "0"
38+
39+
runs:
40+
using: "composite"
41+
steps:
42+
# Single source of truth for the LLVM toolchain version, shared by the cache
43+
# key and the conda install steps below.
44+
- name: Set LLVM version
45+
shell: bash
46+
run: echo "LLVM_VERSION=22.1.0" >> "$GITHUB_ENV"
47+
48+
- name: Prepare LLVM cache path (Unix)
49+
if: runner.os != 'Windows'
50+
shell: bash
51+
run: |
52+
set -eux
53+
sudo mkdir -p /opt/llvm
54+
sudo chown -R "$(whoami)" /opt/llvm
55+
56+
# ---- Cache LLVM prefix ----
57+
- name: Cache LLVM
58+
uses: actions/cache@v5.0.5
59+
id: llvm-cache
60+
with:
61+
path: ${{ runner.os == 'Windows' && 'C:/opt/llvm' || '/opt/llvm' }}
62+
key: tirx-wheel-llvm-${{ env.LLVM_VERSION }}-${{ runner.os }}-${{ inputs.arch }}-v6
63+
64+
# ---- Install LLVM via conda (cache miss only) ----
65+
- name: Setup conda
66+
if: steps.llvm-cache.outputs.cache-hit != 'true'
67+
uses: conda-incubator/setup-miniconda@v4.0.1
68+
continue-on-error: true
69+
id: conda1
70+
with:
71+
miniforge-version: latest
72+
conda-remove-defaults: true
73+
74+
- name: Setup conda (retry with tar.bz2)
75+
if: steps.llvm-cache.outputs.cache-hit != 'true' && steps.conda1.outcome == 'failure'
76+
uses: conda-incubator/setup-miniconda@v4.0.1
77+
with:
78+
miniforge-version: latest
79+
use-only-tar-bz2: true
80+
conda-remove-defaults: true
81+
82+
- name: Install LLVM (Unix)
83+
if: steps.llvm-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
84+
shell: bash -l {0}
85+
run: |
86+
set -eux
87+
if [[ "${RUNNER_OS}" == "Linux" ]]; then
88+
sudo mkdir -p /opt/llvm
89+
sudo chown -R "$(whoami)" /opt/llvm
90+
fi
91+
conda create -q -p /opt/llvm -c conda-forge \
92+
"llvmdev=${LLVM_VERSION}" "clangdev=${LLVM_VERSION}" "compiler-rt=${LLVM_VERSION}" zlib zstd-static libxml2-devel \
93+
-y
94+
95+
- name: Install LLVM (Windows)
96+
if: steps.llvm-cache.outputs.cache-hit != 'true' && runner.os == 'Windows'
97+
shell: cmd /C call {0}
98+
run: |
99+
call conda create -q -p C:\opt\llvm -c conda-forge llvmdev=%LLVM_VERSION% zlib zstd-static libxml2-devel -y
100+
101+
# The {project} placeholder is not expanded inside CIBW_ENVIRONMENT values, so
102+
# compute the forward-slash host path here (the Windows analog of the Linux
103+
# /project hardcode).
104+
- name: Compute CUDA sidecar path (Windows)
105+
if: runner.os == 'Windows' && inputs.include_cuda_runtime == '1'
106+
shell: bash
107+
run: echo "TVM_CUDA_EXTRA_LIB=$(cygpath -m "$(pwd)")/build-wheel-cuda/lib/tvm_runtime_cuda.dll" >> "$GITHUB_ENV"
108+
109+
# ---- Build and test wheels ----
110+
- name: Build and test TIRx core wheel
111+
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
112+
with:
113+
package-dir: .
114+
output-dir: wheelhouse
115+
env:
116+
CIBW_BUILD: ${{ inputs.build }}
117+
CIBW_ARCHS_LINUX: ${{ inputs.arch }}
118+
CIBW_ARCHS_MACOS: ${{ inputs.arch }}
119+
CIBW_ARCHS_WINDOWS: ${{ inputs.arch }}
120+
# Linux builds run in cibuildwheel's default manylinux_2_28 container;
121+
# bind-mount the cached LLVM prefix into it. Ignored on macOS/Windows,
122+
# which build without a container.
123+
CIBW_CONTAINER_ENGINE: "docker; create_args: --volume /opt/llvm:/opt/llvm:ro"
124+
# Each per-OS block carries the toolchain location (conda LLVM prefix +
125+
# llvm-config path), the universal static-link policy (TVM_TIRX_USE_LLVM --link-static
126+
# and ZLIB_USE_STATIC_LIBS), and the CUDA sidecar. Feature defines that vary by
127+
# wheel (e.g. TVM_TIRX_USE_METAL on macOS) come from the matrix via inputs.cmake_defines.
128+
# One explicit block per build platform (macOS / Linux / Windows); cibuildwheel
129+
# env overrides replace rather than merge, so there is no shared base block.
130+
CIBW_ENVIRONMENT_MACOS: >-
131+
CMAKE_PREFIX_PATH="/opt/llvm"
132+
CMAKE_ARGS="-DTVM_TIRX_USE_LLVM='/opt/llvm/bin/llvm-config --link-static' -DZLIB_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH=/opt/llvm ${{ inputs.cmake_defines }}"
133+
CIBW_ENVIRONMENT_LINUX: >-
134+
CMAKE_PREFIX_PATH="/opt/llvm"
135+
LIBRARY_PATH="/opt/llvm/lib"
136+
CMAKE_ARGS="-DTVM_TIRX_USE_LLVM='/opt/llvm/bin/llvm-config --link-static' -DZLIB_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH=/opt/llvm ${{ inputs.cmake_defines }} -DTVM_TIRX_PACKAGE_EXTRA_LIBS=/project/build-wheel-cuda/lib/libtvm_runtime_cuda.so"
137+
CIBW_ENVIRONMENT_WINDOWS: >-
138+
CMAKE_PREFIX_PATH="C:/opt/llvm/Library"
139+
PATH="C:/opt/llvm/Library/bin;$PATH"
140+
CMAKE_ARGS="-DTVM_TIRX_USE_LLVM='C:/opt/llvm/Library/bin/llvm-config.exe --link-static' -DZLIB_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH=C:/opt/llvm/Library ${{ inputs.cmake_defines }} -DTVM_TIRX_PACKAGE_EXTRA_LIBS=${{ env.TVM_CUDA_EXTRA_LIB }}"
141+
# Turns the wheel-specific assertions in
142+
# tests/python/runtime/test_validate_wheel_library.py
143+
# ON (they skip unless these are set). Every published wheel is LLVM-enabled,
144+
# so TVM_WHEEL_EXPECT_LLVM is always "1"; the CUDA runtime is only bundled on
145+
# the CUDA wheels, so TVM_WHEEL_EXPECT_CUDA_RUNTIME is "0" for CPU wheels.
146+
CIBW_TEST_ENVIRONMENT: >-
147+
TVM_WHEEL_EXPECT_LLVM="1"
148+
TVM_WHEEL_EXPECT_CUDA_RUNTIME="${{ inputs.include_cuda_runtime }}"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Detect Environment Variables
19+
description: Detects environment variables such as CPU count and sets them as outputs.
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Run Python to detect environment variables
24+
shell: python
25+
id: detect
26+
run: |
27+
import multiprocessing, os
28+
29+
output_file = open(os.environ.get("GITHUB_OUTPUT"), "a")
30+
31+
def write_env_var(name, value):
32+
output_file.write(f"{name}={value}\n")
33+
print(f"Detected environment variable: {name}={value}")
34+
35+
write_env_var("cpu_count", multiprocessing.cpu_count())
36+
37+
outputs:
38+
cpu_count:
39+
description: "The number of CPU cores"
40+
value: ${{ steps.detect.outputs.cpu_count }}

‎.github/actions/setup/action.yml‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Setup TVM CI environment
19+
description: Set up the cached conda build environment and install tvm-ffi.
20+
21+
runs:
22+
using: "composite"
23+
steps:
24+
- uses: actions/cache@v5.0.5
25+
env:
26+
CACHE_NUMBER: 2
27+
with:
28+
path: ~/conda_pkgs_dir
29+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/wheel/build-environment.yaml') }}
30+
- uses: conda-incubator/setup-miniconda@v4.0.1
31+
continue-on-error: true
32+
id: conda1
33+
with:
34+
activate-environment: tvm-build
35+
channel-priority: strict
36+
environment-file: ci/wheel/build-environment.yaml
37+
auto-activate-base: false
38+
miniforge-version: latest
39+
python-version: "3.10"
40+
conda-remove-defaults: true
41+
- uses: conda-incubator/setup-miniconda@v4.0.1
42+
if: steps.conda1.outcome == 'failure'
43+
with:
44+
activate-environment: tvm-build
45+
channel-priority: strict
46+
environment-file: ci/wheel/build-environment.yaml
47+
auto-activate-base: false
48+
miniforge-version: latest
49+
use-only-tar-bz2: true
50+
python-version: "3.10"
51+
conda-remove-defaults: true
52+
- name: Conda info
53+
shell: pwsh
54+
run: |
55+
mamba info
56+
mamba list
57+
mamba info --envs
58+
mamba list --name base
59+
- name: Install tvm-ffi pip package
60+
shell: bash -l {0}
61+
run: |
62+
pip install -v ./3rdparty/tvm-ffi

‎.github/workflows/lint.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ name: Lint
1919

2020
on:
2121
push:
22-
branches: [main]
22+
branches: [main, tirx-standalone-root]
2323
pull_request:
2424
branches: [main]
2525

0 commit comments

Comments
 (0)