Skip to content

Commit 57e615d

Browse files
[build_tools] Add cmake preset for clang python wheel release (#559)
This PR adds cmake preset for clang python wheel release and updates `build_wheels.sh` script to use this preset.
1 parent 140e529 commit 57e615d

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

mlir-tensorrt/CMakePresets.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@
7070
"CMAKE_C_COMPILER": "gcc",
7171
"CMAKE_CXX_COMPILER": "g++"
7272
}
73+
},
74+
{
75+
"name": "ninja-clang-wheel-release",
76+
"displayName": "Ninja Release clang wheels",
77+
"generator": "Ninja",
78+
"binaryDir": "build",
79+
"inherits": "base",
80+
"cacheVariables": {
81+
"CMAKE_C_COMPILER": "clang",
82+
"CMAKE_CXX_COMPILER": "clang++",
83+
"LLVM_ENABLE_ASSERTIONS": "OFF",
84+
"CMAKE_BUILD_TYPE": "Release",
85+
"CMAKE_PLATFORM_NO_VERSIONED_SONAME": "ON",
86+
"LLVM_MINIMUM_PYTHON_VERSION": "$env{PY_VERSION}",
87+
"MLIR_TRT_ENABLE_NCCL": "OFF",
88+
"MLIR_TRT_DOWNLOAD_TENSORRT_VERSION": "$env{DOWNLOAD_TENSORRT_VERSION}"
89+
}
7390
}
7491
]
7592
}
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
#!/usr/bin/env bash
22
# Builds Python wheels for MLIR-TensorRT packages using the specified python version number.
3-
# Usage: build_wheels.sh 3.X
3+
# Usage:
4+
# build_wheels.sh [python version] [TensorRT version]
5+
# e.g. build_wheels.sh 3.X 10.X
46
set -e
5-
version=${1:-3.10}
6-
PATH=$PATH:/pyenv/bin
7+
py_version=${PY_VERSION:-${1:-3.10}}
78

9+
PATH=$PATH:/pyenv/bin
810
mkdir -p .private.wheels || true
11+
pyenv local ${py_version}
12+
python${py_version} -m pip install -r python/requirements-dev.txt
913

10-
pyenv local ${version}
11-
12-
python${version} -m pip install -r python/requirements-dev.txt
14+
# If `DOWNLOAD_TENSORRT_VERSION` is not set, use the second argument as the version number.
15+
if [ -z "${DOWNLOAD_TENSORRT_VERSION}" ]; then
16+
DOWNLOAD_TENSORRT_VERSION=$2
17+
export DOWNLOAD_TENSORRT_VERSION
18+
fi
1319

1420
rm -rf build || true
15-
cmake -B ./build -S . -G Ninja \
16-
-DCMAKE_BUILD_TYPE=Release \
17-
-DMLIR_TRT_PACKAGE_CACHE_DIR=${PWD}/.cache.cpm \
18-
-DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DLLVM_MINIMUM_PYTHON_VERSION=${version} \
19-
-DMLIR_TRT_ENABLE_ASSERTIONS=OFF \
20-
-DMLIR_TRT_ENABLE_NCCL=OFF \
21-
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=10.2
22-
21+
cmake --preset ninja-clang-wheel-release
2322
ninja -C build mlir-tensorrt-all-wheels
24-
2523
rsync -za build/wheels/ .private.wheels/

mlir-tensorrt/python/requirements-dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# The GPU version installs `nvidia-` pip packages which confuse JAX.
33
-r requirements.txt
44
--extra-index-url https://download.pytorch.org/whl/cpu
5-
numpy<2.0.0
65
click
76
matplotlib
87
pandas

0 commit comments

Comments
 (0)