Conversation
LLVMModule execution now goes through the separately installed apache-tvm-ffi-orcjit package, so CI has to provide it: - Bake it into the Linux CI docker image alongside the other python packages, so the ~20MB wheel is cached in the image rather than downloaded on every run. - Install it explicitly in the macOS and Windows jobs, which install TVM with --no-deps and would otherwise skip the new dependency. Pin to ==0.1.1 (the current release) in pyproject.toml and everywhere CI installs it, so the version is bumped deliberately. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The macOS job replaced the source-built apache-tvm-ffi with a PyPI build: the shallow CI checkout makes the source core version as 0.1.dev1+g<sha>, which is below 0.1.0 under PEP 440, so it does not satisfy the orcjit package's apache-tvm-ffi>=0.1.0 and pip resolves it from PyPI instead. Install the package with --no-deps everywhere so the source-matched core is always the one that stays installed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A docker/ change rebuilds the CI images but does not feed them back into the same run: the test stages pull the pinned tag from docker-images.ini, and the Jenkinsfile deliberately leaves the built image unassigned. So the image-level install alone leaves LLVM JIT unavailable in the Linux legs, which failed with the missing-package error from EnsureOrcJITModule. Install the package in the test scripts as well, next to where they set up tvm-ffi. The image install stays so the wheel is cached once the rebuilt image is promoted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Status after taking this over and rebasing onto WorkingWindows passes I also verified locally (aarch64 Linux) that the published 0.1.1 wheel registers both global CI wiring (fixed here)Two things the CI needed that were not obvious:
Pinned to Open issue: macOS segfaults in the JITmacOS gets past install and build, then segfaults (exit 139) inside This looks like a genuine platform issue in the JIT path rather than CI wiring, and macOS is the I have not root-caused it further — that likely needs a debug build with a stack trace on a real @tqchen how would you like to handle the macOS leg? Options as I see them: dig into the addon's |
macOS was segfaulting inside test_llvm_add_pipeline. It is the only leg where TVM links LLVM as a shared library: conda's libLLVM-23.dylib, per 'Found LLVM_LIBS=.../libLLVM-23.dylib' in the build log. The orcjit package statically links its own LLVM, so the process ended up with two ODR-incompatible LLVM copies. The package hides its LLVM symbols with --exclude-libs, but that guard is ELF-only, so nothing prevents the interposition on Mach-O. Windows already links LLVM statically and passes the same test, and the published wheels use --link-static on every platform, so this aligns the macOS job with the policy the shipped artifacts already follow. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Root-caused the macOS segfault: it is the only leg where TVM links LLVM as a shared library. From the macOS build log: versus Windows, which passes the same test: The orcjit wheel statically links its own LLVM (22.1.0), so on macOS the process ends up with two Fixed by linking LLVM statically in the macOS job, which is what Windows already does and what Pushed; macOS is re-running. All other legs are green on the previous commit (Linux CPU/GPU/ARM/ |
This makes
LLVMModuleexecution go through the separately installedapache-tvm-ffi-orcjitpackage instead of TVM hosting its own execution engine.Original work by @tqchen (first three commits); I rebased onto
mainand added the CIinstallation commit.
What changes
LLVMModuleNodeno longer owns anllvm::ExecutionEngine/llvm::orc::LLJIT. On firstfunction lookup it emits the retained module as an object file in memory and transfers
the bytes to the package through the global FFI functions
tvm_ffi_orcjit.GlobalDefaultSession/tvm_ffi_orcjit.SessionLoadModule, then forwardsGetFunctionto the returned dylib. Because the boundary transfers an object file, TVM andthe package do not need to be built against the same LLVM version.
This removes ~340 lines from
llvm_module.cc, including all the#if TVM_LLVM_VERSION >= 210/230LLJIT andObjectLinkingLayershims. MCJIT is no longersupported, so the now-dead
jittarget attribute is removed fromtarget_kind.ccandLLVMTargetInfo, along with its tests.There is no local fallback: if the package is missing, function lookup raises a targeted
install error. Importing
tvmstays silent so AOT-only workflows are unaffected.CI
The package is a new runtime dependency, so CI has to provide it:
docker/install/ubuntu_install_python_package.shso the~20MB wheel is baked into the CI image rather than downloaded on every run. This
docker/change tripsgit_change_docker.sh, so the images rebuild for this PR.--no-depsand wouldotherwise silently skip the new dependency, so it is installed explicitly.
Pinned to
==0.1.1inpyproject.tomland everywhere CI installs it, so the version movesdeliberately rather than drifting.
Verification
apache-tvm-ffi-orcjit0.1.1 publishes prebuilt wheels for all four CI platforms(manylinux x86_64/aarch64, macOS arm64, win_amd64), so no CI leg has to build LLVM.
quick-startexample end to end (compile object -> JIT load -> call) againsta
tvm_fficore built from the submodule pin, matching how CI installs the core. Alsochecked the case where the PyPI core is additionally present in
site-packages: thePYTHONPATHcopy correctly shadows it and JIT execution still passes.Requires-Dist: apache-tvm-ffi-orcjit==0.1.1verbatim,so the macOS job's
requires()assertion matches.Note: my local box has
USE_LLVM=OFF, so the LLVM codegen tests themselves were not runlocally — that coverage comes from CI (
test_minimal_target_codegen_llvm.pyon macOS/Windowsand the full Linux suite).
cc @tqchen
🤖 Generated with Claude Code