Skip to content

unified management of environment variables for vlm cuda ipc transport #14501

Merged
yuan-luo merged 1 commit intosgl-project:mainfrom
yhyang201:vlm-env
Dec 18, 2025
Merged

unified management of environment variables for vlm cuda ipc transport #14501
yuan-luo merged 1 commit intosgl-project:mainfrom
yhyang201:vlm-env

Conversation

@yhyang201
Copy link
Copy Markdown
Collaborator

Motivation

Modifications

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yhyang201, 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 refactors the management of environment variables pertinent to VLM CUDA IPC transport. It consolidates the definition and default values of these variables into a central envs object, moving away from scattered utility function calls. This unification aims to improve the discoverability, consistency, and maintainability of configuration settings across the codebase, particularly for multimodal processing components.

Highlights

  • Centralized Environment Variable Definitions: New environment variables related to VLM CUDA IPC transport (SGLANG_USE_CUDA_IPC_TRANSPORT, SGLANG_MM_FEATURE_CACHE_MB, SGLANG_MM_ITEM_MEM_POOL_RECYCLE_INTERVAL_SEC) have been added to python/sglang/srt/environ.py for unified management.
  • Refactored Environment Variable Access: Existing code in python/sglang/srt/multimodal/processors/base_processor.py and python/sglang/srt/utils/cuda_ipc_transport_utils.py has been updated to retrieve these environment variables from the central envs object, replacing direct calls to get_bool_env_var, get_int_env_var, and get_float_env_var.
  • Improved Consistency and Maintainability: This change ensures a single source of truth for VLM CUDA IPC transport configurations, enhancing code consistency and simplifying future updates or additions of environment-dependent settings.
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
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 refactors the management of environment variables by introducing a unified Envs class, which is a great improvement for code maintainability and consistency. The changes correctly replace direct environment variable access with the new centralized approach. My review includes a few minor suggestions to further improve code style and consistency.

SGLANG_RESIZE_RESAMPLE = EnvStr("")

# VLM Item CUDA IPC Transport
SGLANG_USE_CUDA_IPC_TRANSPORT=EnvBool(False)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For better readability and to adhere to PEP 8 style guidelines, please add spaces around the assignment operator.

Suggested change
SGLANG_USE_CUDA_IPC_TRANSPORT=EnvBool(False)
SGLANG_USE_CUDA_IPC_TRANSPORT = EnvBool(False)

_is_npu = is_npu()

SGL_USE_CUDA_IPC = get_bool_env_var("SGLANG_USE_CUDA_IPC_TRANSPORT")
SGL_USE_CUDA_IPC = envs.SGLANG_USE_CUDA_IPC_TRANSPORT.get()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the project's naming conventions and the ongoing effort to deprecate the SGL_ prefix (as seen in environ.py), consider renaming this variable. A name like SGLANG_USE_CUDA_IPC or USE_CUDA_IPC_TRANSPORT would be more consistent. If you apply this change, please remember to update its usages throughout the file.

Comment on lines 18 to 20
MM_ITEM_MEMORY_POOL_RECYCLE_INTERVAL = (
0.05
if not get_float_env_var("SGLANG_MM_ITEM_MEM_POOL_RECYCLE_INTERVAL_SEC")
else get_float_env_var("SGLANG_MM_ITEM_MEM_POOL_RECYCLE_INTERVAL_SEC")
envs.SGLANG_MM_ITEM_MEM_POOL_RECYCLE_INTERVAL_SEC.get()
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The parentheses around this assignment are redundant and can be removed for cleaner code.

MM_ITEM_MEMORY_POOL_RECYCLE_INTERVAL = envs.SGLANG_MM_ITEM_MEM_POOL_RECYCLE_INTERVAL_SEC.get()

@yuan-luo
Copy link
Copy Markdown
Collaborator

yuan-luo commented Dec 6, 2025

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci label Dec 6, 2025
@yuan-luo yuan-luo merged commit 3d42b7e into sgl-project:main Dec 18, 2025
228 of 242 checks passed
Liwansi added a commit to iforgetmyname/sglang that referenced this pull request Dec 19, 2025
…n3_pp

* 'main' of https://github.com/sgl-project/sglang: (74 commits)
  [bug fix][pp] fix inconsistent latency between tp (sgl-project#15379)
  Fix warp illegal instruction in kimi k2 thinking PCG (sgl-project#15306)
  Fix gpt-oss yarn with `truncate` argument (sgl-project#14270)
  Monkey patch deepseek-ocr's `v_head_dim` (sgl-project#15384)
  [model-gateway] Replace PolicyRegistry RwLock with DashMap for lock-free policy lookups (sgl-project#15361)
  [PP] Fix dynamic chunking strategy for PP (sgl-project#15372)
  Fix issue: ENABLE_BELOW_SM90 cannot be enabled on aarch64 CPU (sgl-project#12967)
  Split test_piecewise_cuda_graph.py to optimize CI resource usage (sgl-project#15290)
  unified management of environment variables for vlm cuda ipc transport  (sgl-project#14501)
  Mistral Large 3 NVFP4 TRTLLM MoE support (sgl-project#15049)
  fix: adjust time for test_epd_disaggregation.py (sgl-project#15354)
  Add doc for qwen3 next (sgl-project#15337)
  feat: DeepSeek-V3.2 Streaming tool call output (sgl-project#15278)
  Feature/trtllm mha workspace size configurable sgl-project#15089 (sgl-project#15131)
  [VLM] Support cos sin cache for Qwen3-VL & GLM-4.1V (sgl-project#15205)
  [Deepseek V3.2] Support Overlap Spec + NSA (sgl-project#15307)
  Add request-level timestamp for when prefill finishes (sgl-project#14860)
  [CI] Migrate LoRA tests to test/registered/lora/ (sgl-project#15176)
  Reserve more memory for DeepSeekOCR model and adjust server start timeout for DeepGEMM to reduce flakiness (sgl-project#15277)
  Fix condition check for require_gathered_buffer (sgl-project#15328)
  ...
@yhyang201 yhyang201 deleted the vlm-env branch April 16, 2026 07:16
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.

2 participants