Skip to content

Fix IMA with flashinfer + spec + topk & Add radix attention test cases for eagle#13740

Merged
hnyls2002 merged 5 commits intomainfrom
lsyin/spec-decode-oom
Dec 13, 2025
Merged

Fix IMA with flashinfer + spec + topk & Add radix attention test cases for eagle#13740
hnyls2002 merged 5 commits intomainfrom
lsyin/spec-decode-oom

Conversation

@hnyls2002
Copy link
Copy Markdown
Collaborator

@hnyls2002 hnyls2002 commented Nov 21, 2025

By adding test radix attention in test_spec_infer_b.py, there is a decode OOM issue.

Reproduction

python -m unittest test_eagle_infer_b.TestEAGLERetract.test_radix_attention

The out-of-memory error has been fixed by #14939.

The flashinfer IMA bugs were reported in #14624.

Why is there an IMA issue?

The custom mask is generated inside the Eagle worker with build_tree_kernel_efficient.

But the mask_indptr was generated inside flashinfer's begin_forward, and the mask_indptr is calculated with padded qo_indptr and padded kv_indptr when applying CUDA graph padding.

The shape diff between custom_mask and mask_indptr will cause flashinfer to access illegal memory.

Note that the current fix is not perfect; we want the padding logic to be natural with the attention init logic

@hnyls2002 hnyls2002 changed the title [Debug] DO NOT MERGE: Decode oom with spec [Debug] DO NOT MERGE: Decode OOM with spec Nov 21, 2025
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @hnyls2002, 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 is a temporary debugging effort to pinpoint the cause of a decode Out-Of-Memory error. It streamlines the test_eagle_infer_b.py test suite by removing all but the specific radix attention test that triggers the OOM, allowing for focused investigation of the memory issue.

Highlights

  • Debugging OOM Issue: This pull request is a debug-only PR, explicitly marked "DO NOT MERGE", aimed at investigating a decode Out-Of-Memory (OOM) issue that occurs when adding a radix attention test.
  • Test Simplification: The test_eagle_infer_b.py file has been significantly refactored to remove a large number of existing test cases and imports, focusing solely on running the radix_attention_test to isolate and reproduce the OOM condition.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@hnyls2002 hnyls2002 self-assigned this Nov 21, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is for debugging an Out-Of-Memory issue related to radix attention, as indicated by the title and description. The changes isolate the problem by removing numerous tests and adding a specific test_radix_attention test. While these changes are significant, they are appropriate for a temporary debugging branch that is not intended to be merged. I have one minor suggestion to align the new test code with standard unittest practices.

@hnyls2002 hnyls2002 force-pushed the lsyin/spec-decode-oom branch from 25c6559 to 5c47a11 Compare December 13, 2025 05:07
@hnyls2002 hnyls2002 changed the title [Debug] DO NOT MERGE: Decode OOM with spec Add radix attention test to spec Dec 13, 2025
@hnyls2002 hnyls2002 changed the title Add radix attention test to spec Fix IMA with flashinfer + spec + topk & Add radix attention test cases for eagle Dec 13, 2025
@hnyls2002
Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@hnyls2002 hnyls2002 merged commit d977dd2 into main Dec 13, 2025
135 of 153 checks passed
@hnyls2002 hnyls2002 deleted the lsyin/spec-decode-oom branch December 13, 2025 15:04
YChange01 pushed a commit to YChange01/sglang that referenced this pull request Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant