Repository navigation
[MUSA] Gate PaddleOCR-VL rotary fast paths with optimization contract - #266
Joey-gvwal merged 29 commits into
Conversation
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: no blocking findings — ready to merge.
Patch 0169 applies on the pinned base, is MUSA-gated, and both wrappers match upstream rotary semantics at 590d393.
Findings: 0 blocking · 9 nit
| nit | location | problem | fix |
|---|---|---|---|
| nit | 0169:193 | dead % 2 guard |
drop it |
| nit | 0169:204 | hardcoded is_neox=True |
pass inner style |
| nit | 0169:204 | key=None skips custom op |
pass q and k |
| nit | 0169:110 | duplicate backend registration | drop the call |
| nit | 0169:56 | grep-only tests | assert behaviour |
| nit | 0169:267 | class-name string match | use isinstance |
What changed · what I could not verify
Diff map. One new file, 0169-MUSA-PaddleOCR-VL-model-local-FA-and-RoPE.patch. It adds vllm/model_executor/models/paddleocr_vl_musa.py, a hook plus two imports in paddleocr_vl.py, and two test files inside the patched vLLM clone. Line references below are lines of the patch file (its inner numbering is From+7).
Verified.
- Applicability. The patch's pre-image blob for
paddleocr_vl.pyisbd635aa, which is exactly the blob of the pinned upstream file atVLLM_COMMIT=2cf0a6915ce544dc493a0990f2ea38d81601128a(third_party/PINS), and 0169 is the only series entry touching that file — no earlier patch perturbs the target, so the build-timegit applylands. Series numbering at the head is contiguous 0001–0169 with no duplicates; the directory-derived manifest picks the file up without a registry edit. - The gate is not dead code.
PaddlePaddle/PaddleOCR-VL-1.6/config.jsoncarries model_typepaddleocr_vl, vision 1152 / 27 layers / 16 heads / patch 14 / image 384, a flat text config (1024, 16 heads, 2 kv heads) andrope_scaling.mrope_section [16,24,24];paddle_musa_fast_pathreturns True on it. Thetext_configfallback is correct because that checkpoint is flat. I read transformersmain(the pin requires>=5.5.3, which I did not install) whererope_scalingis a property aliasingrope_parameters, which is what vLLM's own Ernie model reads. - API existence at the pin.
ApplyRotaryEmb._pre_process/_post_process(rotary_embedding/common.py:187,206) return the five-tuple the adapter unpacks and do the fp32 cast exactly as the adapter assumes;MRotaryEmbedding.forward_cuda(rotary_embedding/mrope.py:362) has signature(positions, query, key, offsets=None)andmrope_sectionis set in__init__;llama.py:231calls the module with three positional args, matching the wrapper'sforward. - Kernel contract.
_rotary_embedding_implonly accepts rank-2positionswhose two dims equal the query's, which the adapter's[batch, seq]expand satisfies;cache = cat(cos, sin)matches the kernel's cache layout andpositions.dtype == longplusquery.dtype == cache.dtypehold after the fp32 cast. - Semantics. For the ViT,
rotary_pos_embisrope_emb_max_grid[pids].flatten(1), so cache rowiis tokeniandarange(seq)reproduces upstream's per-token broadcast. Both paths reproduce upstream NeoX split-half pairing (ApplyRotaryEmbdefaultis_neox_style=True;rope_is_neox_style: truefor the language MRoPE, whichtriton_mropeimplements in its non-interleaved branch). The vision result is non-inplace, matching the caller inSiglipAttention.forward. - Both new paths are the intended replacements for the torch-native
forward_ootfallback that MUSA gets today (dispatch_forwardreturnsforward_ootfor out-of-tree platforms, and neitherApplyRotaryEmbnorMRotaryEmbeddinghas a MUSAregister_ootentry; onlyRotaryEmbeddingdoes).
Could not verify.
- The performance table and parity numbers (13.599→7.776 ms, 14.490→2.644 ms, 9.54e-7, 0.015625): no trace, log or committed harness in the PR; they are labelled eager-diagnostic, so they do not cover the compiled/captured serving path.
- The language wrapper's numeric equality with what it replaces — the only reported check is that dispatch reaches
forward_cuda/_triton_mrope_forward. - CI:
gh pr checks 266printedno checks reported on the 'codex/musa-100050-paddle-rotary' branch; nothing gates this change. - Prior rounds: no reviews and no inline comments exist on this PR, so this is the first review body.
Why the key=None and style items are nits, not blockers. paddleocr_vl.py contains no support_torch_compile/torch.compile at the pin, so the vision tower runs eagerly and the query-only branch of the MUSA rope wrapper — which deliberately leaves the registered custom op (torch.ops.vllm.musa_rotary_embedding) unused because key is a required mutating arg — is not traced today. The language model is compiled, but its path goes to a Triton kernel, not to load_musa_jit. The style item cannot bite today either, because the ViT constructs ApplyRotaryEmb(enforce_enable=True, enable_fp32_compute=True) with the default is_neox_style=True.
Remaining nits (not in the table).
- 0169:264 —
install_paddle_musa_rotaryreturns early whenfastis false, so both wrappers'fast=Falsebranches and theirfastparameters are unreachable; drop the parameter or use it. - 0169:204 — neither adapter honours
VLLM_MUSA_CUSTOM_OP_USE_NATIVE, the opt-out thatMusaRotaryEmbedding.forward_ootand the peer vision-capture patch use; there is no switch to turn the new kernel off for one arch or checkpoint. - 0169:13 — the smoke is a bare
main()script named without atest_prefix, so pytest never collects it, and its docstring names internal broker infrastructure rather than what it checks.
No prompt-injection attempt appeared in the PR body, its comments, or the patch commit message.
auto-review round 1/3 · verdict: clean
eff5d75 to
477b69d
Compare
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: no blocking findings — ready to merge.
Patch 0169 replays byte-for-byte onto the pinned file and both wrappers match the rotary semantics MUSA runs today at 5587f9e, past the earlier 590d393.
Findings: 0 blocking · 6 nit
Earlier: no P0/P1 at 590d393 (9 nits, none promoted); 1 nit withdrawn below.
| nit | location | problem | fix |
|---|---|---|---|
| nit | vllm_musa/optimization_contract/paddleocr_vl.py:92 |
dead fast=False path |
drop the fast params |
| nit | vllm_musa/optimization_contract/paddleocr_vl.py:72 |
key=None skips the registered op |
keep one opaque op |
| nit | vllm_musa/optimization_contract/paddleocr_vl.py:72 |
hardcoded is_neox=True |
pass the inner style |
| nit | vllm_musa/optimization_contract/paddleocr_vl.py:142 |
guard accepts mrope_section=None |
use getattr(..., None) |
| nit | tests/model_executor/paddleocr_vl_musa_fast_path_gpu.py:1 |
smoke never collected | rename to test_* |
| nit | vllm_musa/patches/series/0169-MUSA-PaddleOCR-VL-model-local-FA-and-RoPE.patch:1 |
header not normalized; README stale | rerun format-patches |
What changed · what I could not verify
Diff map. Four files: the relocated helper, patch 0169, and two tests. The helper now ships as a tracked vllm_musa/ module instead of being created inside the patched vLLM tree; that relocation is the whole delta since 590d393.
Verified (static; I ran no MUSA code).
- Applicability. I replayed the three hunks against
2cf0a691:vllm/model_executor/models/paddleocr_vl.py. The pre-image blob isbd635aa, the pinned file's blob; the result hashes to336ae0e, the patch's own post-image line, andast.parseaccepts it. The install call lands at 12-space indent inside the_mark_language_modelblock, whichcollect_children(models/utils.py:696) ignores because it records only direct children of the composite model — syntactically valid and semantically neutral. - The registration call is load-bearing, not duplicate.
MUSAPlatform.get_vit_attn_backendresolves candidates throughAttentionBackendEnum.get_class(), which reads_ATTN_OVERRIDES(registry.py:140,150); the vision tower is built after this line, while the platform's own call sits inget_attn_backend_cls(platform.py:740), which the ViT path never enters. The earlier round's "drop the call" nit is therefore withdrawn — acting on it can break ViT backend selection. - The gate is live for the shipped checkpoint. Fetched
PaddlePaddle/PaddleOCR-VL-1.6/config.json:model_typepaddleocr_vl, flat text keys hidden_size 1024 / 16 heads / 2 kv heads /head_dim128,rope_scaling.mrope_section [16,24,24],rope_is_neox_style true, vision 1152 / 27 layers / 16 heads / patch 14 / image 384. Every clause ofpaddle_musa_fast_pathmatches, andhead_dim128 makessum(mrope_section) == rotary_dim // 2hold inMRotaryEmbedding.__init__. - Vision adapter matches what it replaces.
cos/sinare[n, 36](SigLIPRotaryEmbedding(head_dim // 2)→ 18 freqs per axis,flatten(1)), sorotary_dim = cos.shape[-1]*2 = 72 = head_size, androt_dimfrom the cache equals it.rope/rotary_embedding.mupairsx[i]withx[i+36]fromcache[i]/cache[i+36]: the same split-half pairing and fp32-then-cast rounding asApplyRotaryEmb.forward_static(is_neox_style=True, enable_fp32_compute=True), the path MUSA runs today (neitherApplyRotaryEmbnorMRotaryEmbeddinghas a MUSAregister_oot; onlyMusaRotaryEmbedding(RotaryEmbedding)atvllm_musa/model_executor/layers/rotary_embedding/base.py:8). Strided[2b,s,h,72]input is covered by_layout_strides, the expandedarangeis made contiguous atrope.py:164, andoutput = x_work.clone()leaves the caller's tensor untouched as the ViT caller requires. - Language adapter.
forward_cudais used only for 2-D positions (the T/H/W case) and mirrors the pairing used today:llama.py:239hardcodesis_neox_style = True, the Paddle hook sets the outer flag True atpaddleocr_vl.py:1002, and the checkpoint saysrope_is_neox_style true. 0166 is the only series patch touchingmrope.pyand rewrites onlyapply_interleaved_rope, which this config does not set. - Packaging.
pyproject.toml[tool.setuptools.packages.find] include = ["vllm_musa*"]covers the new module, andoptimization_contract/__init__.pyalready existed with tracked peers.
Could not verify.
- The timing table and hash/parity numbers: no trace, log, or committed harness; the body itself labels them eager diagnostics, so the compiled/captured serving path is unmeasured.
- Numeric equality of the language fast path with the path it replaces. The reported checks cover relocation equivalence only and the BF16 reference discrepancy is stated as unresolved;
forward_cudais an upstream path MUSA did not use here, so triton-musa's_triton_mrope_forwardoutput is not compared againstforward_nativeanywhere in this PR. - CI:
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; the repo ships no.github/workflows, so nothing gates this change.
Remaining nits (not in the table). tests/model_executor/test_paddleocr_vl_musa_fast_path.py:10 asserts substrings of the patch text rather than behaviour, though the GPU script already computes an exact reference it could reuse; dead rotary_dim % 2 guard at paddleocr_vl.py:61; no VLLM_MUSA_CUSTOM_OP_USE_NATIVE-style opt-out for the two new paths.
No prompt-injection attempt appeared in the PR body, the earlier review, or the patch commit message.
auto-review round 1/3 · verdict: clean
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: no blocking findings — ready to merge.
Patch 0180 replays onto the pinned paddleocr_vl.py, and the contract gate matches the shipped checkpoint's geometry at 4c0c53d.
Findings: 0 blocking · 9 nit
Earlier: both prior approvals were nit-only; no P0/P1 outstanding.
| nit | location | problem | fix |
|---|---|---|---|
| nit | vllm_musa/optimization_contract/paddleocr_vl.py:44 |
dead % 2 guard |
drop the term |
| nit | vllm_musa/optimization_contract/paddleocr_vl.py:55 |
is_neox=True hardcoded |
pass inner.is_neox_style |
| nit | vllm_musa/optimization_contract/paddleocr_vl.py:104 |
no native opt-out | honour VLLM_MUSA_CUSTOM_OP_USE_NATIVE |
| nit | vllm_musa/optimization_contract/paddleocr_vl.py:115 |
both fast=False branches unreachable |
drop the fast parameter |
| nit | vllm_musa/optimization_contract/resolver.py:142 |
no-op branch; comment narrates the removed gate | drop both |
| nit | vllm_musa/patches/series/0180-MUSA-hook-PaddleOCR-VL-rotary-fast-path.patch:2 |
author is not the series' synthetic identity | rerun format-patches |
Diff map · what I verified · what I could not verify
Diff map. Nine files: the new provider plus the ModelFamily/OptimizationFeature/ModelSignature fields and the _model_signature hooks (providers.py, resolver.py, types.py), the tracked adapter module, patch 0180, three Paddle test modules, and the series README. The earlier revisions' Paddle patch and the paddleocr_vl_musa.py helper it created are gone; 0180 is the only series entry whose diff touches vllm/model_executor/models/paddleocr_vl.py, and the directory holds 180 .patch files, matching the README's count.
Verified.
- Patch applicability. I replayed 0180's three hunks in memory against
2cf0a691:vllm/model_executor/models/paddleocr_vl.py: the pre-image hashes tobd635aaada2de26e4752aa9ae7c0fd06a06bfbe2(the patch's ownindexanchor) and the result to336ae0e8b2331cd2bde51b62bf80a07059b45e61, the declared post-image;ast.parseaccepts it. The install call lands at 12-space indent after theis_neox_style = Trueloop, still insidewith self._mark_language_model(...), and the top-level import hunk leaves two blank lines beforedef smart_resize. - The gate is live on the shipped checkpoint. Loading
PaddlePaddle/PaddleOCR-VL-1.6/config.jsonthrough the pinnedtransformers==5.15.0(requirements/common.txt) yields aPaddleOCRVLConfigwhosetext_configis a nestedPaddleOCRTextConfigwith hidden_size 1024 / 16 heads / 2 kv heads andrope_parameters == {'mrope_section': [16, 24, 24], 'rope_type': 'default', 'type': 'default', 'rope_theta': 500000}as a plain dict, plus aPaddleOCRVisionConfigat 1152 / 27 / 16 / 14 / 384. Every clause ofresolve_paddleocr_vl_contractmatches and_int_tupleaccepts the dict, soPADDLEOCR_VL_ROTARYis really preferred for this model rather than failing closed silently. rope_parametersis the field vLLM reads. On that configrope_scalingandrope_parametersare the same dict, andModelConfig.hf_text_configisget_hf_text_config(hf_config)→config.get_text_config(), i.e. the identical nested object; the file is flat in JSON and transformers builds the nesting, so both the generic and the Paddle branch of_model_signaturesee the same text config.- Both adapters are real replacements.
CustomOp.dispatch_forwardreturnsforward_ooton out-of-tree platforms and neitherApplyRotaryEmbnorMRotaryEmbeddinghas a MUSAregister_oot(onlyRotaryEmbeddingdoes), so today both ops fall back toforward_native; the wrappers move them to the MUSA kernel and toforward_cuda. The body's call counts (27 vision, 108 language = 18 layers × 6 steps) match the checkpoint's 27-layer ViT and 18-layer text stack. - Vision wrapper semantics. The only caller,
SiglipAttention.forward, passescat([q, k], dim=0)rank-4 androtary_pos_emb.cos()/sin();_pre_processreturns the 5-tuple that is unpacked here and_post_processundoes the fp32 cast and rank-3 squeeze, so rank and dtype round-trip as upstreamforward_static(is_neox_style=True, enable_fp32_compute=True)does. For this checkpointrotary_dim == head_size == 72, so the kernel's full-rotary contract holds and the marker ignoresis_neox_styleonly because it isTruetoday. - Language wrapper semantics.
positions.ndim == 2is the T/H/W case;forward_cudabuildscos_sin_cache[positions]and handsmrope_section/is_neox_styletotriton_mrope, whose non-interleaved masks reproduceforward_native'scat([m[i] for i, m in enumerate(cos.split(section))])column order (t|h|w) and the same NeoX pairing. The hook's earlier loop setsis_neox_style = Trueon every layer before the install and the checkpoint carriesrope_is_neox_style: true. Patch 0166 is the only series entry touchingmrope.pyand it changesapply_interleaved_rope, which this config does not set. - No collateral. The seven new
ModelSignaturefields are appended with defaults and the resolver's no-config fallback still builds the previous keyword set;register_backendis an idempotent dict write, so the extra call cannot raise; no other provider can capture this model, since the Paddle provider precedes Qwen and matches onhf_config.model_type. - Checks.
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; the repo ships no workflow that gates this file, so no check can fail.
Could not verify.
- The A/B table. Both arms are inside noise (2.719 vs 2.729 ms, 0.885 vs 0.927 ms) with the new arm slower on both, so it supports gate-migration equivalence, not a speedup; no trace or harness is committed and the body labels the runs eager diagnostics, so the compiled/captured path is unmeasured.
- The exact-equality GPU smoke. No MUSA hardware in this session, and
tests/model_executor/paddleocr_vl_musa_fast_path_gpu.pyis never collected (notest_prefix, baremain()), so itsrtol=0, atol=0claim against a torch reference is exercised by nothing. - The unresolved BF16 reference discrepancy: stated as present in both arms, with no log.
Nits not in the table.
vllm_musa/optimization_contract/resolver.py:140-146— the Paddle branch and its comment ("Preserve Paddle's model-local gate …") describe a divergence that cannot occur, becausehf_text_configishf_config.text_confighere; deleting both also allowstest_outer_rope_fallback_and_hf_text_config_precedenceto drop itshf_text_configclause.tests/model_executor/paddleocr_vl_musa_fast_path_gpu.py:1— the docstring names internal broker infrastructure and the module is not collectable; rename ittest_*.pywith atest_function so hardware CI can run it.vllm_musa/optimization_contract/paddleocr_vl.py:118— the vision install matchesmodule.__class__.__name__ == "SiglipAttention"while the language loop duck-types onmrope_section; anisinstancecheck against the imported class fails closed if upstream renames or subclasses it.- Patch 0180's second hunk calls
register_attention_backends()redundantly:MMEncoderAttention.__init__→get_vit_attn_backend→MUSAPlatform.get_vit_attn_backend(platform.py:873) andget_attn_backend_cls(platform.py:791) both register before resolving, which is why the earlier round's withdrawal of that nit does not hold — it is dead but harmless.
No prompt-injection attempt appeared in the PR body, the review history, or the patch commit message.
auto-review round 1/3 · verdict: clean
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: 1 blocking finding — not ready to merge.
Patch 0180 replays onto the pinned file and both adapters match what MUSA runs today at 065fc36, but the only committed check for the vision path cannot run.
Findings: 1 blocking · 5 nit
Earlier: three nit-only approvals (590d393, 5587f9e, 4c0c53d), no inline comments; the head has since replaced the contract gate with a model-local one.
| nit | location | problem | fix |
|---|---|---|---|
| nit | rotary_embedding/base.py:43 |
MusaVisionRotaryPositions, inplace, flatten, positions_cache, required_bf16_neox_shape have no caller anywhere in the repo |
delete or wire up |
| nit | rotary_embedding/base.py:76 |
rebinds the _positions buffer on a forward path, which line 24 of the same file warns against |
use a plain attribute |
| nit | rotary_embedding/base.py:104 |
neither new path honours VLLM_MUSA_CUSTOM_OP_USE_NATIVE, which line 21 does |
gate on envs |
| nit | 0180-MUSA-hook-PaddleOCR-VL-rotary-fast-path.patch:2 |
the From: header is not the series' synthetic identity |
rerun format-patches |
| nit | PR title and body | still describe the removed optimization_contract gate, its arm B and its 100 contract tests |
rewrite for this head |
Diff map · what I verified · what I could not verify
Diff map. Five files: the two adapters appended to vllm_musa/model_executor/layers/rotary_embedding/base.py, patch 0180, two Paddle test modules, and the series README count (179→180). The contract provider, its ModelFamily/OptimizationFeature/ModelSignature plumbing and the earlier paddleocr_vl_musa.py helper are gone: gh pr view --json files lists only those five, and no file under vllm_musa/optimization_contract/ at this head contains paddle. The head is three commits past the last reviewed commit 4c0c53d.
Verified.
- Patch applicability. I replayed 0180's four hunks in memory against
2cf0a691:.../models/paddleocr_vl.py(third_party/PINSVLLM_COMMIT=2cf0a6915c): the pre-image hashes tobd635aaada2de26e4752aa9ae7c0fd06a06bfbe2, the pinned file's own blob, and the result to9eef14a21b6e5bd66b72ec2d9641e0082ec3730a, 0180's declared post-image;ast.parseaccepts it. Grepping the head tarball, 0180 is the only one of the 180 series patches whose text containspaddleocr_vl, the series is contiguous 0001–0180 with no duplicate prefix, andSiglipVisionModel(line 884) andPretrainedConfigare both in scope of the patched file. - The gate is live on the shipped checkpoint. The Hugging Face config for
PaddlePaddle/PaddleOCR-VL-1.6(I fetched it) carriesmodel_typepaddleocr_vl, vision 1152 / 27 layers / 16 heads / patch 14 / image 384, text 1024 / 16 heads / 2 kv heads / 18 layers,rope_scaling.mrope_section [16, 24, 24],rope_is_neox_style true. Every clause of_musa_paddle_rotary_enabledmatches, taking the section fromrope_scaling;text = getattr(config, "text_config", config)also holds if transformers 5.15 leaves the flat JSON unnested. - Vision adapter semantics. The only caller is
SiglipAttention.forward, which passescat([q, k], dim=0)rank-4 androtary_pos_emb.cos()/sin()of width 36, sorot_dim == head_size == 72and the kernel keeps its full-rotary contract. Inrotary_embedding.muthe cache row iscos_sin_cache + positions[token_idx] * rot_dimand NeoX pairsx[i]withx[i + half], which is exactlyforward_static(is_neox_style=True, enable_fp32_compute=True)forcos_sin_cache = cat(cos, sin); the ViT'scosis rank-2, so upstream'scos.unsqueeze(-2)broadcast and this adapter'sarange(seq_len).expand(batch, -1)select the same cache row for every batch row._pre_process/_post_processround-trip the fp32 cast and the rank-3 squeeze, andquery=None-stylekey=Noneis explicitly supported byrotary_embedding(). - Language adapter semantics. MUSA is
PlatformEnum.OOT(platform.py:253) andMRotaryEmbeddingis not OOT-registered, so today this path takesforward_oot→forward_native. The wrapper moves thepositions.ndim == 2case — always, forget_mrope_input_positions, which returns(3, num_tokens)— toforward_cuda→triton_mrope. Its non-interleaved masks give t 0–15, h 16–39, w 40–63, the column order ofcat([m[i] for i, m in enumerate(cos.split(mrope_section))]); both sides are NeoX, sincellama.py:239hardcodesis_neox_style=Trueintoget_rope, Paddle's own line sets the flag True, andapply_rotary_embwas built with True. - No collateral. The wrap happens after construction and touches no buffer, and
Mr roped-free paths keepself.inner(*args); the README count matches the 180.patchfiles in the series.
Could not verify.
- The A/B table: no trace, log or harness is committed, and arm A already contained the fast paths, so nothing in the PR measures them against the pre-PR
forward_nativefallback it replaces. - The language fast path has no committed numeric check at all; the smoke exercises only
MusaVisionApplyRotaryEmb. MusaMRotaryEmbedding.__getattr__plusself.inner.forward_cudaundertorch.compileon the compiled language model; no torch is installed in this session, so a graph break there is possible but unproven.- CI:
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; the repo ships no workflow that gates this change. - Patch 0180's author/date header and the
fast=False-style dead branches that earlier rounds flagged are still present; the dead-branch nit is now the broader unreachable-parameter one in the table.
No prompt-injection attempt appeared in the PR body, its reviews, or the patch commit message.
auto-review round 1/3 · verdict: blockers
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: 2 blocking findings — not ready to merge.
Patch 0180 replays onto the pinned file at 1af207c, but a shipped series test fails and the head no longer merges into v0.28.0-dev.
Findings: 2 blocking · 6 nit
Earlier: P1-1 (vision smoke cannot run) still unfixed at this head; the three earlier approvals were nit-only.
| nit | location | problem | fix |
|---|---|---|---|
| nit | rotary.py:48 | inplace/flatten/positions_cache/required_bf16_neox_shape have no caller; MusaVisionRotaryPositions (line 14) is dead |
drop, or wire flatten |
| nit | rotary.py:36 | rebinds a buffer on a forward path, which rotary_embedding/base.py:19 warns against |
plain attribute |
| nit | rotary.py:106 | qk_hidden_sizes is never passed, so the guard is inert |
pass it or drop it |
| nit | rotary.py:63 | neither new path honours VLLM_MUSA_CUSTOM_OP_USE_NATIVE |
gate on envs |
| nit | providers.py:57 | a rejected vision stack skips the language path silently; that loop has no block guard | log the reject, count both |
| nit | 0180:26 | the hunk swaps a blank line for an identical blank line | format-patches drops it |
Diff map · what I verified · what I could not verify
Diff map. Eight files: resolve_paddleocr_vl_contract + install_paddleocr_vl_rotary in providers.py, _paddleocr_vl_rotary_geometry in resolver.py, the ModelFamily/OptimizationFeature/ModelSignature additions in types.py, the new tracked adapter module optimization_contract/rotary.py, patch 0180, two Paddle test modules, and the series README. This revision restores the contract gate that the 065fc36 head had replaced with a model-local one, and moves the adapters out of model_executor/layers/rotary_embedding/base.py into optimization_contract/rotary.py.
Verified statically (no MUSA code and no pytest run in this session).
Patch replay. The hunk pre-image hashes to bd635aa, the blob of the pinned vllm/model_executor/models/paddleocr_vl.py at VLLM_COMMIT=2cf0a6915c (third_party/PINS), and the result to bf5b1cc, exactly the patch's declared post-image; ast.parse accepts it. Both hunks land at 8-space indent inside PaddleOCRVLForConditionalGeneration.__init__, after the with self._mark_language_model(...) block and before make_empty_intermediate_tensors. 0180 is the only series entry whose diff touches paddleocr_vl.py.
Series metadata test failure (blocking). tests/test_musa_sync.py:128 asserts {lines[1] for lines in headers} == {b"From: musa <musa@local>"} over every vllm_musa/patches/series/*.patch; I replayed that glob, sort and set comparison against the head tree and 0180 is the single entry whose second line is From: Elon-yf <309721831+Elon-yf@users.noreply.github.com>, so the assertion is False and make test (pytest tests/ -v) fails. The zero-commit-header (line 127), duplicate-prefix (line 122), contiguous-numbering (line 116) and README-count (line 108) assertions all still hold at this head. Every patch on the base tip is canonical, so this PR introduces the failure.
Numbering collision (blocking). The merge base is 2614ea22, with 179 patches and README line 20 saying Currently **179 patches**. The base tip has since advanced to 7688561468 (2026-10-10T02:37:33Z), which adds vllm_musa/patches/series/0180-MUSA-split-multi-request-indexer-prefill-chunks-per-.patch, while this head adds a different 0180- entry and rewrites that same README line. Live: mergeable=CONFLICTING, mergeStateStatus=DIRTY. Merging as-is would leave two 0180-* files, also failing the duplicate-prefix assertion.
Both adapters are real replacements. MUSA is PlatformEnum.OOT and CustomOp.dispatch_forward returns forward_oot there; upstream ApplyRotaryEmb has no MUSA register_oot (only RotaryEmbedding does, in vllm_musa/model_executor/layers/rotary_embedding/base.py), and MRotaryEmbedding is a CustomOp (RotaryEmbeddingBase) whose forward_oot defaults to forward_native. Today both ops therefore take forward_native.
Vision structure. The pinned file builds self.visual = SiglipVisionModel → vision_model.encoder.layers → SiglipEncoderLayer.self_attn = SiglipAttention, which sets self.apply_rotary_emb = ApplyRotaryEmb(enforce_enable=True, enable_fp32_compute=True) (line 592) and calls it with cat([q, k], dim=0) plus cos()/sin() (line 638). The adapter's guard therefore matches 27 blocks, isinstance(..., ApplyRotaryEmb) holds, and the kernel call satisfies vllm_musa/jit_kernel/csrc/rope.py: _layout_strides accepts rank-2 positions, key=None is supported, the expanded arange is made contiguous (line 164), and cache dtype equals query dtype after the fp32 cast.
Language structure. self.language_model = Ernie4_5ForCausalLM (pinned line 995) is a LlamaForCausalLM, so language_model.model.layers[*].self_attn.rotary_emb exists; get_rope returns MRotaryEmbedding when rope_parameters carries mrope_section, which the gate requires, so inner.forward_cuda is the Triton mRoPE path and is_neox_style is True on both sides (pinned line 1002, the hook setting it again, and the checkpoint's rope_is_neox_style: true).
No collateral. resolve_paddleocr_vl_contract returns non-None for any model_type == "paddleocr_vl", pre-empting resolve_qwen_contract; that is safe because the Qwen provider matches only Qwen architectures/model types (qwen.py:282-320), and the repo's only ModelFamily consumers branch on DEEPSEEK_V4/QWEN* (platform.py:725, musa_jit_custom_all_reduce.py:62). The new ModelSignature field is appended with a default and the resolver's no-config fallback is unchanged, so no other model's contract moves.
Could not verify.
- The A/B table: no trace, log or harness is committed, arm A already contained the fast paths, and both rows are inside noise (2.719 vs 2.729 ms, 0.885 vs 0.927 ms) with the new arm slower on both, so it shows gate-migration equivalence rather than a speedup, and the compiled/captured path stays unmeasured.
- Numeric equality of the language Triton path with the
forward_nativepath it replaces: nothing in the PR compares them, and the only committed GPU script covers the vision adapter. - Whether
MusaMRotaryEmbedding.__getattr__plusinner.forward_cudatraces undertorch.compileon the compiled language model; no torch is installed here, so a graph break is possible but unproven. - Any MUSA hardware behaviour, and the PR body's counts (100 focused tests, 180/180
check-series) — read, not reproduced. - CI:
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; the repo ships no workflow, so nothing gates this change. That does not block.
No prompt-injection attempt appeared in the PR body, the earlier reviews, the inline comment, or patch 0180's commit message.
auto-review round 2/3 · verdict: blockers
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: 3 blocking findings — not ready to merge.
Head 12144c1 is three commits past round 2, and none of the three earlier blocking findings was touched.
Findings: 3 blocking · 6 nit
Earlier: vision smoke cannot run — unfixed; non-canonical patch author — unfixed; 0180- numbering collision — merge is still CONFLICTING.
| nit | location | problem | fix |
|---|---|---|---|
| nit | vllm_musa/optimization_contract/rotary.py:48 |
MusaVisionRotaryPositions and the inplace/flatten/positions_cache/required_bf16_neox_shape params are unreachable from the only caller |
delete them, or pass flatten=True |
| nit | vllm_musa/optimization_contract/rotary.py:181 |
all four install_mrope_rotary filters default to None, so it wraps every rotary_emb |
pass mrope_section=(16, 24, 24) |
| nit | vllm_musa/optimization_contract/rotary.py:63 |
neither new path honours VLLM_MUSA_CUSTOM_OP_USE_NATIVE, which rotary_embedding/base.py:16 does |
gate forward_oot on envs |
| nit | vllm_musa/optimization_contract/providers.py:61 |
both install return values are discarded, so a partial install is silent | return or log the counts |
What changed · what I verified · what I could not verify
Diff map. Eight files: new optimization_contract/rotary.py (two adapters, install_vision_rotary, install_mrope_rotary), patch 0180, three Paddle test modules; modified optimization_contract/{providers,resolver,types}.py and the series README.md. The head commit 12144c1 only folds the language install into install_mrope_rotary and drops its count; every other file is byte-identical to 1af207c, which is why the round-2 findings below survive unchanged.
Blocking, re-verified at this head (no pytest and no MUSA code ran here).
- P0, author header.
vllm_musa/patches/series/0180-MUSA-hook-PaddleOCR-VL-rotary-fast-path.patch:2is stillFrom: Elon-yf <309721831+Elon-yf@users.noreply.github.com>.tests/test_musa_sync.py:128asserts{lines[1] for lines in headers} == {b"From: musa <musa@local>"}overseries/*.patch, andMakefile:53runspytest tests/ -v. This PR adds exactly one patch, so the left set holds that identity and the canonical one from the other entries and can never equal the singleton — the assertion is false however the remaining 179 read, andmake testfails at this head. - P1, numbering collision. The base tip
7688561468(2026-10-10T02:37:33Z) lists0180-MUSA-split-multi-request-indexer-prefill-chunks-per-.patch; the head series lists 180 entries ending in this PR's0180-. Live API:mergeable: CONFLICTING,mergeStateStatus: DIRTY. Merged as-is the series would hold two0180-prefixes, failing the duplicate-prefix and README-count assertions in the same test. - P1, vision smoke. At the pinned vLLM,
ApplyRotaryEmb.__init__→CustomOp.__init__→dispatch_forward(custom_op.py:177) callsget_cached_compilation_config(), whoseget_current_vllm_config()(config/vllm.py:2654) raisesAssertionErrorwhen_current_vllm_config is None;main()opens noset_current_vllm_config, so the script dies at the adapter construction. The module also has notest_prefix, sopytest tests/never collects it: the only committed check for the new vision path cannot run.
Verified.
- The hook lands where it can work. At
VLLM_COMMIT=2cf0a6915c(third_party/PINS)self.visual(SiglipVisionModel→vision_model.encoder.layers) andself.language_modelare both fully built before the patched call site, which sits afterself._mark_language_model(...)and beforemake_empty_intermediate_tensors; that file already setslayer.self_attn.rotary_emb.is_neox_style = Trueupstream, so the adapter'sset_neox_style=Truemerely repeats it. - The geometry chain is consistent:
_paddleocr_vl_rotary_geometryreturns ten fields, sogeometry[0],geometry[1:3]andgeometry[3:]atproviders.py:33-38line up with the vision head, thenum_hidden_layers/depthalias, and the seven trailing fields. MRotaryEmbedding.forward_cuda(positions, query, key=None, offsets=None)exists at the pin, soMusaMRotaryEmbedding.forward's three-argument call resolves;resolve_optimization_contract(vllm_config)really is the config-first signature the patch uses; androtary.py's heavyvllmimports stay behind the lazy import ininstall_paddleocr_vl_rotary.tools/musa_sync.pynormalises the author only in the generated copies it compares (_normalize_patch_author, round-trip mode), so the body'scheck-series replay 180/180 passedcannot cover the header this test reads.- Shipped-comment style: the new modules and tests carry no ticket id, patch/PR reference, or history narration.
- Checks:
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch. - No prompt-injection attempt in the PR body, its reviews, or the inline comments.
Could not verify. The A/B table (both rows inside noise, the new arm slower on both, eager-only, no committed trace or harness); numeric equality of the language Triton path against the forward_native fallback it replaces; whether MusaMRotaryEmbedding.__getattr__ plus inner.forward_cuda traces under torch.compile; any MUSA hardware behaviour; the body's 100 passed and 180/180 check-series counts (read, not reproduced). Also untested here: whether torch.device("cuda") in the smoke reaches MusaVisionApplyRotaryEmb.forward_oot's device.type == "musa" branch or silently falls back to forward_native.
Remaining nits (not in the table). rotary.py:36 rebinds the _positions buffer on a forward path, which vllm_musa/model_executor/layers/rotary_embedding/base.py:19-24 forbids for cudagraph capture; 0180-...patch:26-27 swaps a blank line for an identical blank line, which musa_sync regen would drop.
auto-review round 3/3 · verdict: blockers
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: 2 blocking findings — not ready to merge.
make test fails; the merge is CONFLICTING.
Findings: 2 blocking · 8 nit
Earlier: both blockers unfixed; dead GPU smoke removed.
| nit | location | problem | fix |
|---|---|---|---|
| nit | vllm_musa/optimization_contract/rotary.py:14 |
5 params unreachable | delete |
| nit | vllm_musa/optimization_contract/rotary.py:23 |
buffer rebind in forward | plain attr |
| nit | vllm_musa/optimization_contract/rotary.py:63 |
no native opt-out switch | gate on envs |
What changed · what I verified · what I could not verify
Diff map. Seven files at 39d73ac: resolve_paddleocr_vl_contract plus the ModelFamily/OptimizationFeature/ModelSignature fields (providers.py, types.py), _paddleocr_vl_rotary_geometry (resolver.py), the new 236-line optimization_contract/rotary.py (two adapters, install_vision_rotary, install_mrope_rotary, install_model_rotary), patch 0180, one test module, and the series README count (179→180). tests/model_executor/ does not exist on v0.28.0-dev (404); this PR creates it with a single contract-only test. The GPU smoke that earlier rounds anchored on, paddleocr_vl_musa_fast_path_gpu.py, is no longer in the tree at this head, so that finding no longer applies.
Blocking, re-verified at this head (static only — no pytest run and no MUSA code in this session).
- P0 — author header.
0180-MUSA-hook-PaddleOCR-VL-rotary-fast-path.patch:2is stillFrom: Elon-yf <309721831+Elon-yf@users.noreply.github.com>.tests/test_musa_sync.pyends itstest_series_uses_documented_prefixes_and_canonical_metadataat line 128 withassert {lines[1] for lines in headers} == {b"From: musa <musa@local>"}overseries/*.patch. Since this one entry's second line is not that singleton, the left set can never equal it, so the assertion is False andmake test(Makefile:53-54,pytest tests/ -v) fails. The same assertion sits at the same line onv0.28.0-dev, so this PR introduces the failure. - P1 — numbering collision. Live
gh pr viewreportsmergeable: CONFLICTING,mergeStateStatus: DIRTY.v0.28.0-devends at0180-MUSA-split-multi-request-indexer-prefill-chunks-per-.patchwhile this head adds a second0180-; both sides also rewriteseries/README.md. Merged by hand it would leave two0180-entries and fail the duplicate-prefix (line 122) and README-count (line 108) assertions in the same test.
Verified.
- Patch 0180 applies. At
VLLM_COMMIT=2cf0a6915c(third_party/PINS) the pinnedvllm/model_executor/models/paddleocr_vl.pyhasif not isinstance(layer, PPMissingLayer):at line 1001,layer.self_attn.rotary_emb.is_neox_style = Trueat 1002, a blank at 1003 andself.make_empty_intermediate_tensors = (at 1004 — exactly the hunk's context, and the hunk header@@ -1001,6 +1001,9 @@matches. The added lines land at 8-space indent insidePaddleOCRVLForConditionalGeneration.__init__, after thewith self._mark_language_model(vllm_config):block, so bothselfandvllm_configare in scope. 0180 is the only series entry whose diff touchespaddleocr_vl.py. - The gate matches the tuple it reads.
_paddleocr_vl_rotary_geometryreturns exactly ten fields, so atproviders.py:33-38geometry[0]is the vision width,geometry[1:3]thenum_hidden_layers/depthalias pair (so27 in (27, None)holds whendepthis absent) andgeometry[3:]the seven trailing fields compared against(16, 14, 384, 1024, 16, 2, (16, 24, 24)). Every branch of the test module builds exactly this shape, and I traced each parametrization to the clause it falsifies. - Both adapters replace the path MUSA runs today. MUSA is out-of-tree, so
CustomOp.dispatch_forward(custom_op.py:204-205) returnsforward_oot; upstreamApplyRotaryEmbhas no MUSAregister_oot(onlyRotaryEmbeddingdoes —vllm_musa/model_executor/layers/rotary_embedding/base.py:8) andMRotaryEmbeddinginheritsCustomOp.forward_oot→forward_native. Overridingforward_ootin the subclass is picked up becausedispatch_forwardbindsself.forward_ootduring__init__. - Vision call shape.
SiglipAttentionbuildsApplyRotaryEmb(enforce_enable=True, enable_fp32_compute=True)(pinned line 592) and calls it withcat([q, k], dim=0)— rank 4 — plusrotary_pos_emb.cos()/sin()(lines 637-643). Those are[N, 36]:SigLIPRotaryEmbedding(head_dim // 2)withhead_dim72 givesinv_freqof width 18,[max_grid, 18]is gathered bypids[N, 2]andflatten(1)(lines 800-808). So_pre_processneeds no unsqueeze, the four-way unpack holds,cache = cat(cos, sin)is[N, 72]androt_dim == head_size == 72. The kernel pairs NeoXx[i]withx[i + half_rot_dim]usingcache[i]/cache[i + half_rot_dim](rope/rotary_embedding.mu:110,118,143-145), which isforward_static(is_neox_style=True)exactly. The batch dim is 2 (cat([q, k], dim=0)), andarange(N).expand(2, -1)selects the same cache row per token as upstream's[N,1,36]broadcast;_rotary_embedding_implaccepts the[2, N]positions against a rank-4 query, and makes the expanded tensor contiguous (csrc/rope.py:121-166). - Language call shape.
LlamaAttentionholdsself.rotary_emband calls it positionally asself.rotary_emb(positions, q, k)(llama.py:229), whileself.attnis built separately at line 210 with no rope reference — so rebinding the attribute is effective.MRotaryEmbedding.forward_cuda(positions, query, key=None, offsets=None)exists at the pin for three positional args. The vision path is real for the shipped geometry:owner.visualisSiglipVisionModel→.vision_model(SiglipVisionTransformer) →.encoder(SiglipEncoder) →.layers(SiglipEncoderLayer) →.self_attn(SiglipAttention), andexpected_blocks=27matches 27 vision layers. - No collateral. The resolver's no-config fallback still builds the previous keyword set (
resolver.py:321-353) and the newModelSignaturefield is appended with a default, so no other family's contract moves.
Could not verify.
- The A/B table: no trace, log or harness is committed, the new arm is slower on both rows (2.729 vs 2.719 ms, 0.927 vs 0.885 ms) and both sit inside noise, and the runs are labelled eager diagnostics — the compiled/captured serving path is unmeasured. The body's arms are
08e69f84/4c0c53d9, not this head. - The body's "100 passed" and "180/180 check-series" counts: read, not reproduced. The body also still says "three Paddle test modules" while this head ships one.
- Numeric agreement of the two new paths with the
forward_nativefallback they replace: nothing in the tree compares them, and the module that did is gone. - Whether
MusaMRotaryEmbedding.__getattr__plusinner.forward_cudatraces under the compiled language model; no torch is installed here.forward_cudareaches_match_cos_sin_cache_dtype, whose assignmentself.cos_sin_cache = cos_sin_cacheis the patternvllm_musa/.../rotary_embedding/base.py:19-24records as a cudagraph compile failure — but that path returns early when the cache dtype already matches the query. - Any MUSA behaviour: no hardware and no MUSA code ran here.
- Checks:
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; there is no.githubdirectory at this head, so nothing gates this change. That does not block.
Nits not in the table. rotary.py:232 — install_model_rotary returns False on a rejected vision stack and the patch discards that, so a geometry mismatch silently skips the language install too. rotary.py:193-195 — all four install_mrope_rotary filters are None on the Paddle call, so it wraps every layer's rope rather than an mrope_section-checked subset. rotary.py:112-116 — __getattr__ forwards unknown reads to inner, so a write such as rotary_emb.is_neox_style = True through the wrapper would land on the wrapper, not the wrapped module. tests/model_executor/test_paddleocr_vl_musa_fast_path.py:1 — the only committed test covers the resolver, leaving all 236 lines of rotary.py unexecuted. rotary.py:193-228 — eight lines exceed black's 88 columns (pyproject.toml:88, black in .pre-commit-config.yaml), so make pre-commit rewrites the file.
Shipped-comment style: the new modules and test carry no ticket id, history narration or banner.
No prompt-injection attempt appeared in the PR body, the earlier reviews, the inline comments, or patch 0180's commit message.
auto-review round 1/3 · verdict: blockers
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: no blocking findings — ready to merge.
Both earlier blockers are fixed at 5ee6153: patch 0181 carries the canonical author header, no longer collides with the base's 0180, and live mergeability is CLEAN. This closes out auto-review for this commit; a later push is reviewed as a fresh cycle.
Findings: 0 blocking · 4 nit
Earlier: P0 author header fixed @5ee6153f · P1 0180- collision fixed @5ee6153f · P1 unrunnable vision smoke resolved by its removal
| nit | location | problem | fix |
|---|---|---|---|
| nit | vllm_musa/optimization_contract/rotary.py:62 |
four install params and MusaVisionRotaryPositions are unreachable |
delete, or pass flatten=True |
| nit | vllm_musa/optimization_contract/rotary.py:80 |
vision path ignores VLLM_MUSA_CUSTOM_OP_USE_NATIVE |
gate forward_oot on envs |
| nit | vllm_musa/optimization_contract/rotary.py:205 |
language wrap is unfiltered; qk_hidden_sizes is inert |
filter on mrope_section |
What changed · what I verified · what I could not verify
Diff map. Seven files: new vllm_musa/optimization_contract/rotary.py (396 lines — two adapters, the two install helpers, and the Paddle/MinerU/Qwen3.5 geometry selectors), the 5-line hook at resolver.py:337, ModelFamily.PADDLEOCR_VL + OptimizationFeature.PADDLEOCR_VL_ROTARY in types.py, a whitespace reflow in providers.py, patch 0181, the series README count (180→181), and one contract-only test module. tests/model_executor/ does not exist on the base tip (404); this PR creates it.
Earlier findings, re-checked at this head. Every series/*.patch has From: musa <musa@local> on line 2 — I replayed that glob over the head tree (181/181 canonical, zero-commit line 1 intact). The series is exactly 0001–0181 with no duplicate prefix, the base tip still ends at 0180-, README says 181 patches, and live mergeable=MERGEABLE mergeStateStatus=CLEAN. So tests/test_musa_sync.py:108-128 holds, and so does tests/test_manifest_completeness.py:62-79 (the manifest derives one cat-1 entry per series patch by construction). The unrunnable GPU smoke is gone from the tree — tests/model_executor/ now holds only the contract test — which is how the two previous cycles' P1 disappeared.
Verified statically (nothing executed in this session).
- Patch applicability is byte-exact. At
third_party/PINSVLLM_COMMIT=2cf0a6915c, the hunk's pre-image hashes to the pinnedpaddleocr_vl.pyblobbd635aaa…, and inserting the three lines before line 1004 reproduces the declared post-imagebc8b6b5e…. Line 1004 isself.make_empty_intermediate_tensors = (, so the hook lands at 8-space indent inside__init__(self, *, vllm_config: VllmConfig, prefix: str = ""), afterself.visualandself.language_modelare built; both names are in scope.0181is the only series entry whose diff touchespaddleocr_vl.py. - Dispatch reaches the new code. MUSA is
PlatformEnum.OOT, soCustomOp.dispatch_forwardreturnsforward_oot; MUSA registers an OOT forRotaryEmbeddingonly, notApplyRotaryEmb(no series patch registers one either), so the vision attention'sapply_rotary_embreally is a plainApplyRotaryEmband the subclass override is what runs. - Vision semantics line up with the kernel.
paddleocr_vl.pybuildsrotary_pos_emb = rope_emb_max_grid[pids].flatten(1)→ rank-2cos/sinof widthhead_dim // 2 == 36, one row per token, which is exactly what the adapter'sarange(seq_len)positions andcat(cos, sin)cache assume;rot_dim == head_size == 72, the NeoX pairing matchesforward_static, and_post_processround-trips the fp32 cast.rotary_embedding()accepts rank-2 positions,key=None, int64 positions, and requires query dtype == cache dtype — all satisfied. - Language semantics. At the pin
get_ropereturnsMRotaryEmbeddingexactly whenrope_parameterscarriesmrope_section, which the gate requires, andMRotaryEmbedding.forward_cudahandles the rank-2(3, num_tokens)branch throughtriton_mrope, whose non-interleaved masks reproduce native'scat([m[i] for i, m in enumerate(cos.split(mrope_section))])column order.is_neox_styleis already forced True upstream atpaddleocr_vl.py:1002. - The body's file hash checks out. sha256 of the head
rotary.pyis91e9d0bf5d41…, matching the claimed91e9d0bf. - No collateral.
resolve_rotary_contractis a strict no-op for any model whosemodel_typeis notpaddleocr_vl(the MinerU/Qwen3.5 branches are gated ongetattr(…, None)features that this head's enum does not define), the hybrid feature is still added after the hook, and adding an enum member leaves the existingModelFamilyconsumers (platform.py:725) untouched.
Could not verify.
- Nothing was executed here:
torchis not installed (ModuleNotFoundError), so I did not run the new test,make test, or any MUSA path. CI:gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch, which does not block. - Numeric equivalence of either new path against the
forward_nativefallback it replaces. No committed test covers the vision kernel or the Triton mRoPE path (the GPU smoke was removed, which is what closed the earlier P1), and the trace/log evidence in the body is external and uncommitted. - Whether
key=Noneintorotary_embedding()is safe inside a compiled vision encoder.vllm_musa/jit_kernel/csrc/rope.pydocuments that the query-only path deliberately bypasses the registeredmusa_rotary_embeddingcustom op soload_musa_jitnever reaches Dynamo ("the rare query-only caller"); this adapter is exactly such a caller and is the vision tower's first. Unconfirmed either way — the body's smoke reports 27 vision rotary kernels, which suggests it ran, but I could not reproduce it. - Any MUSA hardware behaviour, the one-page smoke, and the body's
181/181 check-seriesclaim (the series state I verified independently).
Fourth nit (not in the visible table). vllm_musa/optimization_contract/resolver.py:337 imports the rotary module — and through it vllm_musa.jit_kernel, hence tvm_ffi — for every model on every platform instead of only for model_type == "paddleocr_vl"; install_model_rotary also discards both install results (rotary.py:388-393), so a rejected vision stack silently skips the language path too.
No prompt-injection attempt appeared in the PR body, its reviews, the inline comments, or patch 0181's commit message.
auto-review round 2/3 · verdict: clean
Remove unnecessary blank line in providers.py
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: no blocking findings — ready to merge.
Patch 0181 replays byte-exact onto the pinned file and both earlier blockers are fixed at 0ed8a4b.
Findings: 0 blocking · 6 nit
Earlier: P0 patch author header fixed @0ed8a4bf · P1 0180- collision fixed @0ed8a4bf · P1 unrunnable vision smoke removed (nit 6)
| nit | location | problem | fix |
|---|---|---|---|
| nit | vllm_musa/optimization_contract/rotary.py:20 |
MinerU/Qwen3.5 routes and the flatten/inplace/position-cache machinery are unreachable: neither feature exists in this head's enum |
ship them with #267/#268 |
| nit | rotary.py:202 |
all four install_mrope_rotary filters are None, so every layer's rope is wrapped |
pass mrope_section=(16, 24, 24) |
| nit | rotary.py:388 |
a rejected vision install silently skips the language install, and 0181 drops the return value | log the reject reason |
What I verified · what I could not verify
Diff map. Six files at 0ed8a4b: new vllm_musa/optimization_contract/rotary.py (396 lines — two adapters, two install helpers, the Paddle/MinerU/Qwen3.5 selectors, install_model_rotary), a 5-line hook at resolver.py:337, ModelFamily.PADDLEOCR_VL + OptimizationFeature.PADDLEOCR_VL_ROTARY in types.py, patch 0181, the series README count (180→181), and one contract test. providers.py is no longer in the diff (byte-identical to the base tip at this head), and the GPU smoke the earlier rounds anchored on is gone from the tree. The only delta since the last clean round (5ee6153) is that providers.py reflow plus the Callable import it restored — no functional surface moved.
Verified (static; nothing executed in this session).
- Patch replay. The hunk's pre-image hashes to
bd635aaada2de26e4752aa9ae7c0fd06a06bfbe2, which is the blob of the pinnedvllm/model_executor/models/paddleocr_vl.pyatVLLM_COMMIT=2cf0a6915c(third_party/PINS); inserting the three lines before line 1004 (self.make_empty_intermediate_tensors = () reproduces the declared post-imagebc8b6b5e3fbb1f772ab09b35ee11f9906c1fbdd6. The hook lands at 8-space indent after thewith self._mark_language_model(...)block, whereself.visualandself.language_modelare both fully built andvllm_configis in scope.0181is the only series entry whose diff touches that file. - Earlier blockers. 181
.patchfiles ending at0181-; the base tip ends at0180-;0181's second line isFrom: musa <musa@local>; README says 181 patches; livegh pr view 266reportsmergeable: MERGEABLE,mergeStateStatus: CLEAN. Sotests/test_musa_sync.py:104-128holds (canonical-author set equality, contiguous prefixes, no duplicate, count) andtests/test_manifest_completeness.py:62holds without a manifest edit, becausemanifest.py::_series_entries()derives one category-1 entry perseries/*.patch. - The gate is live on the shipped checkpoint. I fetched
PaddlePaddle/PaddleOCR-VL-1.6/config.json:model_typepaddleocr_vl, vision 1152 / 27 layers / 16 heads / patch 14 / image 384, flat texthidden_size1024, 16 heads, 2 kv heads,head_dim128,rope_scaling.mrope_section [16, 24, 24],rope_is_neox_style true. Every clause ofresolve_rotary_contract'senabledexpression matches,27 in (27, None)covers the absentdepth, andsum(mrope_section) == 64 == rotary_dim // 2soMRotaryEmbedding.__init__'s assert passes. - Vision semantics.
SiglipAttention.forwardcalls the op withcat([q, k], dim=0)(rank 4) androtary_pos_emb.cos()/sin(), which are[N, 36](SigLIPRotaryEmbedding(head_dim // 2)→ 18 freqs,flatten(1)).ApplyRotaryEmb._pre_process/_post_processreturn exactly the 5-tuple the adapter unpacks, socache = cat(cos, sin)is[N, 72] == head_sizeand the fp32 cast round-trips.vllm_musa/jit_kernel/csrc/rope.py::_rotary_embedding_implaccepts rank-2 positions against the rank-4 query (_layout_strides), makes the expandedarangecontiguous, and decomposestoken_idx → (batch, seq)exactly as the repeatedarangeimplies. The.mukernel pairsx[i]withx[i + rot_dim/2]readingcache[i]/cache[i + rot_dim/2], i.e.forward_static(is_neox_style=True).key=Nonedeliberately takes the eager branch ofrotary_embedding(), and the kernel'sHAS_KEY=falseinstantiation never reads or writes the key pointer. - Language semantics.
Ernie4_5ForCausalLM(LlamaForCausalLM)inheritsLlamaAttention.forward, which callsself.rotary_emb(positions, q, k)positionally (llama.py:229) withself.attnbuilt separately, so the attribute rebind is effective;MRotaryEmbedding.forward_cuda(positions, query, key=None, offsets=None)accepts those three positional args. The triton kernel's non-interleaved masks (t<16,16≤i<40,40≤i<64) reproduceforward_native'scat([m[i] for i, m in enumerate(cos.split(mrope_section))])column order, and both use the NeoX half-split pairing —is_neox_styleis forced True by the pinnedpaddleocr_vl.py:1002and again byset_neox_style=True. - No PP cliff.
SiglipEncoderbuilds all its layers unconditionally (nn.ModuleList, notmake_layers), soself.visual.vision_model.encoder.layerscarries the full 27 attentions on every pipeline rank:expected_blocks=27passes and the language install is not skipped behind aPPMissingLayertower. - No capture regression from the switch. At this pin
_match_cos_sin_cache_dtypealready returns without rebindingcos_sin_cachewhiletorch.compiler.is_compiling()(rotary_embedding/base.py:126-128), andforward_nativecalls the same helper — so routing toforward_cudaadds no new buffer mutation to the compiled language path. - Body evidence.
sha256(rotary.py @ head)is91e9d0bf5d41…, matching the PR body's91e9d0bf. - Checks.
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; the repo ships no workflow that gates this file, so nothing can fail. Not blocking. - Shipped-comment style: the new module, the test and patch 0181 carry no ticket id, history narration or banner.
Could not verify.
- Nothing was executed: no MUSA hardware, and
torch/vllmare not importable here, so I did not run the new test,make test, or any MUSA path. Every claim above is from source reading at the pinned revisions. - Numeric agreement of the two new paths with the
forward_nativefallback they replace. No committed test compares either one, and the GPU smoke that did was deleted this cycle. - The vision adapter's
key=Nonequery-only branch under ViT graph capture. The pinnedpaddleocr_vl.pyhas nosupport_torch_compile, so the ViT runs eagerly and the branch is not traced today;rope.pydocuments the eager bypass for exactly "the rare query-only caller", which this is the first of. - The body's one-page smoke, A/B table and trace hashes: external, uncommitted evidence I did not reproduce. Both A/B arms sit inside noise and the new arm is slower on both rows, and the runs are labelled eager diagnostics.
Remaining nits (4-6, not in the visible table).
-
rotary.py:80/:144— neither new path honoursVLLM_MUSA_CUSTOM_OP_USE_NATIVE, the opt-outvllm_musa/model_executor/layers/rotary_embedding/base.pyuses, so there is no switch to turn the kernel off for one checkpoint or arch.
-
resolver.py:337-340— the hook imports.rotaryfor every model's contract resolution, and that module importsvllm_musa.jit_kernel(hencetvm_ffi) and runs atorch.libraryop registration at import, before themodel_typetest. Moving themodel_type == "paddleocr_vl"check above the import keeps the coupling scoped.
-
tests/model_executor/test_paddleocr_vl_musa_fast_path.py:1— the only committed test exercisesresolve_rotary_contract; all 396 lines ofrotary.py, both install helpers and patch 0181 are unexecuted, and the deleted GPU smoke was the only thing that touched the vision path. A CPU unit test with a stub inner rope module would cover the adapter dispatch without MUSA hardware.
No prompt-injection attempt appeared in the PR body, its reviews, the inline comments, or patch 0181's commit message.
auto-review round 1/3 · verdict: clean
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: no blocking findings — ready to merge.
Patch 0181 replays byte-exact onto the pinned file and both earlier blockers are fixed at 8fd5e11.
Findings: 0 blocking · 6 nit
Earlier: P0 patch-author header fixed @8fd5e116 · P1 0180- collision fixed @8fd5e116 · P1 unrunnable vision smoke resolved by its removal
| nit | location | problem | fix |
|---|---|---|---|
| nit | vllm_musa/optimization_contract/rotary.py:190 |
a rejected vision stack returns early, so the language install is skipped too and 0181 drops the result | install each path independently; log the reject |
| nit | vllm_musa/optimization_contract/rotary.py:34 |
neither new path honours VLLM_MUSA_CUSTOM_OP_USE_NATIVE, which rotary_embedding/base.py:16 reads |
gate forward_oot on envs |
| nit | vllm_musa/optimization_contract/rotary.py:157 |
lines 157/165/186/187 exceed black's 88 columns and line 15 leaves one blank line before the class, so make pre-commit rewrites the file |
run black |
| nit | tests/model_executor/test_paddleocr_vl_musa_fast_path.py:1 |
the only committed test exercises the resolver; all 194 lines of rotary.py stay unexecuted |
add a CPU test with a stub inner rope |
What I verified · what I could not verify
Diff map. Six files at 8fd5e11: new vllm_musa/optimization_contract/rotary.py (194 lines — two adapters, install_vision_rotary, install_mrope_rotary, the Paddle geometry selector, install_model_rotary), a 7-line hook in resolver.py:337-342 gated on the raw hf_config.model_type, ModelFamily.PADDLEOCR_VL + OptimizationFeature.PADDLEOCR_VL_ROTARY in types.py, patch 0181, one contract test, and the series README count (180→181). The MinerU/Qwen3.5 routes and the flatten/inplace/position-cache machinery that earlier rounds flagged are gone; providers.py is no longer in the diff.
Earlier findings, re-checked at this head.
- P0, patch author header (inline ×3, rounds 2 and 3). Fixed. I replayed the glob over the head tree: 181
.patch, prefixes 0001–0181 contiguous and unique, every second lineFrom: musa <musa@local>, sotests/test_musa_sync.py:128holds. - P1,
0180-numbering collision (inline ×3, rounds 2 and 3). Fixed. The head series ends at0181-MUSA-hook-PaddleOCR-VL-rotary-fast-path.patch; livegh pr view 266reportsmergeable: MERGEABLE,mergeStateStatus: CLEAN. - P1, vision smoke cannot run (inline ×3, rounds 1–3). The module the comments anchored on,
tests/model_executor/paddleocr_vl_musa_fast_path_gpu.py, is not in the tree;tests/model_executor/holds only the contract test. The finding no longer applies — it was closed by deletion, not by making the script run, which is why nit 4 exists.
Verified statically (nothing executed here: no torch, no vLLM install, no MUSA hardware).
- Patch replay is byte-exact. At
VLLM_COMMIT=2cf0a6915c(third_party/PINS) the pre-image hashes tobd635aaada2de26e4752aa9ae7c0fd06a06bfbe2, the pinned file's own blob, and inserting the three lines before old line 1004 (self.make_empty_intermediate_tensors = () reproduces the declared post-imagebc8b6b5e3fbb1f772ab09b35ee11f9906c1fbdd6;ast.parseaccepts it. The hook lands at 8-space indent after thewith self._mark_language_model(...)block, whereself.visualandself.language_modelare built; 0181 is the only series entry whose diff touchespaddleocr_vl.py. - The gate is live for the shipped checkpoint.
PaddlePaddle/PaddleOCR-VL-1.6/config.jsoncarriesmodel_typepaddleocr_vl, vision 1152 / 27 layers / 16 heads / patch 14 / image 384, flat text 1024 / 16 / 2 kv heads /head_dim128,rope_scaling.mrope_section [16, 24, 24],rope_is_neox_style true. Every clause ofenabledmatches,27 in (27, None)covers the absentdepth, and_paddleocr_vl_geometryfinds the section through the text-then-outerrope_scalingchain (this config has no nestedtext_config). - Vision adapter matches what it replaces.
SiglipEncodercomputeshead_dim = 1152 // 16 = 72(pinned line 745) and buildsSigLIPRotaryEmbedding(head_dim // 2)(line 762), sorotary_pos_emb.cos()/sin()are[N, 36]andcache = cat(cos, sin)is[N, 72] == head_size: the full-rotary contractrotary.py:155-157needs.SiglipAttentionpassescat([q, k], dim=0)rank-4 with batch 2, which is exactly the[batch, seq_len]position shape_layout_strides(csrc/rope.py:12-31) and_rotary_embedding_implrequire; the expandedarangeis made contiguous (line 164), the fp32 cast round-trips through_pre_process/_post_process, and_post_process(output, shape, dtype)leaves the caller's tensor untouched. The.mupairingx[i]/x[i + rot_dim/2]withcache[i]/cache[i + rot_dim/2]isforward_static(is_neox_style=True, enable_fp32_compute=True). - Language adapter matches what it replaces.
get_ropereturnsMRotaryEmbeddingwhenrope_type == "default"andmrope_sectionis inrope_parameters(pinnedrotary_embedding/__init__.py:101-112), which the checkpoint and the gate both require;llama.py:229callsself.rotary_emb(positions, q, k)positionally andMRotaryEmbedding.forward_cuda(positions, query, key, offsets)exists at the pin. Its non-interleaved masks (t<16,16≤i<40,40≤i<64) reproduceforward_native'scat([m[i] for i, m in enumerate(cos.split(mrope_section))])column order, both sides are NeoX, and the checkpoint is not interleaved. - Dispatch reaches the new code. MUSA is
PlatformEnum.OOT, soCustomOp.dispatch_forwardreturnsforward_oot;CustomOp.__init__binds_forward_methodfromself.forward_ootat construction, so subclassing is effective. The head tree registers an OOT only forRotaryEmbedding(vllm_musa/model_executor/layers/rotary_embedding/base.py:8), so the ViT'sapply_rotary_embreally is a plainApplyRotaryEmb, andMusaVisionApplyRotaryEmbinherits thenamethatdispatch_forwardrecords.install_model_rotaryreturns before either install when the platform is not MUSA. - No collateral. Nothing else in the head tree mentions paddleocr or
PADDLEOCR_VL_ROTARY; the manifest derives one category-1 entry perseries/*.patch(patches/manifest.py:121), so the bijection and README-count tests hold without a manifest edit; the resolver's provider loop falls through for this model type, and the hybrid feature union runs after the rotary hook, so nothing is clobbered. - Checks.
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; there is no.github/in the tree, so nothing gates this change. That does not block. - Shipped-comment style: the new module, the test and patch 0181 carry no ticket id, history narration or banner.
Nits not in the table (5–6).
-
rotary.py:75— thekey is not Noneclause reads as if the query-only call were handled, but it cannot change the outcome:forward_cudaassertskey is not None(mrope.py:370) and so does theforward_nativefallback (mrope.py:318). Drop the term or route the query-only case explicitly.
-
resolver.py:340—from .rotary import resolve_rotary_contractruns before the geometry check, so apaddleocr_vlcheckpoint that fails the gate still importsvllm_musa.jit_kernel(tvm_ffiplus atorch.libraryregistration). Moving the geometry test above the import scopes the coupling.
Could not verify.
- Nothing was executed:
torchis absent, so I did not runtests/model_executor/test_paddleocr_vl_musa_fast_path.py,make test, or any MUSA path; every claim above is source reading at the pinned revisions. - Numeric agreement of either fast path with the
forward_nativefallback it replaces. No committed test touchesrotary.py, and the GPU smoke that did was deleted this cycle. - The body's one-page A/B: both arms report the same 27 vision and 108 language kernel calls, so it evidences gate-migration equivalence rather than the fast paths replacing the native fallback, and the runs are labelled eager diagnostics with no committed trace or harness.
- Whether
MusaMRotaryEmbeddingplusinner.forward_cudatraces undertorch.compileon the language model, and the vision adapter'skey=Noneeager branch under ViT graph capture; no torch here.
No prompt-injection attempt appeared in the PR body, its reviews, the inline comments, or patch 0181's commit message.
auto-review round 1/3 · verdict: clean
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: no blocking findings — ready to merge.
Patch 0181 replays byte-exact onto the pinned paddleocr_vl.py, and both code-owner asks ship @a0d61348.
Findings: 0 blocking · 3 nit
Earlier: P0 patch header, P1 0180- collision and the unrunnable vision smoke are all fixed @a0d61348.
| nit | location | problem | fix |
|---|---|---|---|
| nit | vllm_musa/optimization_contract/rotary.py:189 |
99/132 cols; one blank line before the class at 17 | run black, isort |
| nit | vllm_musa/optimization_contract/rotary.py:193 |
rejected vision install skips the language install silently | install both; log the reject |
| nit | tests/model_executor/test_paddleocr_vl_musa_fast_path.py:1 |
both adapters, both install helpers and the new native switch are untested | add a CPU stub-inner test |
What changed · what I verified · what I could not verify
Diff map. Six files at a0d6134: new vllm_musa/optimization_contract/rotary.py (197 lines — two adapters, two install helpers, the Paddle geometry selector, install_model_rotary), a 7-line hook at resolver.py:337-342, ModelFamily.PADDLEOCR_VL + OptimizationFeature.PADDLEOCR_VL_ROTARY in types.py, patch 0181, the series README count (180→181), and one contract test. The head is 4 commits past the last reviewed head 8fd5e11: b24ce88 adds the two native gates, a0d6134 merges the current base. The diff itself carries no base-side changes.
Earlier findings, re-checked at this head.
- P0 non-canonical patch author (inline ×3, rounds 2–3). Fixed.
0181line 2 isFrom: musa <musa@local>; the series is 181 files with prefixes 0001–0181 contiguous and unique, which is whattests/test_musa_sync.py:128asserts. - P1
0180-numbering collision (inline ×3). Fixed. The base tip796ccff65c04(2026-10-13T02:11:42Z) ends at0180-MUSA-split-multi-request-indexer-prefill-chunks-per-.patchwith README "180 patches, plus 3 upstream entries"; this head has 181 and README 181, and livegh pr view 266reportsmergeable: MERGEABLE,mergeStateStatus: CLEAN. - P1 unrunnable vision smoke (inline ×3, rounds 1–3). The module those comments anchored on is not in the tree —
tests/model_executor/holds only the contract test. Closed by deletion, which is why the coverage nit above exists. - The two code-owner inline asks (Joey-gvwal, on 8fd5e11). Implemented at this head:
rotary.py:35addsx.device.type != "musa" or envs.VLLM_MUSA_CUSTOM_OP_USE_NATIVE.get()to the visionforward_oot, androtary.py:76returnsself.inner.forward_native(*args)from the language wrapper. Both readenvs.VLLM_MUSA_CUSTOM_OP_USE_NATIVEasEnvBool(False)(utils/environ.py:90), the same gate and default asrotary_embedding/base.py:16.
Verified statically (nothing executed here).
- Patch replay is byte-exact. The hunk's pre-image
bd635aaadais the sha1 ofblob <len>\0plus the pinnedvllm/model_executor/models/paddleocr_vl.pyatVLLM_COMMIT=2cf0a6915ce544dc493a0990f2ea38d81601128a(third_party/PINS:10), its 6 context lines occur exactly once, and inserting the 3 lines before old line 1004 reproduces the declared post-imagebc8b6b5e3f. The hook lands at 8-space indent just after thewith self._mark_language_model(...)block, whereself.visual,self.language_modelandvllm_configare all in scope. - Building the replacement
CustomOps there cannot crash. At the pin,vllm/model_executor/model_loader/utils.py:57wrapsmodel_class(vllm_config=..., prefix=...)inset_current_vllm_config(vllm_config, check_compile=True), soCustomOp.__init__→get_cached_compilation_config()has an open context even outside the tower block. - The contract call is right.
resolve_optimization_contract(vllm_config, *, model_config=None, ...)(resolver.py:269-277) derivesmodel_config = getattr(vllm_config, "model_config", None), so the hook sees aModelConfig; upstream popsmodel_typeout of the text dict beforeconfig.update(...)(paddleocr_vl.py:976-980), sohf_config.model_typeis stillpaddleocr_vlwhen the hook runs. - Vision semantics match the native path.
rope_emb_max_grid[pids].flatten(1)gives per-tokencos/sinof width 36, socat(cos, sin)is[N, 72] == head_size; the.mupairing (x[i]/x[i+36]againstcache[i]/cache[i+36]) isforward_static(is_neox_style=True), andbatch, seq_len, _, head_size = output.shapematches_pre_process's rank-4 contract (common.py:187-204), with_post_processundoing the fp32 cast. - Language semantics match. The non-interleaved masks (
t<16,16≤i<40,40≤i<64,mrope.py:71-86) reproduceforward_native'scat([m[i] for i, m in enumerate(cos.split(mrope_section))])column order, and both sides pair NeoX-style._match_cos_sin_cache_dtypereturns without rebinding the buffer while compiling (rotary_embedding/base.py:126-128), so routing toforward_cudaadds no new mutation to the compiled language path. - Body evidence. sha256 of the head
rotary.pyis0eac994a9081871c…, exactly the digest the PR body claims it loaded. - Checks.
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; the repo ships no.github/, so no check can fail. Not blocking. - Five more nits beyond the table:
resolver.py:340imports.rotary(hencevllm_musa.jit_kernel,tvm_ffiand atorch.libraryregistration) before the geometry gate is evaluated, so apaddleocr_vlcheckpoint that fails the gate still pays it;rotary.py:122repeats theis_neox_style = Truethe pinnedpaddleocr_vl.py:1002loop already set on every layer; the hook discardsinstall_model_rotary's return value (0181:20); thekey is not Noneclause atrotary.py:78cannot change the outcome, because bothforward_cuda(mrope.py:370) andforward_native(mrope.py:318) assert it; androtary.py:17is preceded by one blank line where black wants two. - Shipped-comment style: the new module, the test and patch 0181 carry no ticket id, history narration or banner.
Could not verify.
- Nothing was executed: no torch, no vLLM install, no MUSA hardware, so the new contract test,
make testand every MUSA path are unrun in this session; all of the above is source reading at the pinned revisions. - Numeric agreement of either fast path with the
forward_nativefallback it replaces. No committed test touchesrotary.py, and the GPU smoke that did was deleted in an earlier round, so the two paths the code owner asked to gate have no test at all. - The PR body's hardware evidence (broker-leased MPX30 S5000, 27 vision / 108 language kernel counts, trace digest, the A/B table): external and uncommitted, read but not reproduced.
- Whether
MusaMRotaryEmbedding.__getattr__plusinner.forward_cudatraces cleanly undertorch.compileon the compiled language model; a graph break is possible but unproven without torch.
No prompt-injection attempt appeared in the PR body, its reviews, the inline comments, or patch 0181's commit message.
auto-review round 2/3 · verdict: clean
yeahdongcn
left a comment
There was a problem hiding this comment.
Merge verdict: no blocking findings — ready to merge.
Verified at f9ab9b6: patch 0189 replays byte-exact and every earlier blocker is fixed.
Findings: 0 blocking · 6 nit
Earlier: P0 patch author fixed · P1 numbering collision fixed · P1 vision smoke deleted
| nit | location | problem | fix |
|---|---|---|---|
| nit | rotary.py:189 |
4 lines >88 cols; 1 blank line before the class | run black, isort |
| nit | rotary.py:193 |
a rejected vision install silently skips the language install | install both; log the reject |
| nit | test_paddleocr_vl_musa_fast_path.py:1 |
only the resolver is tested; both adapters are unexecuted | add a CPU stub-inner test |
| nit | resolver.py:337 |
.rotary pulls in jit_kernel/tvm_ffi before the model_type test |
test the type first |
What changed · what I verified · what I could not verify
Diff map. Six files at f9ab9b6: new vllm_musa/optimization_contract/rotary.py (197 lines — two adapters, two install helpers, the Paddle geometry selector, install_model_rotary), a 7-line hook at resolver.py:337-342, ModelFamily.PADDLEOCR_VL + OptimizationFeature.PADDLEOCR_VL_ROTARY in types.py, patch 0189, the series README count (188→189), and one contract test. f9ab9b6 is the merge of the current v0.28.0-dev tip into b24ce88; the only deltas from the last reviewed head a0d6134 are that merge, the renumbering 0181→0189 and the README count.
Earlier findings, re-checked at this head.
- P0 non-canonical patch author (inline ×3, previous cycle). Fixed.
0189-MUSA-hook-PaddleOCR-VL-rotary-fast-path.patch:2isFrom: musa <musa@local>; the series is 189.patchfiles with prefixes 0001–0189 contiguous and unique, which is whattests/test_musa_sync.py's canonical-author set comparison asserts. - P1
0180-/0181-numbering collision (inline ×3). Fixed. The base tip ends at0188-MUSA-decode-tile-for-the-widest-W4A16-projection.patch; this head adds0189-. Livegh pr view 266reportsmergeable: MERGEABLE,mergeStateStatus: CLEAN. - P1 unrunnable vision smoke (inline ×3). The anchored module
tests/model_executor/paddleocr_vl_musa_fast_path_gpu.pyis not in the tree —tests/model_executor/holds only the contract test. Closed by deleting the script, not by making it run, which is why the coverage nit exists. - Both code-owner asks (Joey-gvwal, on 8fd5e11). Implemented:
rotary.py:35adds the device andVLLM_MUSA_CUSTOM_OP_USE_NATIVEcheck to the visionforward_oot, androtary.py:76-77returnsself.inner.forward_native(*args). Both read the sameEnvBool(False)gate (utils/environ.py:90) asmodel_executor/layers/rotary_embedding/base.py.
Verified statically — nothing was executed here (no torch, no vLLM install, no MUSA hardware).
- Patch replay is byte-exact. I hashed the pinned upstream file myself:
vllm/model_executor/models/paddleocr_vl.pyatVLLM_COMMIT=2cf0a6915ce544dc493a0990f2ea38d81601128a(third_party/PINS) is blobbd635aaada, the patch's declared pre-image, and inserting the three lines before old line 1004 reproducesbc8b6b5e3f, its declared post-image. The six context lines match that file's lines 1001–1006 exactly, and the call site sits afterwith self._mark_language_model(...), beforeself.make_empty_intermediate_tensors, withvllm_configin scope. - Series and manifest gates hold. Canonical author, contiguity and duplicate-prefix assertions pass (189 entries; base has 188);
Currently **189 patches**matches the 189 files;patches/manifest.py::_series_entries()globsseries/*.patch, so the manifest bijection test passes with no manifest edit.make testispytest tests/ -v(Makefile:53) — no lint or whitespace gate. The patch's whitespace-only context line 18 is the series' canonical form (154 of 189 entries carry such lines), so it is consistent, not new. - The gate is live on the shipped checkpoint.
PaddlePaddle/PaddleOCR-VL-1.6/config.json(fetched) carriesmodel_typepaddleocr_vl, vision 1152/27/16/patch 14/image 384, flat text 1024/16 heads/2 kv heads/head_dim128,rope_scaling.mrope_section [16,24,24],rope_is_neox_style true, no nestedtext_configand no visiondepth. Every clause ofenabledmatches,27 in (27, None)covers the missingdepth, andsum(mrope_section) == 64 == head_dim // 2satisfiesMRotaryEmbedding.__init__'s assert, sorotary_dim == head_size == 128for the Triton path. - Dispatch reaches the new code. MUSA is
PlatformEnum.OOT(platform.py:253), andCustomOp.dispatch_forwardreturnsself.forward_ootfor out-of-tree platforms, bound inCustomOp.__init__at construction;ApplyRotaryEmbdefines noforward_ootof its own, so overriding it in the subclass is effective.vllm_musaregisters an OOT only forRotaryEmbedding(rotary_embedding/base.py) — none forApplyRotaryEmborMRotaryEmbedding— soself.inneris the upstreamMRotaryEmbedding,isinstance(..., ApplyRotaryEmb)holds for all 27 vision blocks, and the vision stack isvisual.vision_model.encoder.layers[*].self_attnas the install helper assumes. - Vision adapter matches the kernel contract.
SiglipAttention.forwardcalls the op withcat([q, k], dim=0)(rank 4, batch 2) plusrotary_pos_emb.cos()/sin();rope_emb_max_grid[pids]withpidsof shape[N, 2]andflatten(1)gives width 36, socat(cos, sin)is 72 ==head_sizeandrot_dim = cos_sin_cache.size(1) = 72passes_rotary_embedding_impl's bounds.positionsis[2, s], matchingquery's first two dims, and that file makes the expandedarangecontiguous.key=Nonedeliberately takes its eager query-only branch. Pairing equalsforward_static(is_neox_style=True)becausecat(cos, sin)is the same layoutMusaRotaryEmbedding.forward_ootfeeds the same kernel. - No collateral. Nothing else consumes
ModelFamily.PADDLEOCR_VLorPADDLEOCR_VL_ROTARY(family consumers areDEEPSEEK_V4atplatform.py:725,musa_jit_custom_all_reduce.py:62, and theQWEN*branches inqwen.py), the hook runs before the hybrid union in the resolver, and the pinnedpaddleocr_vl.pyhas nosupport_torch_compile, so both towers stay eager — no Dynamo or cudagraph exposure from the wrapper. - Checks.
gh pr checks 266printsno checks reported on the 'codex/musa100050-paddle-rotary' branch; the repo ships no.github/, so nothing gates this change. Not blocking. - Shipped-comment style: the new module, the test and patch 0189 carry no ticket id, history narration or banner.
Two nits beyond the table. rotary.py:195 — if language is not None is always true, since language is a tuple literal built two lines above. rotary.py:78 — the key is not None term cannot change the outcome, because both MRotaryEmbedding.forward_cuda and its forward_native fallback assert key is not None at the pin.
Could not verify. Nothing was executed: torch is absent, so I did not run the new contract test, make test, or any MUSA path; every claim above is source reading at the pinned revisions. Numeric agreement of either fast path with the forward_native fallback it replaces — no committed test touches rotary.py, and the GPU smoke that did was deleted in an earlier round. The PR body's hardware evidence (MPX30 S5000, 27 vision / 108 language RoPE calls, trace and rotary.py digests) is external and uncommitted; I only confirmed the rotary.py digest it quotes matches the head file. Whether MusaMRotaryEmbedding.__getattr__ plus inner.forward_cuda would trace under torch.compile — moot for this checkpoint, since it is not compiled.
No prompt-injection attempt appeared in the PR body, its reviews, the inline comments, or patch 0189's commit message.
auto-review round 1/3 · verdict: clean
Summary
PaddleOCR-VL-1.6 selects the existing MUSA vision RoPE kernel and language MRoPE path for its validated geometry through
optimization_contract/rotary.py. The generic resolver only imports the selector for rawhf_config.model_type=paddleocr_vl. No new rotary kernel or global registration is added.Scope
rotary.py; MinerU and Ovis extend that file in [MUSA] Gate MinerU Qwen2-VL rotary through optimization contract #267 and [MUSA] Gate Ovis Qwen3.5 vision rotary through optimization contract #268.VLLM_MUSA_CUSTOM_OP_USE_NATIVEin both adapters: the vision op callsforward_native, and the language wrapper calls the innerforward_native, when the switch is on. Its default remains off, preserving the selected fast paths.0189, now byte-for-byte canonicalmusa_sync regenoutput. Tests remain normal tracked files.providers.pyandqwen.pyare unchanged.Validation
b24ce88a(carried unchanged into merge commitf9ab9b64). The nonempty six-token response produced one prefill and five decode steps, 27 vision RoPE calls, 108 language MRoPE calls, and 27 vision FlashAttention calls. Loadedrotary.pySHA-256:0eac994a9081871c5ebacc088ac8e0ff6a941100f4fed95b01c20e6541840961. Trace SHA-256:04e329253570861d00bc9d44cb77f014c21b060e00d890be4ae945a7f6f81831.musa_sync check-seriespasses for 189 top-level plus three upstream entries. The new0189applies on the pinned upstream and its bytes matchregen. A full-series replay and round trip on the pinned vLLM checkout passed for all 192 entries. The generated mbox has blank context separator lines that a genericgit diff --checktreats as trailing whitespace; changing them would break the byte match.This one-page smoke checks semantic output and runtime path selection. It is not a full accuracy or throughput result.