Skip to content

[CI] Add cibw-based wheel publishing to PyPI#19656

Merged
tqchen merged 1 commit into
apache:mainfrom
tlopex:pypi_official
Jun 2, 2026
Merged

[CI] Add cibw-based wheel publishing to PyPI#19656
tqchen merged 1 commit into
apache:mainfrom
tlopex:pypi_official

Conversation

@tlopex
Copy link
Copy Markdown
Member

@tlopex tlopex commented Jun 2, 2026

Add a workflow_dispatch pipeline that builds, tests, and publishes manylinux/ macOS/Windows wheels via cibuildwheel with OIDC trusted publishing.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pyproject.toml
Comment thread ci/scripts/package/windows_build_libtvm_runtime_cuda.sh Outdated
Comment thread ci/scripts/package/windows_build_libtvm_runtime_cuda.sh Outdated
Comment thread CMakeLists.txt Outdated
@tlopex tlopex force-pushed the pypi_official branch 4 times, most recently from 1bc8efd to 470eacf Compare June 2, 2026 18:28
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.
@tqchen tqchen merged commit 5cbf506 into apache:main Jun 2, 2026
10 checks passed
tlopex added a commit to tlopex/tvm that referenced this pull request Jun 3, 2026
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).
tlopex added a commit to tlopex/tvm that referenced this pull request Jun 3, 2026
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants