feat: add nsa and swa disagg support with nixl#18939
feat: add nsa and swa disagg support with nixl#18939ShangmingCai merged 3 commits intosgl-project:mainfrom
Conversation
Signed-off-by: Neal Vaidya <nealv@nvidia.com>
Signed-off-by: Neal Vaidya <nealv@nvidia.com>
Summary of ChangesHello @nealvaidya, 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 addresses a critical bug in the NIXL disaggregation connector that previously caused transfer timeouts for hybrid attention models utilizing Sliding Window Attention (SWA) or Native Sparse Attention (NSA). The connector was initially designed to only handle 'mamba' state types, leading to silent failures when other state configurations were encountered. The changes introduce a generalized state transfer mechanism by refactoring the Highlights
🧠 New Feature in Public Preview: You can now enable Memory 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. Changelog
Activity
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 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 counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses a bug in NIXL disaggregation for models using SWA and NSA state types. The refactoring of send_kvcache into a more generic _send_kvcache_generic is a solid approach that improves code reuse and maintainability. The new maybe_send_extra method correctly handles different state types, aligning the NIXL connector with the existing mooncake implementation. The changes are logical and well-executed. I have one minor suggestion to enhance code readability.
| if state_type != "none": | ||
| raise RuntimeError( | ||
| f"PD Disaggregation via NIXL does NOT support {state_type} hybrid models yet." | ||
| ) | ||
| return None |
There was a problem hiding this comment.
For better readability, you could explicitly check for state_type == "none" and then handle unexpected state types in an else block. This makes the logic for handling unknown state types clearer.
| if state_type != "none": | |
| raise RuntimeError( | |
| f"PD Disaggregation via NIXL does NOT support {state_type} hybrid models yet." | |
| ) | |
| return None | |
| if state_type == "none": | |
| return None | |
| else: | |
| raise RuntimeError( | |
| f"PD Disaggregation via NIXL does NOT support {state_type} hybrid models yet." | |
| ) |
|
I have tested, it works with DS V3.2 NVFP4 model. |
|
/rerun-stage stage-c-test-8-gpu-h200 |
|
✅ Triggered |
|
/rerun-stage stage-c-test-8-gpu-h20 |
|
✅ Triggered |
Motivation
Fixes a bug reported on Slack where NIXL PD disaggregation fails with transfer timeouts for hybrid attention models that use SWA (sliding window attention) or NSA (native sparse attention) state types — e.g., DeepSeek V3.2 with Wide EP.
The NIXL connector's add_transfer_request previously only handled state_type == "mamba" via _send_mamba_state, but had no path for "swa" or "nsa" state types. When a hybrid model with SWA/NSA state was used, the state data was silently never transferred, causing the decode side to wait indefinitely for the state notification and eventually time out.
The mooncake connector already handled this correctly via its maybe_send_extra method, which dispatches "swa"/"nsa" state types through _send_kvcache_generic. This PR mirrors that approach in the NIXL connector.
Modifications
Modifications
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci