This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch pinned-build-sdks-835
in repository https://gitbox.apache.org/repos/asf/tvm-tirx.git
The following commit(s) were added to refs/heads/pinned-build-sdks-835 by this
push:
new 0c9a9e4a4 [BUILD] Declare local SDK tools and unify uv setup guidance
0c9a9e4a4 is described below
commit 0c9a9e4a46bf623dd73e52fae999605e55ef92e7
Author: Tianqi Chen <[email protected]>
AuthorDate: Sat Oct 24 22:55:24 2026 +0000
[BUILD] Declare local SDK tools and unify uv setup guidance
---
AGENTS.md | 24 ++++++----
docs/README.md | 7 +--
docs/dev/ci_cd.rst | 11 +++--
docs/dev/doc_build.rst | 3 +-
docs/dev/source_build.rst | 61 +++++++++++++-----------
pyproject.toml | 6 +++
tests/scripts/task_build_gpu_other.sh | 3 +-
tests/scripts/task_install_build_dependencies.sh | 4 +-
8 files changed, 68 insertions(+), 51 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index dcef23599..926d30afb 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -54,7 +54,7 @@ the repository root; the default virtual environment is
`.venv`.
### Prerequisites
-- Python 3.10+, a C++20 compiler, CMake 3.26+, and Ninja.
+- Python 3.10+, a C++20 compiler, Git, and uv.
- Initialize dependencies: `git submodule update --init --recursive`.
- Install the relevant device SDK when enabling a device runtime.
@@ -62,7 +62,7 @@ the repository root; the default virtual environment is
`.venv`.
```bash
uv venv
-uv pip install --verbose --group dev -e .
+uv pip install -e .
```
Re-run the editable install after changing C++ code or build configuration.
@@ -83,8 +83,9 @@ runtimes such as Metal, ROCm, Vulkan, and OpenCL have their
own
### C++-only build
```bash
-uv pip install cmake ninja "mlc-llvm-static[all]" "mlc-z3-static"
-uv run --no-sync cmake -S . -B build_cpp -DCMAKE_BUILD_TYPE=RelWithDebInfo
+uv venv
+uv pip install --group build
+uv run --no-sync cmake -S . -B build_cpp -G Ninja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
uv run --no-sync cmake --build build_cpp --parallel --config RelWithDebInfo
--target tvm_tirx_compiler
```
@@ -95,18 +96,20 @@ The `runtime` target builds the core runtime and enabled
device runtimes.
### C++ tests
```bash
-cmake -S . -B build_test -DTVM_TIRX_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
-cmake --build build_test --parallel --config Debug --target tirx_cpptest
-ctest --test-dir build_test -C Debug --output-on-failure
+uv pip install --group build
+uv run --no-sync cmake -S . -B build_test -G Ninja -DTVM_TIRX_BUILD_TESTS=ON
-DCMAKE_BUILD_TYPE=Debug
+uv run --no-sync cmake --build build_test --parallel --config Debug --target
tirx_cpptest
+uv run --no-sync ctest --test-dir build_test -C Debug --output-on-failure
```
CMake uses an installed GoogleTest package when available and fetches it
otherwise.
### Python tests
-After the editable install with the `dev` or `test` dependency group:
+Install the test dependencies and editable package:
```bash
+uv pip install --group test -e .
uv run --no-sync pytest -v tests/python -m "not gpu"
uv run --no-sync pytest -v tests/python/ir/test_type.py
```
@@ -145,6 +148,7 @@ cargo is preferred). `import tvm_tirx` loads it and
registers the operators of i
### Pre-commit (primary lint workflow)
```bash
+uv pip install --group lint
uv run --no-sync pre-commit run --all-files
uv run --no-sync pre-commit run --files path/to/changed_file
```
@@ -195,10 +199,10 @@ Use the existing tag-based style, for example `[FIX]`,
`[REFACTOR]`, `[FEAT]`,
## Documentation
-After building TIRx, install the documentation dependency group and build:
+Install the documentation dependencies and editable package, then build:
```bash
-uv pip install --group docs
+uv pip install --group docs -e .
uv run --no-sync python -m sphinx -b html -W docs docs/_build/html
```
diff --git a/docs/README.md b/docs/README.md
index 6f3ab3675..eca5c0527 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -17,11 +17,12 @@
# TIRx Documentation
-See [Build from Source](dev/source_build.rst) for the uv virtual environment.
After building TIRx, install the documentation dependencies and build from the
-repository root:
+See [Build from Source](dev/source_build.rst) for the uv virtual environment.
+Install the documentation dependencies and editable package from the
repository root:
```bash
-uv pip install --group docs
+uv venv
+uv pip install --group docs -e .
uv run --no-sync python -m sphinx -b html -W docs docs/_build/html
```
diff --git a/docs/dev/ci_cd.rst b/docs/dev/ci_cd.rst
index 573613f73..f1d9522ae 100644
--- a/docs/dev/ci_cd.rst
+++ b/docs/dev/ci_cd.rst
@@ -73,9 +73,11 @@ Configure, build, and run locally:
.. code-block:: bash
- cmake . -B build_test -G Ninja -DTVM_TIRX_BUILD_TESTS=ON
-DCMAKE_BUILD_TYPE=Debug
- cmake --build build_test --config Debug --target tirx_cpptest
- ctest -V -C Debug --test-dir build_test --output-on-failure
+ uv venv
+ uv pip install --group build
+ uv run --no-sync cmake . -B build_test -G Ninja -DTVM_TIRX_BUILD_TESTS=ON
-DCMAKE_BUILD_TYPE=Debug
+ uv run --no-sync cmake --build build_test --config Debug --target
tirx_cpptest
+ uv run --no-sync ctest -V -C Debug --test-dir build_test --output-on-failure
CMake uses an installed GoogleTest package or fetches it when needed.
On Windows, run from a Visual Studio Developer Command Prompt.
@@ -88,7 +90,8 @@ Reproduce locally with:
.. code-block:: bash
# Install the editable package and test dependencies
- uv pip install --reinstall --verbose --group test -e .
+ uv venv
+ uv pip install --group test -e .
# Run the CPU tests
uv run --no-sync pytest -vvs tests/python -m "not gpu"
diff --git a/docs/dev/doc_build.rst b/docs/dev/doc_build.rst
index 198b24dbc..07ab30090 100644
--- a/docs/dev/doc_build.rst
+++ b/docs/dev/doc_build.rst
@@ -27,7 +27,8 @@ Building the docs requires the Python package to be installed
first; see
- Use the virtual environment from :doc:`source_build`.
- Run commands from the repository root.
- - Install the documentation tools with ``uv pip install --group docs``.
+ - Install the documentation tools and editable package with
+ ``uv pip install --group docs -e .``.
- Optional: install ``Doxygen`` if you plan to generate the C++ API
reference (see :ref:`build-cpp-docs`).
diff --git a/docs/dev/source_build.rst b/docs/dev/source_build.rst
index 896aae1bf..3625f1bda 100644
--- a/docs/dev/source_build.rst
+++ b/docs/dev/source_build.rst
@@ -25,12 +25,7 @@ This guide provides instructions on how to build the TIRx
package from source.
- Python: 3.10 or newer.
- Compiler: a C++20-capable GCC, Clang, or MSVC toolchain.
- - Build tools: Git, CMake 3.26+, and uv.
- - The pinned ``mlc-llvm-static[all]`` and ``mlc-z3-static`` development SDKs
- are installed automatically as isolated Python build dependencies.
- LLVM and Z3 are linked statically; they are not runtime Python
requirements.
- - The pinned LLVM SDK supports Linux x86_64/aarch64 (glibc 2.28+),
- Windows AMD64/ARM64, and macOS arm64 (14+).
+ - Build tools: Git and uv.
Build the Python Package
------------------------
@@ -53,14 +48,14 @@ Download the source via:
git submodule update --init --recursive
Build the Python package with scikit-build-core, which drives CMake to compile
-the C++ libraries and supplies Ninja when needed in the default isolated build:
+the C++ libraries and supplies CMake/Ninja when needed in the isolated build:
.. code-block:: bash
- uv pip install --force-reinstall --verbose -e .
+ uv pip install .
-The ``--force-reinstall`` flag forces a rebuild, and ``-e`` (editable) means
-Python-only changes are reflected immediately without rebuilding.
+Use ``uv pip install -e .`` for an editable install; Python-only changes are
+then reflected immediately without rebuilding.
**CMake flags** can be exported through ``CMAKE_ARGS`` before running the
install command. For example, to switch off the CUDA runtime (which is
@@ -108,36 +103,44 @@ Verify the installation:
tvm-tirx-config --libs runtime cuda # Core and CUDA runtimes (CUDA
build)
tvm-tirx-config --ldflags # Library search paths
-Build Wheels with Static LLVM
------------------------------
+Build with CMake
+----------------
-The default isolated wheel build installs the pinned SDKs and links LLVM and Z3
-statically. No Conda environment or system LLVM installation is needed:
+Install the local build dependency group, then configure and build:
.. code-block:: bash
- uv build --wheel
+ uv venv
+ uv pip install --group build
+ uv run --no-sync cmake -S . -B build_cpp -G Ninja -DCMAKE_BUILD_TYPE=Release
+ uv run --no-sync cmake --build build_cpp --parallel
+
+Build Wheels with Customized LLVM
+---------------------------------
+
+By default, builds use the pinned prebuilt LLVM/Z3 static SDK packages from
+PyPI specified in ``pyproject.toml``; no manual SDK setup is needed.
-For a direct CMake build or a build without Python build isolation, install the
-SDKs and build tools into the virtual environment first:
+An explicit ``LLVM_DIR`` or ``TVM_TIRX_USE_LLVM=/path/to/llvm-config`` selects
+an external LLVM installation. Supply its development libraries and transitive
+dependencies, then build with either command:
.. code-block:: bash
- uv pip install cmake ninja "mlc-llvm-static[all]" "mlc-z3-static"
- uv run --no-sync cmake -S . -B build_cpp -G Ninja -DCMAKE_BUILD_TYPE=Release
- uv run --no-sync cmake --build build_cpp --parallel
+ CMAKE_ARGS="-DLLVM_DIR=/path/to/llvm/lib/cmake/llvm" uv build --wheel
+ CMAKE_ARGS="-DTVM_TIRX_USE_LLVM='/path/to/llvm-config --link-static'" uv
build --wheel
+
+.. note::
-``TVM_TIRX_USE_LLVM=ON`` probes that Python environment before generic LLVM
-search. The SDK includes static zlib/zstd; its LLVM build disables XML2.
-An explicit ``LLVM_DIR`` or ``TVM_TIRX_USE_LLVM=/path/to/llvm-config`` still
-selects an external LLVM installation, whose dependencies must be supplied
-separately. Use ``TVM_TIRX_USE_LLVM=OFF`` to build without LLVM.
+ Prefer static LLVM libraries bundled into the wheel, matching the default,
+ to avoid conflicts with LLVM libraries used by other packages.
-When distributing macOS wheels built with this SDK, set
-``MACOSX_DEPLOYMENT_TARGET=14.0`` so the wheel records the SDK's minimum OS
-version. The wheel CI sets this explicitly.
+Python build isolation installs its own pinned SDKs; installing a different SDK
+in the outer uv environment does not override them. The explicit settings above
+select external LLVM while Z3 continues to use its pinned SDK.
-See :doc:`ci_cd` for wheel builds and the publication toolchain configuration.
+For macOS wheels using the default SDK, set ``MACOSX_DEPLOYMENT_TARGET=14.0``.
+See :doc:`ci_cd` for the publication toolchain configuration.
Troubleshooting
---------------
diff --git a/pyproject.toml b/pyproject.toml
index 4519998c1..35c2da995 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -58,6 +58,12 @@ popen-pool = ["psutil", "cloudpickle"]
all = ["psutil", "cloudpickle"]
[dependency-groups]
+build = [
+ "cmake>=3.26",
+ "ninja",
+ "mlc-llvm-static[all]==23.1.1",
+ "mlc-z3-static==5.3.1.post0",
+]
torch = ["torch"]
popen-pool = ["psutil", "cloudpickle"]
test = [
diff --git a/tests/scripts/task_build_gpu_other.sh
b/tests/scripts/task_build_gpu_other.sh
index 88392f0f9..2a71348db 100755
--- a/tests/scripts/task_build_gpu_other.sh
+++ b/tests/scripts/task_build_gpu_other.sh
@@ -21,8 +21,7 @@ set -euxo pipefail
# Keep these libraries separate from the published GPU wheel artifacts.
uv pip install --python python3 --no-deps --target build/python
./3rdparty/tvm-ffi
-uv pip install --python python3 --target build/python \
- "mlc-llvm-static[all]==23.1.1" "mlc-z3-static==5.3.1.post0"
+uv pip install --python python3 --target build/python --group build
export PYTHONPATH="$PWD/build/python"
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DTVM_TIRX_USE_OPENCL=ON -DTVM_TIRX_USE_VULKAN=ON -DTVM_TIRX_USE_ROCM=ON \
diff --git a/tests/scripts/task_install_build_dependencies.sh
b/tests/scripts/task_install_build_dependencies.sh
index 8391ed048..16dba8920 100755
--- a/tests/scripts/task_install_build_dependencies.sh
+++ b/tests/scripts/task_install_build_dependencies.sh
@@ -19,8 +19,8 @@
set -euxo pipefail
rm -rf dist
-uv pip install --python python3 --target .local/python \
- "scikit-build-core>=0.11,!=1.1.0" "setuptools-scm>=8" "cython>=3.2.8"
"mlc-llvm-static[all]==23.1.1" "mlc-z3-static==5.3.1.post0"
+uv pip install --python python3 --target .local/python --group build \
+ "scikit-build-core>=0.11,!=1.1.0" "setuptools-scm>=8" "cython>=3.2.8"
export PYTHONPATH="$PWD/.local/python"
uv build --wheel --no-build-isolation --offline --python python3 --out-dir
dist ./3rdparty/tvm-ffi