[CI] Add cibw-based wheel publishing to PyPI#19656
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the TVM wheel packaging and build process by introducing a standard cibuildwheel flow, adding helper scripts to build CUDA runtime sidecar libraries on Linux and Windows, and consolidating target library configurations with a new CMake helper. Key feedback includes moving pytest from core runtime dependencies to test dependencies in pyproject.toml, ensuring the fallback conda create command in the Windows build script cleans up partially populated directories, avoiding fragile ^ line continuations in the generated Windows batch file, and quoting ${USE_LLVM} in CMakeLists.txt to prevent syntax errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
1bc8efd to
470eacf
Compare
Add a cibuildwheel-based flow to build and publish TVM wheels to PyPI for Linux (manylinux_2_28 x86_64/aarch64, with a CUDA runtime sidecar), macOS arm64 (Metal), and Windows AMD64 (with a CUDA runtime sidecar): - .github/workflows/publish_wheel.yml: build_cuda_runtime -> build_wheels -> upload_pypi, with OIDC trusted publishing and build provenance attestation. - .github/actions/build-wheel-for-publish: static-LLVM wheel build via cibuildwheel; per-platform CIBW_ENVIRONMENT; per-wheel feature defines (e.g. USE_METAL) supplied from the build matrix. - pyproject.toml [tool.cibuildwheel]/[tool.scikit-build] config. - CUDA runtime sidecar build scripts (manylinux .sh, Windows .bat) and a Library.cmake helper; FindLLVM zstd-static fix; -Wl,--no-relax/--as-needed. - Version is stamped from the git ref via version.py at build time.
Follow-ups to the cibuildwheel wheel-publishing flow (apache#19656): - macOS: ad-hoc re-sign the wheel's Mach-O dylibs after delocate. install_name_tool edits invalidate the arm64 code signature and dyld SIGKILLs an invalidly-signed dylib on dlopen, so `import tvm` crashed with no traceback. New ci/scripts/package/macos_repair_wheel.sh runs delocate, ad-hoc re-signs every Mach-O, and repacks so RECORD matches. - Simplify the per-platform CUDA extra-libs in the wheel CMAKE_ARGS: macOS never bundles the CUDA sidecar (drop the always-empty arg); Linux/Windows always do (pass -DTVM_PACKAGE_EXTRA_LIBS unconditionally). - Move the wheel post-install checks into tests/python/all-platform-minimal-test, gated behind TVM_WHEEL_EXPECT_LLVM / TVM_WHEEL_EXPECT_CUDA_RUNTIME so they only assert during wheel validation and skip in ordinary source-build CI; the cibuildwheel test-command is now a single pytest invocation. - Windows: collapse the two tvm_ffi DLL excludes into the delvewheel glob --exclude "*tvm_ffi*.dll" and pin delvewheel>=1.12.0 (wildcards need >=1.12.0).
Follow-ups to the cibuildwheel wheel-publishing flow (apache#19656): - macOS: ad-hoc re-sign the wheel's Mach-O dylibs after delocate. install_name_tool edits invalidate the arm64 code signature and dyld SIGKILLs an invalidly-signed dylib on dlopen, so `import tvm` crashed with no traceback. The macOS repair-wheel-command now runs delocate, ad-hoc re-signs every Mach-O, and repacks so RECORD matches (inlined into pyproject; no separate script). - Simplify the per-platform CUDA extra-libs in the wheel CMAKE_ARGS: macOS never bundles the CUDA sidecar (drop the always-empty arg); Linux/Windows wheels are always CUDA builds (every Linux/Windows matrix row sets include_cuda_runtime=1), so pass -DTVM_PACKAGE_EXTRA_LIBS unconditionally. - Move the wheel post-install checks into tests/python/all-platform-minimal-test, gated behind TVM_WHEEL_EXPECT_LLVM / TVM_WHEEL_EXPECT_CUDA_RUNTIME so they only assert during wheel validation and skip in ordinary source-build CI; the cibuildwheel test-command is now a single pytest invocation. - Windows: collapse the two tvm_ffi DLL excludes into the delvewheel glob --exclude "*tvm_ffi*.dll" and pin delvewheel>=1.12.0 (wildcards need >=1.12.0).
Add a workflow_dispatch pipeline that builds, tests, and publishes manylinux/ macOS/Windows wheels via cibuildwheel with OIDC trusted publishing.