[hybrid-model] clean up and consolidate redundant fields in RadixLinearAttention#17660
[hybrid-model] clean up and consolidate redundant fields in RadixLinearAttention#17660hebiao064 merged 5 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello @zminglei, 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 focuses on enhancing 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. 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
|
|
/tag-and-rerun-ci retry |
There was a problem hiding this comment.
Code Review
The pull request successfully cleans up and consolidates redundant fields within the RadixLinearAttention class and its usage in hybrid_linear_attn_backend.py and qwen3_next.py. This refactoring improves code clarity and maintainability by removing unnecessary intermediate variables and directly calculating or retrieving the required dimensions. All changes are consistent with the stated motivation of the pull request.
| @@ -832,11 +832,12 @@ | |||
| conv_weights = layer.conv_weights | |||
| bias = layer.bias | |||
There was a problem hiding this comment.
(not related to this line)
would you pls also move self.conv_state_len = self.conv_states_shape[-1] to attn backend __init__ function to avoid this operation for every forward?
python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py
Outdated
Show resolved
Hide resolved
python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py
Outdated
Show resolved
Hide resolved
python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py
Outdated
Show resolved
Hide resolved
python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py
Outdated
Show resolved
Hide resolved
python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py
Outdated
Show resolved
Hide resolved
| initial_state_indices=cache_indices, | ||
| cu_seqlens=query_start_loc, | ||
| use_qk_l2norm_in_kernel=True, | ||
| softplus_beta=1.0, |
There was a problem hiding this comment.
softplus_beta and softplus_threshold should be a config read from model config, and if not existed, we can just these two magic numbre: 1.0 and 20.0
python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py
Outdated
Show resolved
Hide resolved
|
/rerun-failed-ci again |
Motivation
clean up and consolidate redundant fields in
RadixLinearAttentionModifications
Accuracy Tests
Qwen3-Next
Kimi Linear
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci