forked from tile-ai/tilelang
-
Notifications
You must be signed in to change notification settings - Fork 0
271 lines (244 loc) · 8.98 KB
/
dist-paddle.yml
File metadata and controls
271 lines (244 loc) · 8.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: Dist Paddle
on:
push:
branches: [paddle]
tags: ["v*"]
pull_request:
merge_group:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
PYTHONDEVMODE: "1"
PYTHONUNBUFFERED: "1"
COLUMNS: "100"
FORCE_COLOR: "1"
CLICOLOR_FORCE: "1"
UV_INDEX_STRATEGY: "unsafe-best-match"
UV_HTTP_TIMEOUT: "600"
XDG_CACHE_HOME: "${{ github.workspace }}/.cache" # to be updated
PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip" # to be updated
UV_CACHE_DIR: "${{ github.workspace }}/.cache/uv" # to be updated
jobs:
build-sdist:
name: Build SDist
runs-on: macos-latest
timeout-minutes: 45
env:
# `NO_VERSION_LABEL=ON` disables embedding the toolchain / git commit hash in version metadata.
# Otherwise, the version of the SDist has a git hash suffix (e.g., 0.1.0+gitabcdef12),
# but the package built from the SDist has no way to get the git hash (it is not a git repo),
# leading to inconsistent versions between SDist and built packages (+gitabcdef12 vs. +gitunknown).
NO_VERSION_LABEL: "ON"
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1
submodules: recursive
- name: Setup Python and uv with caching
id: setup-uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
activate-environment: true
- name: Build SDist
run: |
uv run --no-project --with=build -m -- build --sdist --outdir=dist
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
max-size: "200MB"
create-symlink: true
evict-old-files: "7d"
append-timestamp: false
key: sdist-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
sdist-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.cc') }}
sdist-${{ runner.os }}-${{ runner.arch }}
${{ runner.os }}-${{ runner.arch }}
- name: Test SDist buildable
run: |
TEMP_DIR="$(mktemp -d -t tilelang-sdist-test)"
cp -r dist "${TEMP_DIR}/dist"
cd "${TEMP_DIR}"
uv pip install -v dist/*.tar.gz
# python3 -c "import tilelang; print(tilelang.__version__)"
- name: Upload SDist
# Not PR to save artifact storage, as SDist is only needed for releases.
uses: actions/upload-artifact@v6
with:
name: sdist
path: dist/*.tar.gz
if-no-files-found: error
build-wheels:
name: Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.target.runner }} with ${{ matrix.target.toolkit }}
strategy:
matrix:
target:
- { runner: ubuntu-latest, toolkit: "CUDA-12.8", test_backends: "cu118 cu130" }
- { runner: ubuntu-24.04-arm, toolkit: "CUDA-12.8", test_backends: "cu126 cu130" }
- { runner: macos-latest, toolkit: "Metal" }
python-version:
# Build wheels for different Python ABIs
- "3.9"
# - "3.14t" # let user to build from source for now
# TODO: Add cp315-abi3.abi3t after PEP 803
include:
# map build version to test version
# Python 3.9 implicitly restrict torch version (e.g. on arm64).
# This test rely on torch to provide libnvrtc, so we need a rather new torch.
- { python-version: "3.9", test-python-version: "3.12" }
# - { python-version: "3.14t", test-python-version: "3.14t" }
fail-fast: false
timeout-minutes: 120
runs-on: ${{ matrix.target.runner }}
env:
IS_RELEASE: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, '[Release]') }}
NO_VERSION_LABEL: "OFF"
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1
submodules: recursive
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
max-size: "200MB"
create-symlink: true
evict-old-files: "7d"
append-timestamp: false
key: wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ hashFiles('**/*.cc') }}
wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
wheel-${{ runner.os }}-${{ runner.arch }}
- name: Set CIBW_BUILD
run: |
PYTHON_VERSION="${{ matrix.python-version }}"
PYTHON_VERSION_MAJMIN="$(echo "${PYTHON_VERSION}" | cut -d '.' -f-2)"
PYTHON_VERSION_MAJMIN_NODOT="${PYTHON_VERSION_MAJMIN//./}"
echo "CIBW_BUILD=cp${PYTHON_VERSION_MAJMIN_NODOT}-*" | tee -a "${GITHUB_ENV}"
if [[ "${{ matrix.target.toolkit }}" == *"CUDA"* ]]; then
CUDA_VERSION="${{ matrix.target.toolkit }}"
CUDA_VERSION="${CUDA_VERSION##*-}"
CUDA_VERSION_MAJMIN="$(echo ${CUDA_VERSION} | cut -d '.' -f-2)"
CUDA_VERSION_MAJMIN_NODOT="${CUDA_VERSION_MAJMIN//./}"
echo "UV_TORCH_BACKEND=cu${CUDA_VERSION_MAJMIN_NODOT}" | tee -a "${GITHUB_ENV}"
fi
if [[ "${{ env.IS_RELEASE }}" == "true" ]]; then
echo "NO_VERSION_LABEL=ON" | tee -a "${GITHUB_ENV}"
fi
if [[ "${{ runner.os }}" == "Linux" ]]; then
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"
echo "CIBW_BEFORE_BUILD_LINUX=dnf install -y ccache && ccache -o cache_dir=/host${HOST_CCACHE_DIR}" | tee -a "${GITHUB_ENV}"
fi
- name: Build wheels
uses: pypa/cibuildwheel@v3.2
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- name: Setup Python and uv with caching
id: setup-uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- name: Test built wheels
run: |
for WHEEL in wheelhouse/*.whl; do
echo "Testing wheel: ${WHEEL}"
if [[ "${WHEEL}" == *"abi3"* ]]; then
uvx abi3audit --verbose --strict "${WHEEL}"
fi
(
set -e
uv venv test-venv
source test-venv/bin/activate
uv pip install -v "${WHEEL}"
(
set -e
cd /
# uv run --no-project -- python -c "import tilelang; print(tilelang.__version__)"
)
deactivate
rm -rf test-venv
)
done
- name: Upload wheels
# Not PR to save artifact storage, as wheels are only needed for releases.
uses: actions/upload-artifact@v6
with:
name: wheels-${{ matrix.python-version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
path: wheelhouse/*.whl
if-no-files-found: error
list-artifacts:
name: List artifacts
# Not PR to save artifact storage, as artifacts are only needed for releases.
runs-on: ubuntu-latest
needs: [build-sdist, build-wheels]
timeout-minutes: 15
steps:
- name: Download built SDist
uses: actions/download-artifact@v7
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: sdist
path: dist
- name: Download built wheels
uses: actions/download-artifact@v7
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: List distributions
run: ls -lh dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: artifacts
path: dist/*
if-no-files-found: error
publish-pypi:
runs-on: ubuntu-latest
name: Publish to PyPI
if: "startsWith(github.ref, 'refs/tags/')"
needs:
- list-artifacts
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v7
with:
name: artifacts
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-release:
runs-on: ubuntu-latest
name: Publish to GitHub
if: "startsWith(github.ref, 'refs/tags/')"
needs:
- list-artifacts
permissions:
contents: write
steps:
- uses: actions/download-artifact@v7
with:
name: artifacts
path: dist/
- name: Get tag name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Publish to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
files: dist/*
tag_name: ${{ env.RELEASE_VERSION }}