[GG] MLA: release absorbed B12X MXFP8 projection weights#154
[GG] MLA: release absorbed B12X MXFP8 projection weights#154voipmonitor wants to merge 2 commits into
Conversation
Let MLA backends explicitly opt into releasing kv_b_proj source storage after W_UK_T and W_UV are materialized. Restrict the reclaim to B12X MXFP8 packed weights and reconstruct from a regenerated pack during weight reloads. Assisted-by: OpenAI Codex
|
@coderabbitai review |
✅ Action performedReview finished.
|
📝 WalkthroughWalkthroughMLA post-load processing now supports regenerating KV-b-proj weights from packed B12X owners and conditionally releasing absorbed sources. Backend capability flags, prefill safeguards, and CPU-only lifecycle tests were added. ChangesMLA KV-b-proj lifecycle
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MLAProcess as process_weights_after_loading
participant KVBProj as kv_b_proj
participant QuantMethod as quant_method
participant ReleaseHelper as _release_b12x_mxfp8_kv_b_proj
MLAProcess->>KVBProj: materialize KV-b-proj weight
KVBProj->>QuantMethod: regenerate from packed owner
QuantMethod-->>MLAProcess: return materialized weight
MLAProcess->>ReleaseHelper: release sources when capability allows
ReleaseHelper-->>MLAProcess: clear absorbed B12X storage
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
vllm/model_executor/layers/attention/mla_attention.py (1)
298-304: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
Args:andReturns:sections to docstrings.As per coding guidelines, Python code must use Google-style docstrings with explicit
Args:/Returns:/Raises:sections. Both of these new helper functions have one-line docstrings that omit these sections.
vllm/model_executor/layers/attention/mla_attention.py#L298-L304: AddArgs:(documentinglayer,out_dtype,fallback_device) andReturns:sections.vllm/model_executor/layers/attention/mla_attention.py#L324-L325: AddArgs:(documentinglayer) andReturns:sections.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@vllm/model_executor/layers/attention/mla_attention.py` around lines 298 - 304, Update the docstrings for _materialize_kv_b_proj_weight and the helper at the second site in vllm/model_executor/layers/attention/mla_attention.py:298-304 and vllm/model_executor/layers/attention/mla_attention.py:324-325 to Google style, adding Args: entries for each requested parameter and a Returns: entry describing the returned tensor/value. Keep the existing behavior unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@vllm/model_executor/layers/attention/mla_attention.py`:
- Around line 298-304: Update the docstrings for _materialize_kv_b_proj_weight
and the helper at the second site in
vllm/model_executor/layers/attention/mla_attention.py:298-304 and
vllm/model_executor/layers/attention/mla_attention.py:324-325 to Google style,
adding Args: entries for each requested parameter and a Returns: entry
describing the returned tensor/value. Keep the existing behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 38ddb06a-2776-4225-a89d-3bfe9185e1e8
📒 Files selected for processing (4)
tests/v1/attention/test_mla_backends.pyvllm/model_executor/layers/attention/mla_attention.pyvllm/v1/attention/backend.pyvllm/v1/attention/backends/mla/b12x_mla_sparse.py
Address the CodeRabbit style review with Google-style argument and return documentation. Assisted-by: OpenAI Codex
|
Addressed the CodeRabbit Google-style docstring nit in 7724c65. The focused MLA lifecycle tests and Ruff/format checks still pass. |
Summary
B12X_MLA_SPARSEserves both decode and extend through its absorbedW_UK_TandW_UVprojections. Once those tensors are materialized, an MXFP8kv_b_proj's checkpoint tensors and temporary B12X packed owner are no longerused at runtime.
This change:
B12X_MLA_SPARSE;sleep/wake or weight reload.
Other quantization formats and other MLA backends remain unchanged.
Scope and prior work
This supersedes only the
kv_b_projhalf of #146. It is an independent commitdirectly on the current
dev/gilded-gnosishead. Compared with #146, it does notclear arbitrary non-BF16 parameters based solely on
prefill_backend is None,does not use
.data, and covers the reload lifecycle. Searches of open upstreamand local PRs found no other implementation; #146 is the intentional predecessor
being split.
PR #148 contains #146 in its stacked history, but its unique tip preallocates the
absorbed pair to reduce allocator fragmentation. That is an orthogonal follow-up,
not a second implementation of this storage-lifetime change, and will need a
clean rebase after the predecessor replacement.
The original GLM-5.2 TP4 validation in #146 reported about 290 MiB/GPU reclaimed,
unchanged 157,932-token prefill and decode throughput, unchanged 94.1% MTP
acceptance, and teacher-forced prefill KLD 0.1360 +/- 0.0019 versus a
0.1356 +/- 0.0054 certification band. The target-path storage lifetime is the
same here, while the guards are narrower.
Validation
AI assistance was used. This PR must not be merged until the human submitter has
reviewed every changed line and can defend the behavior end to end.