#3552·mlc-llm

主分支上的 Android 构建出现问题: TVM/mlc_llm 版本偏差 + tvm_runtime.h 与上游 TVM 重组不一致

作者: coderz-cz创建于 2026年9月23日更新于 2026年9月23日
标签bug
  1. Native crash (access violation) during Dlight lowering Symptom: mlc_llm compile/package crashes with a native access violation (0xC0000005 on Windows) inside tvm.s_tir.dlight...compute_inline, while running with apache-tvm-ffi==0.1.14.post0 (the version mlc-ai-nightly-cpu==0.26.dev246 declares as Requires-Dist: apache-tvm-ffi>=0.1.13). Root cause: ABI mismatch between the installed apache-tvm-ffi Python package and the compiled tvm_compiler.dll/tvm_runtime.dll shipped in the mlc-ai-nightly-cpu wheel for this snapshot. Workaround: pinning apache-tvm-ffi==0.1.13 exactly avoids the crash. Note this version is currently yanked on PyPI (no reason given); the .post0–.post3 patch releases of 0.1.13 do not work (crash returns), only the base 0.1.13 release does. Ask: should the mlc-ai-nightly-cpu wheel pin/declare a narrower/exact apache-tvm-ffi version instead of >=0.1.13? A yanked release being the only functional one is a packaging trap for anyone following the install docs literally. 2. AttributeError: module 'tvm.tirx' has no attribute 'is_buffer_var' Symptom: compilation fails during the LowBatchGemvSpecialize pass with tirx.is_buffer_var not existing. Root cause: commit 9fa644f5 ("[Fix] Adapt compiler passes to typed TIR buffer parameters (#3534)", 2026-08-17) changed Python/mlc_llm/compiler_pass/{low_batch_specialization,fuse_dequantize_transpose,lift_global_buffer_alloc}.py to use a "typed TIR buffer parameters" TVM API (tirx.is_buffer_var, PrimFunc.params containing Buffer objects directly instead of Var + buffer_map). This API does not exist anywhere — not in Python, not in C++/FFI-registered — in the pinned 3rdparty/tvm submodule commit (837cb9de1), nor in the currently published mlc-ai-nightly-cpu==0.26.dev246 wheel (checked via dir(tvm.tirx) at runtime). origin/main of the mlc-LLM repo has no newer commit fixing this; the tvm submodule's own mlc and mlc-staging branches on mlc-ai/relax also don't define is_buffer_var anywhere in their trees. Workaround used locally: revert Python/mlc_llm/compiler_pass/{low_batch_specialization,fuse_dequantize_transpose,lift_global_buffer_alloc}.py to their state …