[BUILD] Modularize device runtime into per-backend DSOs#19594
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the TVM build system to transition from a monolithic runtime to a modular structure using multiple shared libraries, including per-backend DSOs and a dedicated library for optional components. Key changes include updates to CMake modules for device runtimes, refined Python library loading logic, and adjusted CI artifact handling. Review feedback identifies a critical issue regarding duplicate symbol definitions in the CLML module due to redundant source inclusion and recommends more specific exception handling in the CI S3 script to prevent masking infrastructure failures.
3079d95 to
f659c83
Compare
Modularize libtvm_runtime into per-backend shared libraries (libtvm_runtime_cuda, libtvm_runtime_vulkan, etc.) and libtvm_runtime_extra for contrib/disco modules. Each backend can be built independently. During Python import, available backend DSOs are discovered and loaded automatically, with missing backends silently skipped.
f659c83 to
e145b16
Compare
spectrometerHBH
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modularize
libtvm_runtimeinto per-backend shared libraries (libtvm_runtime_cuda,libtvm_runtime_vulkan, etc.) andlibtvm_runtime_extrafor contrib/disco modules.USE_CUDA=ONproduces onlylibtvm_runtime.so+libtvm_runtime_cuda.so)libtvm_runtime_extrais always produced if it has sources (disco, contrib modules)USE_CUDA,USE_VULKAN, etc. continue to worktarget_link_libraries(modern CMake pattern)Test plan
USE_CUDA=ON— verifylibtvm_runtime.so,libtvm_runtime_cuda.so,libtvm_runtime_extra.soproducedpython -c "import tvm; print(tvm.cuda(0).exist)"printsTruelibtvm_runtime_extra