Skip to content

Skip mm feature pool init to avoid EPD OOM#16388

Merged
ShangmingCai merged 19 commits intosgl-project:mainfrom
liusy58:epd_oom
Jan 23, 2026
Merged

Skip mm feature pool init to avoid EPD OOM#16388
ShangmingCai merged 19 commits intosgl-project:mainfrom
liusy58:epd_oom

Conversation

@liusy58
Copy link
Collaborator

@liusy58 liusy58 commented Jan 4, 2026

Motivation

The BaseMultimodalProcessor currently initializes a large cudaipc_mmfeature_pool whenever the environment variable SGLANG_USE_CUDA_IPC_TRANSPORT is set, regardless of whether that specific instance actually needs to perform IPC transfers.

Since MMReceiver only handles orchestration and metadata and does not participate in the actual GPU-to-GPU tensor transport, this allocation is entirely unused and wasted.

Modifications

Accuracy Tests

Benchmarking and Profiling

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments (/tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci) or contact authorized users to do so.
  4. After green CI and required approvals, ask Merge Oncalls to merge.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @liusy58, 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 an Out-Of-Memory (OOM) issue, likely within the Encode Processor Disaggregation (EPD) component, by refining the conditions under which multimodal feature memory pools are initialized. The changes ensure that CUDA IPC-specific memory allocations only occur when the cuda_ipc transport mode is actively in use, preventing excessive memory consumption in other configurations and improving system stability.

Highlights

  • Multimodal Processor Initialization: The get_mm_processor call in encode_receiver.py now explicitly uses the "default" transport mode, which helps prevent unintended activation of CUDA IPC-specific memory handling in certain configurations.
  • Conditional CUDA IPC Memory Pool Activation: The initialization of cudaipc_mmfeature_pool in base_processor.py has been made more robust. It now only proceeds if SGL_USE_CUDA_IPC is enabled AND the transport_mode is explicitly set to "cuda_ipc", preventing unnecessary memory allocation and addressing potential Out-Of-Memory issues.

🧠 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 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.

Copy link
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 aims to fix an Out-Of-Memory (OOM) issue in the Encoder-Prefill-Decoder (EPD) disaggregation setup by disabling CUDA IPC transport for the multimodal processor in the MMReceiver. This is achieved by hardcoding the transport_mode to "default" and making the CUDA IPC feature initialization conditional on the transport_mode.

While the changes are in the right direction, they are incomplete and introduce a critical bug. The logic for using CUDA IPC features in BaseMultimodalProcessor is not consistently updated. There are other code paths that still rely solely on the SGL_USE_CUDA_IPC flag, which will lead to an AttributeError at runtime if SGL_USE_CUDA_IPC is enabled but the transport_mode is not cuda_ipc. I've added a detailed comment on how to fix this.

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 4, 2026

/tag-run-ci-label

@github-actions github-actions bot added the run-ci label Jan 4, 2026
@ShangmingCai
Copy link
Collaborator

/tag-run-ci-label

@liusy58 Frequent pushes will trigger CI cooldown, and you need to wait an hour before rerunning CI.

@github-actions github-actions bot added the Multi-modal multi-modal language model label Jan 4, 2026
@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 5, 2026

/rerun-failed-ci

@ZhengWG
Copy link
Collaborator

ZhengWG commented Jan 5, 2026

Good Fix! LGTM.

Copy link
Collaborator

@ShangmingCai ShangmingCai left a comment

Choose a reason for hiding this comment

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

LGTM

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 6, 2026

/rerun-failed-ci

2 similar comments
@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 6, 2026

/rerun-failed-ci

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 7, 2026

/rerun-failed-ci

@yhyang201
Copy link
Collaborator

yhyang201 commented Jan 7, 2026

It looks like this PR Test / unit-test-backend-8-gpu-h200 (3) (pull_request) is unable to finish within 20 minutes?
https://github.com/sgl-project/sglang/actions/runs/20708486875/job/59653204607?pr=16388
@Kangyan-Zhou

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 8, 2026

/rerun-failed-ci

@Kangyan-Zhou
Copy link
Collaborator

It looks like this PR Test / unit-test-backend-8-gpu-h200 (3) (pull_request) is unable to finish within 20 minutes? https://github.com/sgl-project/sglang/actions/runs/20708486875/job/59653204607?pr=16388 @Kangyan-Zhou

We moved one test from per commit test to nightly so it should work now

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 9, 2026

/rerun-failed-ci

1 similar comment
@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 10, 2026

/rerun-failed-ci

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 12, 2026

/rerun-failed-ci

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 12, 2026

/tag-and-rerun-ci

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 17, 2026

/rerun-failed-ci

@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 22, 2026

/rerun-failed-ci

1 similar comment
@liusy58
Copy link
Collaborator Author

liusy58 commented Jan 22, 2026

/rerun-failed-ci

@ShangmingCai ShangmingCai changed the title fix EPD OOM Skip mm feature pool init to avoid EPD OOM Jan 23, 2026
@ShangmingCai
Copy link
Collaborator

image CI has passed.

@ShangmingCai ShangmingCai merged commit 62e6a74 into sgl-project:main Jan 23, 2026
288 of 320 checks passed
dsingal0 pushed a commit to dsingal0/sglang that referenced this pull request Feb 1, 2026
…ial backport

Applied changes to:
- base_processor.py: Add skip_mm_pool parameter support
- multimodal_processor.py: Add **kwargs to pass skip_mm_pool through

Note: encode_receiver.py changes not applied due to file structure differences
Johnsonms pushed a commit to Johnsonms/sglang that referenced this pull request Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority Multi-modal multi-modal language model run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants