Skip to content

Commit bd48299

Browse files
committed
[CI] Add smoke test for wheel release
1 parent f1c0008 commit bd48299

File tree

3 files changed

+61
-18
lines changed

3 files changed

+61
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
182182
# Run NCCL long tests
183183
- name: Run Long Tests With CUDA:${{ matrix.cuda }} + TensorRT:${{ matrix.trt }}
184-
id: long-tests
184+
id: nccl-long-tests
185185
if: ${{ inputs.channel == 'nightly' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
186186
env:
187187
LONG_TESTS: "ON"

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

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
CPM_SOURCE_CACHE: ${{ github.workspace }}/mlir-tensorrt/.cache.cpm
2828
CMAKE_PRESET: distribution-wheels
2929
CCACHE_RESTORE_KEY: mlir-tensorrt-ccache-v1-${{ matrix.arch }}-distribution-wheels
30-
CPM_KEY: mlir-tensorrt-cpm-v1
3130
CPM_RESTORE_KEY: mlir-tensorrt-cpm-v1
3231
runs-on: ${{ matrix.github_runner }}
3332
timeout-minutes: 120
@@ -68,6 +67,13 @@ jobs:
6867
| sort | sha256sum | cut -d' ' -f1)
6968
echo "key=${{ env.CCACHE_RESTORE_KEY }}-${hash}" >> $GITHUB_OUTPUT
7069
70+
# Compute cpm key after checkout
71+
- name: Compute CPM Key
72+
id: cpm-key
73+
run: |
74+
hash=$(sha256sum mlir-tensorrt/DependencyProvider.cmake | cut -d' ' -f1)
75+
echo "key=${{ env.CPM_RESTORE_KEY }}-${hash}" >> $GITHUB_OUTPUT
76+
7177
# Restore cache, if exists.
7278
- name: Restore CCache
7379
id: restore-ccache
@@ -83,7 +89,7 @@ jobs:
8389
id: restore-cpm
8490
uses: actions/cache/restore@v4
8591
with:
86-
key: ${{ env.CPM_KEY }}
92+
key: ${{ steps.cpm-key.outputs.key }}
8793
enableCrossOsArchive: true
8894
restore-keys: |
8995
${{ env.CPM_RESTORE_KEY }}
@@ -102,11 +108,9 @@ jobs:
102108
set -euo pipefail
103109
set -x
104110
cd mlir-tensorrt
105-
export MLIR_TRT_DOWNLOAD_TENSORRT_VERSION=${{ matrix.trt }}
106111
# TODO: remove this, once patch is in our rockylinux prebuilt image
107112
dnf install -yq patch
108-
# build wheels for mlir-tensorrt-compiler, mlir-tensorrt-runtime
109-
PACKAGES="mlir_tensorrt_compiler mlir_tensorrt_runtime" \
113+
# build wheels for all available packages
110114
./build_tools/scripts/cicd-build-wheels.sh
111115
112116
# Save ccache when cache is not hit or cache was a fallback(cache-matched is not the same as the cache key)
@@ -122,22 +126,42 @@ jobs:
122126
- name: Save CPM Cache
123127
# cpm cache is shared across x86_64 and aarch64, we let only x86_64 to save cpm cache when in cache miss case
124128
# this is to avoid both x86_64 and aarch64 to save cpm cache when in cache miss case
125-
if: ${{ matrix.arch == 'x86_64' &&
126-
(
127-
steps.restore-cpm.outputs.cache-hit != 'true' ||
128-
steps.restore-cpm.outputs['cache-matched-key'] != env.CPM_KEY
129-
)
130-
}}
129+
if: ${{ matrix.arch == 'x86_64' && steps.restore-cpm.outputs.cache-hit != 'true' }}
131130
uses: actions/cache/save@v4
132131
with:
133-
key: ${{ env.CPM_KEY }}
132+
key: ${{ steps.cpm-key.outputs.key }}
134133
enableCrossOsArchive: true
135134
# exclude only works for the relative path pattern
136135
path: |
137136
mlir-tensorrt/.cache.cpm/*
138137
!mlir-tensorrt/.cache.cpm/tensorrt
139138
!mlir-tensorrt/.cache.cpm/tensorrt/**
140139
140+
- name: Smoke Test Wheels With CUDA:${{ matrix.cuda }} + TensorRT:${{ matrix.trt }}
141+
env:
142+
ENABLE_ASAN: "OFF"
143+
run: |
144+
set -euo pipefail
145+
set -x
146+
cd mlir-tensorrt
147+
uv sync --python 3.10 --extra cu13
148+
source .venv/bin/activate
149+
export JAX_PLATFORMS="mlir_tensorrt,cpu"
150+
151+
# Compute TensorRT library path from CPM cache by locating libnvinfer.so
152+
echo "CPM_SOURCE_CACHE: ${{ env.CPM_SOURCE_CACHE }}"
153+
CPM_TRT_DIR="${{ env.CPM_SOURCE_CACHE }}/tensorrt"
154+
TensorRT_LIB_PATH="$(find "${CPM_TRT_DIR}" -type f -name 'libnvinfer.so*' 2>/dev/null | head -n1 | xargs -r dirname)"
155+
if [[ -z "${TensorRT_LIB_PATH}" ]]; then
156+
echo "Error: Could not locate libnvinfer.so under ${CPM_TRT_DIR}" >&2
157+
exit 1
158+
fi
159+
echo "TensorRT_LIB_PATH: ${TensorRT_LIB_PATH}"
160+
export LD_LIBRARY_PATH="${TensorRT_LIB_PATH}:$LD_LIBRARY_PATH"
161+
uv pip install dist/mlir_tensorrt_jax-*-cp310-cp310*.whl
162+
# smoke test wheels
163+
python3 -m pytest integrations/PJRT/test/JAX/ -v
164+
141165
# Upload wheels to GitHub Actions artifact
142166
- name: Upload Wheels
143167
uses: actions/upload-artifact@v4

mlir-tensorrt/build_tools/scripts/cicd-build-wheels.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ _raw_py_versions="${PYTHON_VERSIONS:-${python_versions:-"3.10 3.11 3.12 3.13"}}"
6262
_raw_py_versions="${_raw_py_versions//,/ }"
6363
read -r -a PY_VERSIONS <<< "${_raw_py_versions}"
6464

65-
# Resolve packages
66-
_raw_packages="${PACKAGES:-"mlir_tensorrt_compiler mlir_tensorrt_runtime"}"
65+
# Resolve packages: if PACKAGES is set, only build those; otherwise build all defaults
66+
if [[ -n "${PACKAGES:-}" ]]; then
67+
_raw_packages="${PACKAGES}"
68+
else
69+
# default: build all available packages
70+
_raw_packages="mlir_tensorrt_compiler mlir_tensorrt_runtime pjrt"
71+
fi
6772
_raw_packages="${_raw_packages//,/ }"
6873
read -r -a PACKAGES <<< "${_raw_packages}"
6974

@@ -76,9 +81,23 @@ function build_package() {
7681
done
7782
}
7883

79-
build_package "integrations/python/mlir_tensorrt_compiler"
80-
build_package "integrations/python/mlir_tensorrt_runtime"
81-
build_package "integrations/PJRT/python"
84+
# Map package keys to paths and build
85+
for pkg_key in "${PACKAGES[@]}"; do
86+
case "${pkg_key}" in
87+
mlir_tensorrt_compiler)
88+
build_package "integrations/python/mlir_tensorrt_compiler"
89+
;;
90+
mlir_tensorrt_runtime)
91+
build_package "integrations/python/mlir_tensorrt_runtime"
92+
;;
93+
pjrt|PJRT)
94+
build_package "integrations/PJRT/python"
95+
;;
96+
*)
97+
echo "WARNING: Unknown package key '${pkg_key}'. Supported: mlir_tensorrt_compiler, mlir_tensorrt_runtime, pjrt" >&2
98+
;;
99+
esac
100+
done
82101

83102
# print the size of the ccache and cpm source cache
84103
echo "🔨🧪 Printing the size of the ccache"

0 commit comments

Comments
 (0)