[Feature][Ops] Support original sparse indices in SCFA - #15751
QwertyJack wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enables the DeepSeek-V4-Flash-Vision-Exp multimodal path on the Ascend architecture. It introduces a specialized SCFA kernel that supports per-query original-KV physical slots, integrates the vision tower and aligner components, and updates the MoE router to handle vision-specific expert selection. Additionally, it includes infrastructure to manage multimodal document ranges and ensures speculative decoding remains stable when using vision-enabled checkpoints. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. Tip 💡 Consider Linking a Related Issue or RFCYour PR title contains the [BugFix] tag, indicating a bug fix or new feature. Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:
🙏 Thanks for helping us keep the project well-organized! |
There was a problem hiding this comment.
Code Review
Suggested PR Title:\n\nmarkdown\n[Ops][Feature] Support DeepSeek-V4 Vision model on Ascend\n\n\nSuggested PR Summary:\n\nmarkdown\n### What this PR does / why we need it?\nThis PR adds support for the DeepSeek-V4 vision model (DeepSeek-V4-Flash-Vision-Exp) on the Ascend backend. It implements multimodal preprocessing, the vision tower (ViT and aligner), and the main conditional generation model wrapper. It also integrates vision-specific expert routing bias (`bias_vl`) into the fused MoE router, updates speculative decoding configurations, and adapts quantization prefix mappings.\n\nFeedback:\n- Remove `strict=True` in `zip()` within `vl_model.py` to maintain compatibility with Python 3.9.\n- Guard the weight loading check in `vl_model.py` to prevent a `KeyError` when `image_enabled` is `False`.\n- Specify `device=original_mask.device` when creating the padding mask in `mm_preprocess.py` to avoid device mismatch errors.\n\n### Does this PR introduce _any_ user-facing change?\nYes, it adds support for serving the DeepSeek-V4 vision model on Ascend.\n\n### How was this patch tested?\nTested with newly added unit and integration tests under `tests/e2e/nightly/single_node/ops/singlecard_ops/test_sparse_attn_sharedkv_scfa_indices.py`, `tests/ut/attention/test_dsa_v1.py`, `tests/ut/models/test_deepseek_v4_moe.py`, `tests/ut/models/test_deepseek_v4_vision.py`, and `tests/ut/models/test_deepseek_v4_vision_preprocess.py`.\n
331abdd to
1895dd9
Compare
|
/rerun Rerun (failed jobs only):
|
1 similar comment
|
/rerun Rerun (failed jobs only):
|
Derive original KV lengths from padded physical-slot rows and gather both K and V through ori_sparse_indices. Preserve the existing contiguous path when the optional indices are absent. Signed-off-by: QwertyJack <7554089+QwertyJack@users.noreply.github.com>
1895dd9 to
c1dfeea
Compare
|
/rerun Rerun (failed jobs only):
|
What this PR does / why we need it?
This operator follow-up is stacked directly on #15457. DeepSeek V4 Vision builds
ori_sparse_indicesfor bidirectional attention inside image spans, but the arch32 SCFA kernel currently reads original K/V through the contiguous paged-attention window. As a result, passing the indices alone does not make compressed SCFA layers consume the selected physical PA slots.With #15457 plus this PR, the core DeepSeek-V4-Flash-Vision-Exp multimodal SCFA path is available.
Related roadmap: #15462.
What changed
DataCopyPABySlots.ori_sparse_indicesis absent.Does this PR introduce any user-facing change?
Yes. On arch32 with
layout_q=TNDandlayout_kv=PA_ND, SCFA now applies the per-query original-KV physical slots supplied by the runtime. Image tokens can therefore attend bidirectionally within their image span while surrounding text retains causal sliding-window attention.How was this patch tested?
The rebased PR contains one operator commit whose parent is the current #15457 head
a0f4947bb.Current branch checks:
The three modified SCFA kernel sources are byte-identical to the sources used to build the retained Ascend 910B OPP package. That package passed the new dense-reference suite:
The covered operator configurations are:
TND;PA_ND;The same operator sources were also used in the full W8A8 integration stack that aligned the fixed official-API teacher sequences and content-token top-1 results. That service evidence included additional runtime hardening from #15740, so it is integration evidence rather than an isolated #15457-plus-operator comparison.
Scope boundaries
This PR intentionally targets the DeepSeek V4 production combination
TND + PA_NDon arch32.The existing host tiling restriction
kv_head_num == 1remains unchanged.DSA context parallel is not changed.
No Python runtime, frontend, RNG, or performance changes are included.
vLLM main: vllm-project/vllm@ba07e4a