fix(metax): consolidate vLLM 0.20.2 compat shims into the plugin - #377
Open
tengqm wants to merge 2 commits into
Open
fix(metax): consolidate vLLM 0.20.2 compat shims into the plugin#377tengqm wants to merge 2 commits into
tengqm wants to merge 2 commits into
Conversation
tengqm
force-pushed
the
fix/metax-vllm024-compat
branch
2 times, most recently
from
August 30, 2026 07:07
09f8585 to
c26a75c
Compare
Four vLLM 0.24.0 fixes move into the plugin so the repacked vllm wheel stays pristine (same architecture as the 0.20.2 fix, flagos-ai#333): - torch.accelerator memory-stats shim: MACA torch ships only the device-management subset; bind torch.cuda equivalents for the APIs vLLM >= 0.24 calls unconditionally (MemorySnapshot, weight loaders). - vllm024_compat.py: monkey-patches _load_ptr (constexpr elem_dtype unwrap), _penalties_kernel (chained-boolean fix for metax triton 3.0.0), SamplingStates.get_top_k_top_p and PoolingRunner.pool (UVA CPU-typed views: index on CPU then move back to device). Version-gated by inspect.signature, imports try/except-guarded. - gdn_linear_attn.py: version-gated import of GatedDeltaNetAttention (moved to mamba/gdn/base.py in 0.24). - fa_utils.py: flag_gems reshape_and_cache_flash for the empty wheel (no compiled _C_cache_ops). Verified end-to-end on metax123 (MACA 3.7.2.x): serve + inference on Qwen3-4B with pristine site-packages restored.
vllm 0.24.0 moved rocm_aiter_grouped_topk to fused_moe/experts/rocm_aiter_moe and dropped the old fused_moe.rocm_aiter_fused_moe module. The unconditional import broke plugin load on any non-ROCm 0.24.0 wheel (ModuleNotFoundError at CLI parse time). Wrap the import in try/except and skip the aiter path when the symbols are unavailable.
tengqm
force-pushed
the
fix/metax-vllm024-compat
branch
from
September 1, 2026 14:59
928bc19 to
5c511da
Compare
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.
What
Consolidate the four vLLM 0.24.0 compatibility fixes into the plugin so the repacked vllm wheel stays pristine (same architecture as the 0.20.2 fix, #333).
Changes
vllm_fl/__init__.py—_patch_torch_accelerator(): MACA torch ships only the device-management subset oftorch.accelerator; bind thetorch.cudaequivalents for the memory-stats APIs vLLM >= 0.24 calls unconditionally (MemorySnapshot, memory_profiling, weight loaders).reset_peak_memory_statswrapped with a try/except fallback (mtgpu allocator rejects an explicit device before init).vllm_fl/dispatch/backends/vendor/metax/patches/vllm024_compat.py(new) — four monkey-patches, version-gated viainspect.signatureand try/except-guarded imports so older vLLM silently skips:_load_ptr(redefined@triton.jit): unwrapelem_dtype = elem_dtype.value— metax triton 3.0.0 rejects constexpr element types intl.pointer_type(). Re-assigned on bothbuffer_utilsandblock_table._penalties_kernel(redefined): parenthesize the chained boolean(use_rep_penalty or use_freq_penalty) or use_pres_penalty— metax triton 3.0.0 codegen rejectsA or B or C.SamplingStates.get_top_k_top_p/PoolingRunner.pool: metax UVA views are CPU-typed tensors; index on CPU then.to(device)to move back.gdn_linear_attn.py— version-gated import ofGatedDeltaNetAttention(moved tomamba/gdn/base.pyin 0.24).fa_utils.py—reshape_and_cache_flashfromflag_gemsfor the empty wheel (no compiled_C_cache_ops), same approach as the 0.20.2 fix.patches/__init__.py— registervllm024_compat.Verification
Verified end-to-end on metax123 (MACA 3.7.2.x, vLLM 0.24.0
+flagosempty wheel): serve + inference on Qwen3-4B (--enforce-eager --dtype bfloat16) with all four site-packages files restored to pristine (md5-checked). Two inference rounds (temperature=0and0.7) both passed.This PR was written in part with the assistance of generative AI.