Repository navigation
[Bugfix][CPU] Reject unsupported --kv-cache-dtype at CPU attention backend selection - #62665
Conversation
…ckend selection Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Patryk Mikulski <7378686+patrk@users.noreply.github.com>
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment Once the PR is approved or has the If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. Agent GuidelinesIMPORTANT: 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. 🚀 |
|
Independent Linux x86 check (AVX-512 available, no AMX): your unchanged 11 selector tests pass on With the same three-layer tiny random Llama, the parent accepts Reproduction and limits: exact |
|
Thanks for running this on x86! That's the AVX-512 path I couldn't test locally. Good to see the six failures on the parent |
|
This pull request has merge conflicts that must be resolved before it can be |
…ype-validation Signed-off-by: Patryk Mikulski <7378686+patrk@users.noreply.github.com> # Conflicts: # tests/kernels/attention/test_cpu_attn.py
|
/ci run |
|
✅ Triggered Buildkite CI #96601 for commit ℹ️ This PR is 75 commits behind upstream |
…ckend selection (vllm-project#62665) Signed-off-by: Patryk Mikulski <7378686+patrk@users.noreply.github.com> Co-authored-by: Patryk Mikulski <7378686+patrk@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: vllm-agent <claw@inferact.ai>
Overview
Fixes #62664. The CPU platform now rejects
--kv-cache-dtypevalues its attention backends can't handle, at backend selection instead of silently accepting them.Claims
turboquant_*,ultraquant_4bit,nvfp4andint8_per_token_headon CPU fail at startup with a clearValueError. Before this, turboquant/ultraquant ran and produced garbage (see the issue).fp8*is accepted only on hosts with AVX-512 or AMX, the same rule the kernel already enforces after weight loading.auto,bfloat16andfloat16are unchanged.Validation
macOS arm64 (Apple M4 Pro), CPU source build, on main @ e4a676c.
pytest tests/kernels/attention/test_cpu_attn.py -k "kv_cache_dtype_validation or rejects_quantized"test_cpu_attn.py,tests/platforms/test_cpu.py,test_attention_selector.py,tests/config/test_kv_cache_dtype.pypre-commit run --files <changed files>LLM("Qwen/Qwen2.5-0.5B-Instruct", kv_cache_dtype=...)autoOK;turboquant_k8v4garbage;fp8fails after weight loadautoOK ("Paris");turboquant_k8v4,ultraquant_4bit,fp8raiseValueErrorbefore weight loadI could not run on x86. The AVX-512 path, where fp8 is accepted, is covered by the test through a monkeypatched ISA check.
Update: @adenzhou1350 independently tested this on Linux x86 with AVX-512 (no AMX): the 11 tests pass, the parent commit fails 6, and
turboquant_k8v4is rejected before weight loading (see their comment).Details
CpuPlatform.get_attn_backend_clsnever checked the backend's supported KV cache dtypes, soCPUAttentionBackend.supported_kv_cache_dtypeswas never enforced. The CPU kernel treats any dtype other than fp8 asauto, so the unsupported formats got bf16 writes into a uint8 cache.supports_kv_cache_dtypeinstead of calling the fullvalidate_configuration. The full check also validates head size and block size, which would change behaviour for models that work today.ultraquant_4bitrouting returns before this check, and the test doesn't parametrizeultraquant_4bit.test_cpu_attn.py(CPU kernel tests job). That job doesn't listvllm/platforms/cpu.pyas a dependency. I left the CI config alone.This PR was written with AI assistance (Claude Code). I reviewed every changed line and ran the checks above myself.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (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.