Skip to content

[Bugfix][MRV1] Stage consistent FULL dummy metadata - #54604

Open
kyleliang-nv wants to merge 2 commits into
vllm-project:mainfrom
kyleliang-nv:agent/minimax-m3-full-dummy-metadata
Open

kyleliang-nv wants to merge 2 commits into
vllm-project:mainfrom
kyleliang-nv:agent/minimax-m3-full-dummy-metadata

Conversation

@kyleliang-nv

@kyleliang-nv kyleliang-nv commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

The V1 model runner's FULL CUDA-graph profiling can stage a long dummy sequence length without staging matching absolute token positions. MiniMax-M3's MSA indexer derives causal page counts from those positions, while sparse decode derives the number of entries to consume from sequence lengths. Specifically, MiniMaxM3IndexerMSAMetadataBuilder.build() computes num_valid_pages = positions // 128 + 1 and supplies it to sparse_topk_select, which pads out-of-range selections with -1. Sparse decode instead consumes min(topk, ceil(kv_len / 128)) entries based on seq_lens. Stale short positions paired with long dummy sequence lengths therefore leave sentinels inside that consumed range.

Stage the same length/position invariants used by real batches:

  • seq_len == num_computed_tokens + num_scheduled_tokens
  • positions == num_computed_tokens[req_indices] + query_pos

Also clear scheduled/computed lengths for padded request rows and positions for padded tokens. The DCP helper consumes these staged positions rather than overwriting them with a second formula.

A profiling override can be shorter than the scheduled query. Normalize the CPU sequence length to at least the query length before copying it to the GPU, so both mirrors agree and computed lengths/positions cannot become negative. This changes dummy preparation only, not real-request scheduling.

For a mixed DCP batch, computed lengths remain the dummy context length. For uniform speculative decode with a ragged final request, its positions move to the causal tail, ending at seq_len - 1.

Staging is restricted to paths that build attention metadata (force_attention or FULL). Ordinary dummy runs without attention metadata do not launch the MiniMax-M3 indexer/attend kernels. The kernel safety boundary remains a separate change in #54597.

Current-main review

Rebased onto public main 8bf051cd51adff79e1bc94e910adaea543aaa2e1 on September 21, 2026. This fixes the still-supported V1 model runner, not Model Runner V2.

Merged #55212 initializes MRv2 DCP-local metadata and merged #56170 changes a ROCm cumulative-length scalar upload; neither stages these V1 positions. #53671 separately bounds dummy lengths by max_model_len. #51585 preserves CPU query offsets for a different capture failure. These changes do not replace this invariant correction.

Test Plan

Five focused CPU cases exercise the real staging helper and DCP preparation without model weights:

  • Profiling lengths 1, 4 and 4096 with four scheduled query tokens. Length 4096 must produce computed length 4092 and positions [4092, 4093, 4094, 4095]; a short override must produce nonnegative positions.
  • CPU/GPU-mirror agreement, request-length invariants and zeroed padded rows/tokens.
  • A mixed DCP batch with query lengths [1, 6] and a ragged uniform-decode batch with query lengths [4, 3]; verify computed lengths, position bounds and the exact active query-start slice used for slot mapping.

The CPU-only tests use the existing skip_global_cleanup marker because they create no accelerator or distributed state. Block-table side effects are mocked; the tensor computations and DCP helper execute normally.

pre-commit run --files vllm/v1/worker/gpu_model_runner.py vllm/v1/worker/cp_utils.py tests/v1/worker/test_gpu_model_runner.py
VLLM_TARGET_DEVICE=cpu .venv/bin/python -m pytest --confcutdir=tests/v1/worker tests/v1/worker/test_gpu_model_runner.py tests/v1/worker/test_cp_utils.py -k 'stage_dummy_request_metadata or dcp_dummy_context_preserves_staged_request_invariants or skip_gate' -q

Test Result

  • Rebased-source CPU tests: 10 passed (five metadata regression cases plus five existing DCP skip-gate cases), 44 deselected. --confcutdir excludes unrelated repository-wide fixtures; the real runner module, staging helper and DCP helper are imported and exercised.
  • Negative control with only the sequence-length lower bound removed: 1 failed, 4 passed. The short profiling override produced computed length -3 instead of 0.
  • Changed-file pre-commit hooks and git diff --check: passed.
  • FULL graph profiling and end-to-end MiniMax-M3 startup/inference validation remain pending. CPU tests do not validate device-stream ordering or CUDA graph replay; no model-accuracy claim is made.

AI assistance

OpenAI Codex assisted with implementation, review, tests and the rebase. Ready for maintainer review; this is not a claim that the outstanding GPU validation has passed. Human submitter review and execution of the relevant tests remain required before merge. No private infrastructure or run information is included.

@mergify mergify Bot added the bug Something isn't working label Aug 31, 2026
@njhill njhill added the mrv1-only Issues/PRs which apply only to Model Runner V1 (not applicable to Model Runner V2) label Aug 31, 2026
@kyleliang-nv
kyleliang-nv force-pushed the agent/minimax-m3-full-dummy-metadata branch from d69bdd9 to 2c28cf8 Compare August 31, 2026 22:41
@kyleliang-nv
kyleliang-nv force-pushed the agent/minimax-m3-full-dummy-metadata branch from 2c28cf8 to 6f7022f Compare September 15, 2026 22:09
@kyleliang-nv kyleliang-nv changed the title [Bugfix][Core] Stage consistent FULL dummy metadata [Bugfix][MRV1] Stage consistent FULL dummy metadata Sep 15, 2026
kyleliang-nv and others added 2 commits September 21, 2026 15:43
Derive computed lengths and absolute positions from dummy sequence metadata, clear padded rows, and keep DCP from overwriting the staged positions.

Assisted-by: OpenAI Codex
Signed-off-by: Kyle Liang <kylliang@nvidia.com>
Normalize the CPU sequence-length mirror before staging device metadata so short profiling overrides cannot create negative computed lengths or positions. Cover short and long profiles, padding, mixed DCP and ragged decode with CPU regressions.

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Kyle Liang <kyleliang-nv@users.noreply.github.com>
@kyleliang-nv
kyleliang-nv force-pushed the agent/minimax-m3-full-dummy-metadata branch from 6f7022f to 8a18005 Compare September 21, 2026 22:45
@kyleliang-nv
kyleliang-nv marked this pull request as ready for review September 21, 2026 22:45

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mrv1-only Issues/PRs which apply only to Model Runner V1 (not applicable to Model Runner V2)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants