Draft
Conversation
Adds two pieces required to load and execute V2 VM bytecode artifacts
that mlc-llm produces for Qwen3.5 (and other Gated DeltaNet hybrid)
models on stock relax runtimes:
1. src/runtime/vm/attn_backend.cc
Accept both "tirx" (current) and "tir" (older artifact name) at
every match site inside ConvertPagedPrefillFunc /
ConvertRaggedPrefillFunc / ConvertPagedDecodeFunc / Convert*-
TreeMaskFunc. Strictly widens the accepted set; no rejection
path changes.
2. src/runtime/device_c_api.cc (new, 108 LoC)
Flat C-ABI wrapper around tvm::runtime::DeviceAPI::Get(...).
Re-exports TVMDeviceAPIGet / ...CopyDataFromTo / ...StreamSync
etc. so Rust crates that link against the C symbols can use
this build without re-deriving the wrapper. Strict re-export,
no logic.
Verified end-to-end on macOS arm64 + Metal: Qwen3-{0.6B,8B} (V1
KvCache), Qwen3.5-{0.8B,2B,4B,9B} (V2 hybrid Gated DeltaNet), and
BAAI/bge-m3 (V1 embedding) all load and run.
This was referenced May 1, 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
Adds two pieces required to load and execute V2 VM bytecode artifacts that mlc-llm produces for Qwen3.5 (and other Gated DeltaNet hybrid) models on stock relax runtimes.
Changes
src/runtime/vm/attn_backend.cc— Accept both\"tirx\"(current) and\"tir\"(older artifact name) at every match site insideConvertPagedPrefillFunc/ConvertRaggedPrefillFunc/ConvertPagedDecodeFunc/Convert*-TreeMaskFunc. Strictly widens the accepted set; no rejection path changes.src/runtime/device_c_api.cc(new, 108 LoC) — Flat C-ABI wrapper aroundtvm::runtime::DeviceAPI::Get(...). Re-exportsTVMDeviceAPIGet/TVMDeviceAPICopyDataFromTo/TVMDeviceAPIStreamSyncetc. so Rust crates that link against the C symbols can use this build without re-deriving the wrapper. Strict re-export, no logic.Verification
End-to-end on macOS arm64 + Metal:
All load and run with semantically correct outputs.
Test plan