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 c24cb3a68 [BUILD] Use activated environments and shared uv setup in CI
c24cb3a68 is described below
commit c24cb3a680356a4c0e8641cc5f7a5802d82fe7fb
Author: Tianqi Chen <[email protected]>
AuthorDate: Sat Oct 24 23:12:19 2026 +0000
[BUILD] Use activated environments and shared uv setup in CI
---
.github/actions/setup/action.yml | 11 ++++++--
.github/workflows/main.yml | 29 +++++++++----------
AGENTS.md | 36 +++++++++++-------------
docs/README.md | 7 ++---
docs/dev/ci_cd.rst | 16 +++++------
docs/dev/doc_build.rst | 10 +++----
docs/dev/source_build.rst | 29 ++++++++-----------
pyproject.toml | 6 ----
tests/scripts/task_build_gpu_other.sh | 1 +
tests/scripts/task_install_build_dependencies.sh | 1 +
10 files changed, 67 insertions(+), 79 deletions(-)
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index 4f71bf8b7..641ac49fa 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -26,9 +26,14 @@ runs:
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
+ - name: Install uv
+ shell: bash
+ run: |
+ python -m pip install uv
+ python -c 'import sys; print("UV_PYTHON=" + sys.executable)' >>
"$GITHUB_ENV"
- name: Install build and test tools
shell: bash
- run: python -m pip install "cmake>=3.26" ninja pytest numpy scipy cython
- - name: Install tvm-ffi pip package
+ run: uv pip install --group build pytest numpy scipy cython
+ - name: Install source tvm-ffi
shell: bash
- run: python -m pip install -v ./3rdparty/tvm-ffi
+ run: uv pip install -v ./3rdparty/tvm-ffi
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 8c8641942..3d0c63863 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -59,21 +59,19 @@ jobs:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
set -euxo pipefail
- pip install "scikit-build-core>=0.11" "setuptools-scm>=8"
export CMAKE_ARGS="-DTVM_TIRX_USE_LLVM=ON -DTVM_TIRX_USE_METAL=ON
-DTVM_TIRX_BUILD_TESTS=OFF"
- pip wheel --no-deps -w dist . -v
- pip install --no-deps --force-reinstall dist/apache_tvm_tirx-*.whl
+ uv build --wheel --out-dir dist . -v
+ uv pip install --no-deps --force-reinstall dist/apache_tvm_tirx-*.whl
- name: Install TIRx from wheels
shell: bash
run: |
set -euxo pipefail
- pip install psutil cloudpickle ml_dtypes numpy packaging scipy
typing_extensions
- # --no-deps: this package requires apache-tvm-ffi>=0.1.14.post1, and
the source-built core
- # versions as 0.1.dev1+g<sha> from the shallow checkout, which is <
0.1.0 under PEP 440.
- # Without it pip replaces the source-matched core with a PyPI build.
- pip install --no-deps "apache-tvm-ffi-orcjit>=0.1.2"
+ uv pip install psutil cloudpickle ml_dtypes numpy packaging scipy
typing_extensions
+ # --no-deps preserves the source-matched FFI development build, whose
+ # version is below the runtime requirement of the published ORC JIT
package.
+ uv pip install --no-deps "apache-tvm-ffi-orcjit>=0.1.2"
# Keep the source-matched tvm-ffi installed by the setup steps.
- pip install --no-deps dist/*.whl
+ uv pip install --no-deps dist/*.whl
- name: Test
shell: bash
@@ -112,19 +110,18 @@ jobs:
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
- pip install "scikit-build-core>=0.11" "setuptools-scm>=8" || exit /b
1
set CMAKE_ARGS=-DTVM_TIRX_USE_LLVM=ON -DTVM_TIRX_BUILD_TESTS=OFF
- pip wheel --no-deps -w dist . -v || exit /b 1
+ uv build --wheel --out-dir dist . -v || exit /b 1
for %%w in (dist\apache_tvm_tirx-*.whl) do (
- pip install --no-deps --force-reinstall "%%w" || exit /b 1
+ uv pip install --no-deps --force-reinstall "%%w" || exit /b 1
)
- name: Install test dependencies
shell: cmd /C call {0}
run: |
- pip install psutil cloudpickle ml_dtypes numpy packaging scipy
typing_extensions || exit /b 1
- rem --no-deps keeps the source-built apache-tvm-ffi (versioned below
0.1.14.post1 from the
- rem shallow checkout) from being replaced by a PyPI build.
- pip install --no-deps "apache-tvm-ffi-orcjit>=0.1.2" || exit /b 1
+ uv pip install psutil cloudpickle ml_dtypes numpy packaging scipy
typing_extensions || exit /b 1
+ rem --no-deps preserves the source-matched FFI development build
instead of
+ rem replacing it to satisfy the published ORC JIT package runtime
requirement.
+ uv pip install --no-deps "apache-tvm-ffi-orcjit>=0.1.2" || exit /b 1
- name: Test
shell: cmd /C call {0}
run: >-
diff --git a/AGENTS.md b/AGENTS.md
index 926d30afb..5c95089a3 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -49,8 +49,8 @@ ci/wheel/ Wheel-build support
## Building
-Use `uv` for Python environments and package installation. Run commands from
-the repository root; the default virtual environment is `.venv`.
+Use an activated Python environment and run commands from the repository root.
+Install packages into that environment with `uv pip install`.
### Prerequisites
@@ -61,7 +61,6 @@ the repository root; the default virtual environment is
`.venv`.
### Python editable install (primary workflow)
```bash
-uv venv
uv pip install -e .
```
@@ -83,10 +82,9 @@ runtimes such as Metal, ROCm, Vulkan, and OpenCL have their
own
### C++-only build
```bash
-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
+cmake -S . -B build_cpp -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
+cmake --build build_cpp --parallel --config RelWithDebInfo --target
tvm_tirx_compiler
```
The `runtime` target builds the core runtime and enabled device runtimes.
@@ -97,9 +95,9 @@ The `runtime` target builds the core runtime and enabled
device runtimes.
```bash
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 -S . -B build_test -G Ninja -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
```
CMake uses an installed GoogleTest package when available and fetches it
otherwise.
@@ -110,14 +108,14 @@ 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
+pytest -v tests/python -m "not gpu"
+pytest -v tests/python/ir/test_type.py
```
Run the relevant GPU tests on a machine with the matching runtime and hardware:
```bash
-uv run --no-sync pytest -v tests/python -m gpu
+pytest -v tests/python -m gpu
```
Start with the tests for the changed component. Device and architecture skips
@@ -129,13 +127,13 @@ describe missing coverage; they do not demonstrate that a
backend works.
IR bindings are generated by `tvm-ffi-stubgen` between `tvm-ffi-stubgen(begin)`
and `(end)` markers. The crate links `libtvm_tirx_compiler` from the directory
`tvm-tirx-config --libdir` prints, so build TIRx first. Its build script needs
-`tvm-ffi-config` and `tvm-tirx-config` on `PATH`, which `uv run` provides after
+`tvm-ffi-config` and `tvm-tirx-config` on `PATH` in the activated environment
after
the editable install:
```bash
-uv run --no-sync tvm-ffi-stubgen rust/src --target rust --dlls
build/lib/libtvm_tirx_compiler.so --check
-uv run --no-sync cargo fmt --check --manifest-path rust/Cargo.toml
-uv run --no-sync cargo test --manifest-path rust/Cargo.toml
+tvm-ffi-stubgen rust/src --target rust --dlls
build/lib/libtvm_tirx_compiler.so --check
+cargo fmt --check --manifest-path rust/Cargo.toml
+cargo test --manifest-path rust/Cargo.toml
```
The editable install also builds the crate as `libtvm_tirx_rust` when it finds
a
@@ -149,8 +147,8 @@ cargo is preferred). `import tvm_tirx` loads it and
registers the operators of i
```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
+pre-commit run --all-files
+pre-commit run --files path/to/changed_file
```
Hooks include ASF headers, file types, whitespace, YAML/TOML checks, `ruff`,
@@ -203,7 +201,7 @@ Install the documentation dependencies and editable
package, then build:
```bash
uv pip install --group docs -e .
-uv run --no-sync python -m sphinx -b html -W docs docs/_build/html
+python -m sphinx -b html -W docs docs/_build/html
```
Use standard RST and autosummary templates. Keep public namespace labels fully
diff --git a/docs/README.md b/docs/README.md
index eca5c0527..773d4e13e 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -17,13 +17,12 @@
# TIRx Documentation
-See [Build from Source](dev/source_build.rst) for the uv virtual environment.
-Install the documentation dependencies and editable package from the
repository root:
+From the repository root in an activated Python environment, install the
+documentation dependencies and editable package:
```bash
-uv venv
uv pip install --group docs -e .
-uv run --no-sync python -m sphinx -b html -W docs docs/_build/html
+python -m sphinx -b html -W docs docs/_build/html
```
Set `BUILD_CPP_DOCS=1` to also generate the C++ API reference; this requires
Doxygen.
diff --git a/docs/dev/ci_cd.rst b/docs/dev/ci_cd.rst
index f1d9522ae..756464543 100644
--- a/docs/dev/ci_cd.rst
+++ b/docs/dev/ci_cd.rst
@@ -37,7 +37,7 @@ Install and register the hooks so they run automatically
before each commit:
.. code-block:: bash
- uv tool install pre-commit
+ uv pip install --group lint
pre-commit install
You can also run hooks manually:
@@ -69,15 +69,14 @@ Use ``pre-commit clean`` if a stale hook environment causes
problems.
C++ Tests
---------
-Configure, build, and run locally:
+Configure, build, and run locally in an activated Python environment:
.. code-block:: bash
- 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 . -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
CMake uses an installed GoogleTest package or fetches it when needed.
On Windows, run from a Visual Studio Developer Command Prompt.
@@ -85,16 +84,15 @@ On Windows, run from a Visual Studio Developer Command
Prompt.
Python Tests
------------
-Reproduce locally with:
+Reproduce locally in an activated Python environment:
.. code-block:: bash
# Install the editable package and test dependencies
- uv venv
uv pip install --group test -e .
# Run the CPU tests
- uv run --no-sync pytest -vvs tests/python -m "not gpu"
+ pytest -vvs tests/python -m "not gpu"
Use ``-m gpu`` for device tests with the matching backend, SDK, and hardware.
Pass a test file or directory to focus on the component you changed.
diff --git a/docs/dev/doc_build.rst b/docs/dev/doc_build.rst
index 07ab30090..30bc4a8fc 100644
--- a/docs/dev/doc_build.rst
+++ b/docs/dev/doc_build.rst
@@ -25,7 +25,7 @@ Building the docs requires the Python package to be installed
first; see
.. admonition:: Prerequisite
:class: hint
- - Use the virtual environment from :doc:`source_build`.
+ - Use an activated Python environment, as in :doc:`source_build`.
- Run commands from the repository root.
- Install the documentation tools and editable package with
``uv pip install --group docs -e .``.
@@ -39,7 +39,7 @@ Rebuild and serve the documentation locally with live reload:
.. code-block:: bash
- uv run --no-sync sphinx-autobuild docs docs/_build/html \
+ sphinx-autobuild docs docs/_build/html \
--ignore docs/reference/python/generated --ignore
docs/reference/cpp/generated
Open ``http://127.0.0.1:8000`` after the initial build completes.
@@ -51,7 +51,7 @@ Generate the HTML documentation once, with warnings treated
as errors:
.. code-block:: bash
- uv run --no-sync python -m sphinx -b html -W docs docs/_build/html
+ python -m sphinx -b html -W docs docs/_build/html
Open ``docs/_build/html/index.html`` to browse the result.
@@ -72,12 +72,12 @@ Set ``BUILD_CPP_DOCS=1`` on the desired build command to
enable the extra step:
.. code-block:: bash
# Interactive build with auto-rebuild on C++ header changes
- BUILD_CPP_DOCS=1 uv run --no-sync sphinx-autobuild docs docs/_build/html \
+ BUILD_CPP_DOCS=1 sphinx-autobuild docs docs/_build/html \
--ignore docs/reference/python/generated --ignore
docs/reference/cpp/generated \
--watch include
# One-off build
- BUILD_CPP_DOCS=1 uv run --no-sync python -m sphinx -b html -W docs
docs/_build/html
+ BUILD_CPP_DOCS=1 python -m sphinx -b html -W docs docs/_build/html
Cleanup
-------
diff --git a/docs/dev/source_build.rst b/docs/dev/source_build.rst
index 3625f1bda..c1131593b 100644
--- a/docs/dev/source_build.rst
+++ b/docs/dev/source_build.rst
@@ -19,6 +19,7 @@ Build from Source
=================
This guide provides instructions on how to build the TIRx package from source.
+Run the commands in an activated Python environment.
.. admonition:: Prerequisite
:class: tip
@@ -36,7 +37,6 @@ Download the source via:
git clone --recursive https://github.com/apache/tvm-tirx
cd tvm-tirx
- uv venv
.. note::
@@ -82,8 +82,8 @@ Verify the installation:
.. code-block:: bash
- uv run --no-sync python -c "import tvm_tirx; print(tvm_tirx.__version__)"
- uv run --no-sync tvm-tirx-config -h
+ python -c "import tvm_tirx; print(tvm_tirx.__version__)"
+ tvm-tirx-config -h
.. tip::
@@ -110,10 +110,9 @@ Install the local build dependency group, then configure
and build:
.. code-block:: bash
- 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
+ cmake -S . -B build_cpp -G Ninja -DCMAKE_BUILD_TYPE=Release
+ cmake --build build_cpp --parallel
Build Wheels with Customized LLVM
---------------------------------
@@ -123,21 +122,17 @@ PyPI specified in ``pyproject.toml``; no manual SDK setup
is needed.
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
-
- 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
+dependencies before building.
.. note::
- Prefer static LLVM libraries bundled into the wheel, matching the default,
- to avoid conflicts with LLVM libraries used by other packages.
+ When building wheels for release, we recommend linking LLVM statically into
+ the wheel to avoid conflicts with LLVM libraries used by other packages.
+ Pass ``--link-static`` to ``llvm-config`` to enable this.
-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.
+.. code-block:: bash
+
+ CMAKE_ARGS="-DTVM_TIRX_USE_LLVM='/path/to/llvm-config --link-static'" uv
build --wheel
For macOS wheels using the default SDK, set ``MACOSX_DEPLOYMENT_TARGET=14.0``.
See :doc:`ci_cd` for the publication toolchain configuration.
diff --git a/pyproject.toml b/pyproject.toml
index 35c2da995..a6521d652 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -70,12 +70,6 @@ test = [
"z3-solver",
"pytest",
"pytest-xdist",
- "pytest-cov",
- "pytest-mock",
- "pytest-benchmark",
- "pytest-timeout",
- "pytest-rerunfailures",
- "pytest-repeat",
{ include-group = "torch" },
{ include-group = "popen-pool" },
]
diff --git a/tests/scripts/task_build_gpu_other.sh
b/tests/scripts/task_build_gpu_other.sh
index 2a71348db..a3d765f0b 100755
--- a/tests/scripts/task_build_gpu_other.sh
+++ b/tests/scripts/task_build_gpu_other.sh
@@ -23,6 +23,7 @@ set -euxo pipefail
uv pip install --python python3 --no-deps --target build/python
./3rdparty/tvm-ffi
uv pip install --python python3 --target build/python --group build
export PYTHONPATH="$PWD/build/python"
+export PATH="$PWD/build/python/bin:$PATH"
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DTVM_TIRX_USE_OPENCL=ON -DTVM_TIRX_USE_VULKAN=ON -DTVM_TIRX_USE_ROCM=ON \
-DTVM_TIRX_USE_LLVM=ON -DCMAKE_CXX_FLAGS=-Werror
diff --git a/tests/scripts/task_install_build_dependencies.sh
b/tests/scripts/task_install_build_dependencies.sh
index 16dba8920..1dcf5e60a 100755
--- a/tests/scripts/task_install_build_dependencies.sh
+++ b/tests/scripts/task_install_build_dependencies.sh
@@ -22,6 +22,7 @@ rm -rf dist
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"
+export PATH="$PWD/.local/python/bin:$PATH"
uv build --wheel --no-build-isolation --offline --python python3 --out-dir
dist ./3rdparty/tvm-ffi
uv pip install --python python3 --target .local/python --no-deps --offline
--reinstall dist/apache_tvm_ffi-*.whl