Skip to content

[Test][KV Events] Cover MLA, GDN and dense partial-hit event reporting - #63550

Open
ker-zhao wants to merge 1 commit into
vllm-project:mainfrom
ker-zhao:test/kv-events-layout-coverage
Open

ker-zhao wants to merge 1 commit into
vllm-project:mainfrom
ker-zhao:test/kv-events-layout-coverage

Conversation

@ker-zhao

@ker-zhao ker-zhao commented Oct 25, 2026 •

Copy link
Copy Markdown

Overview

Refs #63149 (P1 "Establish coverage across cache layouts"), claimed there on
2026-10-23 as the CPU-level part. Test-only: adds
tests/v1/core/test_kv_cache_events_layouts.py with CPU assertions for the
cache layouts that have no event assertions today — MLA, GDN/recurrent, and
dense partial hits where hash_block_size < block_size.

Claims

  • MLA groups emit kv_cache_spec_kind == "mla_attention" with a hash chain,
    token span and parent that match the reusable prefix — on store, on reuse, and
    on a kv_cache_report_mode="full" republish.
  • GDN and Mamba2 groups both emit kv_cache_spec_kind == "mamba" with one
    checkpoint hash covering the reusable span; the event shape is identical for
    both mamba_type values.
  • With hash_block_size < block_size, a prompt ending inside a cache block
    emits a tail BlockStored at hash granularity whose hash, parent and token
    span are exactly what a sibling resumes from. The companion case shows an
    attention tail past the last recurrent checkpoint is not a reusable hybrid
    prefix.

The assertions are phrased semantically so they can serve as the expected-event
spec for the GPU matrix that @qwert123q proposed in the tracker.

Validation

.venv/bin/python -m pytest tests/v1/core/test_kv_cache_events_layouts.py -q  # 6 passed in 2.2s
.venv/bin/python -m pytest tests/v1/core/test_prefix_caching.py -q           # 174 passed in 57s
.venv/bin/python -m pytest tests/v1/core/prefix_cache/ -q                    # 206 passed in 6:04
.venv/bin/pre-commit run --files tests/v1/core/test_kv_cache_events_layouts.py

No model/GPU evaluation applies: this changes no production code and no output.
CI already covers it — .buildkite/test_areas/misc.yaml runs
pytest -m 'cpu_test' v1/core on cpu-small, and tests/v1 is in that step's
source_file_dependencies, so no Buildkite change is needed.

Details

Why these cases. Event tests in test_prefix_caching.py cover
FullAttentionSpec and sliding window; partial-block events are covered only at
the BlockPool.cache_partial_block primitive level, not through the manager.
Nothing asserts the emitted kind or hash semantics for MLA, a recurrent group,
or a sub-block hit.

Why this is not a duplicate.

Not covered (stated in the module docstring): zero-hash recurrent chunk
events (#44488), off-grid single-chunk prefills, and DCP > 1.

AI assistance. AI assistance was used: the change was drafted with an AI
coding agent (Claude Code) and reviewed line by line by the submitter, who ran
the commands above.


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (Mandatory for agents, optional for humans).

  • AI assistance was used during the creation of this PR.

  • Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.

  • Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.

  • Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.

  • Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment /ci run for upstream CI or /amd-ci run for AMD CI only whenever CI signals are needed.

Once the PR is approved or has the ready label, the PR author can also use the corresponding /ci run, /ci retry, and /ci cancel commands, or their /amd-ci variants. New commits do not start upstream CI automatically.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

@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.

Adds CPU-only assertions for the event payloads of the cache layouts listed
under P1 in vllm-project#63149 but not asserted today: MLA, GDN and dense partial hits.

Signed-off-by: ker <zhaokemail@foxmail.com>
Co-authored-by: Claude Code <noreply@anthropic.com>

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant