Skip to content

Commit af3c90f

Browse files
committed
[CI] Add manylinux auditwheel repair
1 parent bce288b commit af3c90f

File tree

16 files changed

+748
-22
lines changed

16 files changed

+748
-22
lines changed

.github/workflows/mlir-tensorrt-build-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_call:
55
inputs:
66
channel:
7-
description: 'Channel, valid values are "nightly", "test", or "release"'
7+
description: 'Channel, valid values are "nightly", "test", "release" or "pypi-release"'
88
default: "test"
99
type: string
1010
build-matrix:
@@ -26,7 +26,7 @@ jobs:
2626
env:
2727
# eg. TENSORRT_VERSION: 10.12 or 10.13
2828
MLIR_TRT_DOWNLOAD_TENSORRT_VERSION: ${{ matrix.trt }}
29-
# eg. CHANNEL: nightly, test or release
29+
# eg. CHANNEL: nightly, test, release or pypi-release
3030
CHANNEL: ${{ inputs.channel }}
3131
ARCH: ${{ matrix.arch }}
3232
CMAKE_PRESET: ${{ matrix.cmake_preset }}

.github/workflows/mlir-tensorrt-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
# this is for PR CI, it will be triggered by PRs via copy-pr-bot
66
# it does not support path filtering
77
branches:
8-
- "pull-request/[0-9]+"
8+
#- "pull-request/[0-9]+"
99
- "main"
1010
# this is for release CI
1111
tags:
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
name: MLIR-TensorRT PyPI Release CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "pull-request/[0-9]+"
7+
workflow_dispatch:
8+
inputs:
9+
confirm_publish_to_pypi:
10+
description: 'I confirm that I have verified version to be published to pypi.org'
11+
required: true
12+
type: boolean
13+
default: false
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
jobs:
20+
generate-matrix:
21+
name: Generate Build Matrix (pypi-release)
22+
runs-on: ubuntu-latest
23+
outputs:
24+
matrix: ${{ steps.generate-matrix.outputs.matrix }}
25+
steps:
26+
- uses: actions/checkout@v6
27+
with:
28+
fetch-depth: 5
29+
- name: Generate Build Matrix
30+
id: generate-matrix
31+
run: |
32+
set -euo pipefail
33+
set -x
34+
MATRIX_BLOB="$(python3 ./.github/workflows/mlir-tensorrt/generate-matrix.py --channel pypi-release)"
35+
echo "${MATRIX_BLOB}"
36+
echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
37+
38+
pypi-release-wheels-build:
39+
name: ${{ matrix.arch}} - Build PyPI Release Wheels
40+
needs:
41+
- generate-matrix
42+
permissions:
43+
id-token: write
44+
packages: write
45+
contents: read
46+
strategy:
47+
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
48+
runs-on: ${{ matrix.github_runner }}
49+
env:
50+
MLIR_TRT_DOWNLOAD_TENSORRT_VERSION: ${{ matrix.trt }}
51+
CMAKE_PRESET: ${{ matrix.cmake_preset }}
52+
CCACHE_RESTORE_KEY: mlir-tensorrt-ccache-v1-${{ matrix.arch }}-${{ matrix.cmake_preset }}
53+
CPM_RESTORE_KEY: mlir-tensorrt-cpm-v1
54+
timeout-minutes: 120
55+
container:
56+
# pypi audit wheel repair requires rockylinux8
57+
image: ${{ matrix.docker_image }}
58+
options: >-
59+
--gpus all
60+
--shm-size=1g
61+
steps:
62+
- name: Checkout TensorRT-Incubator
63+
uses: actions/checkout@v6
64+
with:
65+
fetch-depth: 5
66+
67+
- name: Create Cache Folders
68+
run: |
69+
set -euo pipefail
70+
set -x
71+
export CPM_SOURCE_CACHE=${GITHUB_WORKSPACE}/mlir-tensorrt/.cache.cpm
72+
export CCACHE_DIR=${GITHUB_WORKSPACE}/mlir-tensorrt/ccache
73+
74+
echo "CPM_SOURCE_CACHE=$CPM_SOURCE_CACHE" >> "$GITHUB_ENV"
75+
echo "CCACHE_DIR=$CCACHE_DIR" >> "$GITHUB_ENV"
76+
77+
mkdir -p ${CCACHE_DIR}
78+
mkdir -p ${CPM_SOURCE_CACHE}
79+
80+
- name: Compute CCache Key
81+
id: ccache-key
82+
run: |
83+
hash=$( (find mlir-tensorrt/compiler \
84+
mlir-tensorrt/common \
85+
mlir-tensorrt/kernel \
86+
mlir-tensorrt/tensorrt \
87+
mlir-tensorrt/integrations \
88+
mlir-tensorrt/executor \
89+
-type f \( -name '*.cpp' -o -name '*.h' \) \
90+
-exec sha256sum {} \; ; \
91+
sha256sum mlir-tensorrt/DependencyProvider.cmake \
92+
mlir-tensorrt/CMakeLists.txt) \
93+
| sort | sha256sum | cut -d' ' -f1)
94+
echo "key=${{ env.CCACHE_RESTORE_KEY }}-${hash}" >> $GITHUB_OUTPUT
95+
96+
- name: Compute CPM Key
97+
id: cpm-key
98+
run: |
99+
hash=$(sha256sum mlir-tensorrt/DependencyProvider.cmake | cut -d' ' -f1)
100+
echo "key=${{ env.CPM_RESTORE_KEY }}-${hash}" >> $GITHUB_OUTPUT
101+
102+
- name: Restore CCache
103+
id: restore-ccache
104+
uses: actions/cache/restore@v4
105+
with:
106+
key: ${{ steps.ccache-key.outputs.key }}
107+
restore-keys: |
108+
${{ env.CCACHE_RESTORE_KEY }}
109+
path: |
110+
${{ env.CCACHE_DIR }}
111+
112+
- name: Restore CPM cache
113+
id: restore-cpm
114+
uses: actions/cache/restore@v4
115+
with:
116+
key: ${{ steps.cpm-key.outputs.key }}
117+
enableCrossOsArchive: true
118+
restore-keys: |
119+
${{ env.CPM_RESTORE_KEY }}
120+
path: |
121+
mlir-tensorrt/.cache.cpm/*
122+
!mlir-tensorrt/.cache.cpm/tensorrt
123+
!mlir-tensorrt/.cache.cpm/tensorrt/**
124+
125+
- name: Build Wheels With CUDA:${{ matrix.cuda }} + TensorRT:${{ matrix.trt }}
126+
env:
127+
MLIR_TRT_DOWNLOAD_TENSORRT_VERSION: ${{ matrix.trt }}
128+
ARCH: ${{ matrix.arch }}
129+
CMAKE_PRESET: distribution-wheels
130+
run: |
131+
set -euo pipefail
132+
set -x
133+
cd mlir-tensorrt
134+
# Build only pjrt wheels for PyPI upload, with auditwheel repair
135+
MLIR_TRT_PYPI=1 PACKAGES="pjrt" ./build_tools/scripts/cicd-build-wheels.sh
136+
137+
- name: Upload Wheels
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: release-wheels-${{ matrix.arch }}-cu${{ matrix.cuda }}-trt${{ matrix.trt }}
141+
path: mlir-tensorrt/dist
142+
if-no-files-found: error
143+
144+
test-pypi-release-wheels-publish:
145+
name: Publish to TestPyPI
146+
needs: [pypi-release-wheels-build]
147+
runs-on: ubuntu-latest
148+
environment:
149+
name: testpypi
150+
url: https://test.pypi.org/project/mlir-tensorrt-jax/
151+
permissions:
152+
id-token: write
153+
packages: write
154+
contents: read
155+
steps:
156+
- name: Download built wheels
157+
uses: actions/download-artifact@v4
158+
with:
159+
pattern: release-wheels-*
160+
merge-multiple: true
161+
path: dist-collect
162+
163+
- name: Publish to TestPyPI
164+
uses: pypa/gh-action-pypi-publish@release/v1
165+
with:
166+
packages-dir: dist-collect
167+
skip_existing: true
168+
repository-url: https://test.pypi.org/legacy
169+
verbose: true
170+
171+
pypi-release-wheels-publish:
172+
name: Publish to PyPI
173+
if: ${{ inputs.confirm_publish_to_pypi }}
174+
needs: [pypi-release-wheels-build]
175+
runs-on: ubuntu-latest
176+
permissions:
177+
id-token: write
178+
packages: write
179+
contents: read
180+
steps:
181+
- name: Download built wheels
182+
uses: actions/download-artifact@v4
183+
with:
184+
pattern: release-wheels-*
185+
merge-multiple: true
186+
path: dist-collect
187+
188+
- name: Publish to PyPI
189+
uses: pypa/gh-action-pypi-publish@release/v1
190+
with:
191+
verbose: true
192+
skip_existing: true
193+
packages-dir: dist-collect
194+
user: __token__
195+
password: ${{ secrets.PYPI_API_TOKEN }}
196+
197+
concurrency:
198+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-mlir-tensorrt-pypi
199+
cancel-in-progress: true

.github/workflows/mlir-tensorrt-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
# eg. 10.12 or 10.13
2424
MLIR_TRT_DOWNLOAD_TENSORRT_VERSION: ${{ matrix.trt }}
2525
ARCH: ${{ matrix.arch }}
26-
CMAKE_PRESET: distribution-wheels
27-
CCACHE_RESTORE_KEY: mlir-tensorrt-ccache-v1-${{ matrix.arch }}-distribution-wheels
26+
CMAKE_PRESET: ${{ matrix.cmake_preset }}
27+
CCACHE_RESTORE_KEY: mlir-tensorrt-ccache-v1-${{ matrix.arch }}-${{ matrix.cmake_preset }}
2828
CPM_RESTORE_KEY: mlir-tensorrt-cpm-v1
2929
runs-on: ${{ matrix.github_runner }}
3030
timeout-minutes: 120

.github/workflows/mlir-tensorrt/generate-matrix.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,19 @@
3131
"trt": "10.13",
3232
},
3333
],
34+
"pypi-release": [
35+
{
36+
"cuda": "13.0",
37+
"trt": "10.13",
38+
},
39+
],
3440
}
3541

3642
ARCH_LIST_DICT = {
3743
"test": ["x86_64"],
3844
"release": ["x86_64", "aarch64"],
3945
"nightly": ["x86_64", "aarch64"],
46+
"pypi-release": ["x86_64", "aarch64"],
4047
}
4148

4249
GH_RUNNER_DICT = {
@@ -47,9 +54,8 @@
4754
CMAKE_PRESET_DICT = {
4855
"nightly": "github-cicd",
4956
"test": "github-cicd",
50-
# release should use the release wheel build preset
51-
# TODO: add the release wheel build preset
52-
"release": "github-cicd",
57+
"release": "distribution-wheels",
58+
"pypi-release": "distribution-wheels",
5359
}
5460

5561
DOCKER_IMAGE_DICT = {
@@ -71,6 +77,9 @@
7177
"13.0": "ghcr.io/nvidia/tensorrt-incubator/mlir-tensorrt:cuda13.0-rockylinux9-0.1",
7278
},
7379
},
80+
"pypi-release": {
81+
"13.0": "ghcr.io/nvidia/tensorrt-incubator/mlir-tensorrt:cuda13.0-rockylinux8-0.1",
82+
},
7483
}
7584

7685

@@ -84,9 +93,9 @@ def main(args: list[str]) -> None:
8493
)
8594

8695
options = parser.parse_args(args)
87-
if options.channel not in ("nightly", "test", "release"):
96+
if options.channel not in ("nightly", "test", "release", "pypi-release"):
8897
raise Exception(
89-
"--channel is invalid, please choose from nightly, test or release"
98+
"--channel is invalid, please choose from nightly, test, release or pypi-release"
9099
)
91100

92101
channel = options.channel
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"name": "cuda12.9-rockylinux8-prebuilt",
3+
"image": "ghcr.io/nvidia/tensorrt-incubator/mlir-tensorrt:cuda12.9-rockylinux8-0.1",
4+
"remoteUser": "nvidia",
5+
"updateRemoteUserUID": true,
6+
"runArgs": [
7+
"--name",
8+
"cuda12.9-rockylinux8-prebuilt-${localEnv:USER:nvidia}-${devcontainerId}",
9+
"--cap-add=SYS_PTRACE",
10+
"--security-opt",
11+
"seccomp=unconfined",
12+
"--shm-size=1g",
13+
"--ulimit",
14+
"memlock=-1",
15+
"--network=host"
16+
],
17+
"hostRequirements": {
18+
"gpu": "optional"
19+
},
20+
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces/TensorRT-Incubator,type=bind,consistency=cached",
21+
"workspaceFolder": "/workspaces/TensorRT-Incubator/mlir-tensorrt",
22+
"customizations": {
23+
"vscode": {
24+
"extensions": [
25+
"llvm-vs-code-extensions.vscode-clangd",
26+
"llvm-vs-code-extensions.vscode-mlir",
27+
"eamodio.gitlens",
28+
"ms-python.black-formatter",
29+
"ms-python.python"
30+
],
31+
"settings": {
32+
"[python]": {
33+
"editor.defaultFormatter": "ms-python.black-formatter"
34+
},
35+
"mlir.pdll_compilation_databases": [
36+
"build/pdll_compile_commands.yml"
37+
],
38+
"mlir.server_path": "build/bin/mlir-tensorrt-lsp-server",
39+
"files.exclude": {
40+
"**/.git": true,
41+
"**/.cache": true,
42+
"**/.venv*": true
43+
},
44+
"files.watcherExclude": {
45+
"**/.git/objects/**": true,
46+
"**/.git/subtree-cache/**": true,
47+
"**/.private*": true,
48+
"**/.venv*/**": true,
49+
"**/build/**": true
50+
},
51+
"search.exclude": {
52+
"**/.private*": true,
53+
"**/.venv*": true,
54+
"**/build": true
55+
},
56+
"python.analysis.include": [
57+
"integrations/python",
58+
"integrations/python/internal"
59+
],
60+
"python.analysis.typeCheckingMode": "basic",
61+
"python.analysis.extraPaths": [
62+
"build/python_packages/mlir_tensorrt_compiler",
63+
"build/python_packages/mlir_tensorrt_runtime",
64+
"build/python_packages/tools"
65+
],
66+
"python.analysis.exclude": [
67+
"**/build/**",
68+
"**/.cache.cpm/**",
69+
"**/*bazel*/**",
70+
"**/build_tools/**",
71+
"third_party"
72+
]
73+
}
74+
}
75+
},
76+
"features": {
77+
"ghcr.io/devcontainers/features/common-utils:2": {
78+
"installZsh": true,
79+
"installOhMyZsh": true,
80+
"configureZshAsDefaultShell": false,
81+
"upgradePackages": false,
82+
"username": "nvidia",
83+
"userUid": "automatic",
84+
"userGid": "automatic"
85+
},
86+
"ghcr.io/devcontainers/features/git:1": {}
87+
}
88+
}

0 commit comments

Comments
 (0)