Commit 4d4645b
authored
adapt(metax): MetaX C550 backend adaptation for vLLM 0.24.0 (#294)
## Background
This PR upgrades the MetaX C550 backend from vLLM 0.20.2 to 0.24.0,
fixing two regressions that blocked offline inference on MetaX C550
hardware.
---
## Fix 1: Missing `USE_EXP2` parameter in MetaX delta-rule kernel
**File:**
`vllm_fl/dispatch/backends/vendor/metax/patches/chunk_delta_h.py`
vLLM 0.24.0 updated the upstream fla-org
`chunk_gated_delta_rule_fwd_kernel_h_blockdim64` kernel signature to add
`USE_EXP2: tl.constexpr`. The MetaX-patched copy was not updated
accordingly, causing a `TypeError` at kernel dispatch time.
**Fix:** Add `USE_EXP2: tl.constexpr = False` to the MetaX kernel
signature. The parameter is accepted but unused — MetaX uses its own exp
implementation.
---
## Fix 2: Incomplete `torch.accelerator` memory API patch for torch
2.8+metax
**File:**
`vllm_fl/dispatch/backends/vendor/metax/patches/accelerator_compat.py`
vLLM 0.24.0 uses several `torch.accelerator` memory APIs added in
PyTorch 2.9+. The MetaX torch distribution ships as `2.8+metax` and is
missing these APIs, causing `AttributeError` during worker startup:
```
AttributeError: module 'torch.accelerator' has no attribute 'max_memory_allocated'
```
The existing `accelerator_compat.py` only patched `empty_cache` and
missed 5 other APIs.
**Fix:** Patch all 6 missing APIs to their `torch.cuda.*` equivalents:
`empty_cache`, `memory_stats`, `memory_reserved`, `memory_allocated`,
`reset_peak_memory_stats`, `max_memory_allocated`
Reference: [MetaX vLLM-metax
v0.21.0](https://github.com/MetaX-MACA/vLLM-metax/blob/releases/v0.21.0/vllm_metax/patch/torch_fix/fix_standalone_compile.py)
---
## Testing
| Model | Type | TP | dtype | max_model_len | Result |
|-------|------|----|-------|---------------|--------|
| Qwen3.6-27B | Mamba hybrid | 4 | bfloat16 | 512 | ✅ PASS |
| Qwen3.6-35B-A3B | Mamba + MoE (256 experts) | 4 | bfloat16 | 512 | ✅
PASS |
Hardware: MetaX C550 × 8, MACA 3.7.0, torch 2.8+metax1 parent e8f15e6 commit 4d4645b
2 files changed
Lines changed: 67 additions & 6 deletions
Lines changed: 66 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
8 | 20 | | |
9 | 21 | | |
10 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
11 | 50 | | |
12 | | - | |
13 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
0 commit comments