Skip to content

fix(vlm): stream-order CUDA IPC feature pool lifecycle and streamline multimodal transport module - #33949

Merged
mickqian merged 78 commits into
mainfrom
codex/mm-cuda-ipc-stream-sync
Aug 10, 2026
Merged

mickqian merged 78 commits into
mainfrom
codex/mm-cuda-ipc-stream-sync

Conversation

@mickqian

@mickqian mickqian commented Aug 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Publish CUDA IPC producer readiness on the producer CUDA stream.
  • Acknowledge each consumer only after its local copy on the consumer CUDA stream, preventing early pool reuse.
  • Replace per-slice POSIX shared memory and the global file lock with generation-tagged GPU control words.
  • Move CUDA IPC and its stream-ordered pool implementation under srt/multimodal/transport; keep the old utility module as a thin compatibility import.
  • Keep the default cached-handle path stream ordered. When handle caching is explicitly disabled, synchronize only the consumer stream before releasing the uncached mapping.
  • Stop the recycler before releasing backing memory and remove the obsolete process-global tp_size read.

Compatibility and memory policy

Why

The old producer could serialize a proxy immediately after enqueueing its pool copy, while the consumer incremented a CPU acknowledgement immediately after enqueueing its local copy. That could expose incomplete bytes or recycle and overwrite a slice before the copy completed. The new ready/wait/ack protocol is ordered on CUDA streams and tags every reused slot with a generation.

Server benchmark

Real Qwen3-VL-2B-Instruct, NVIDIA H200 x8, TP8 encoder DP, --mm-feature-transport cuda_ipc, 1 GiB bounded pool, OpenAI Chat bench_serving. Base 42a62553961a (#33936) and head e0c94d36c52a; the later main-only merges do not change this PR's transport or test files.

The request-rate sweep uses 48 requests/rate, 1-4 seeded random JPEG images/request, random 256-1024 px dimensions, 64 text input tokens, and 8 output tokens. All 288 A/B requests completed successfully.

Request rate Base req/s Head req/s Base p50 TTFT Head p50 TTFT
2 1.947 1.948 73.1 ms 71.2 ms
8 9.238 9.249 87.3 ms 85.9 ms
unlimited 36.269 34.434 816.5 ms 840.3 ms

Because the short unlimited run is sensitive to new-shape warmup, a second saturated comparison used 64 requests/run, three paired seeds after both servers had completed three warmup sweeps, and reports the median.

Metric Base Head Change
Request throughput 47.33 req/s 49.43 req/s +4.4%
Input throughput 47.70k tok/s 50.71k tok/s +6.3%
Median TTFT 803.9 ms 772.7 ms -3.9%
P99 TTFT 1286.1 ms 1237.0 ms -3.8%

The result supports a small steady-state gain while the primary reason to merge remains correctness: stream-ordered ready/ack prevents incomplete reads and premature pool reuse.

Validation

  • Pre-commit passes on all changed files.
  • Spawned-process CUDA IPC regression does not synchronize the producer and verifies recycling after the GPU acknowledgement.
  • Multi-consumer and encoder-owner tests cover generation reuse, full-group acknowledgement, duplicate release rejection, recycler shutdown, and uncached-mapping lifetime.
  • CPU tests cover the hard per-node pool budget and transport configuration.
  • Real-weight H200 server A/B completed with zero request failures; latest-head NVIDIA CI is running after the main merge.

Base integration

#33899 and #33936 are merged into main; this PR now targets main directly and contains only the stream-ordered CUDA IPC lifecycle changes.


CI States

Latest PR Test (Base): ✅ Run #31348879104
Latest PR Test (Extra): ❌ Run #31348879030

@mickqian mickqian added the run-ci CI: run the baseline test suite on this PR label Aug 7, 2026
@mickqian mickqian added the run-ci CI: run the baseline test suite on this PR label Aug 7, 2026

mickqian commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci extra

@github-actions github-actions Bot added the run-ci-extra CI: also run the extra suite (requires run-ci) label Aug 7, 2026
Base automatically changed from codex/mm-fabric-transport to main August 8, 2026 08:01
@mickqian mickqian changed the title fix(vlm): stream-order CUDA IPC feature pool lifecycle fix(vlm): stream-order CUDA IPC feature pool lifecycle and refactor multimodal transport module Aug 8, 2026
@mickqian mickqian changed the title fix(vlm): stream-order CUDA IPC feature pool lifecycle and refactor multimodal transport module fix(vlm): stream-order CUDA IPC feature pool lifecycle and streamline multimodal transport module Aug 8, 2026
…eam-sync

# Conflicts:
#	docs/cookbook/autoregressive/Moonshotai/Kimi-K3.mdx
@mintlify

mintlify Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
lmsysorg 🟢 Ready View Preview Aug 8, 2026, 11:34 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

…eam-sync

# Conflicts:
#	python/sglang/srt/multimodal/processors/kimi_k3.py
…eam-sync

# Conflicts:
#	python/sglang/srt/models/qwen3_vl.py
#	python/sglang/srt/utils/cuda_ipc_transport_utils.py
#	test/registered/unit/models/test_kimi_k25.py
#	test/registered/unit/test_global_config_read_ratchet.py
@mickqian
mickqian merged commit 443b62d into main Aug 10, 2026
198 of 236 checks passed
@mickqian
mickqian deleted the codex/mm-cuda-ipc-stream-sync branch August 10, 2026 10:47
vstone-w pushed a commit to ClownBin/sglang that referenced this pull request Aug 12, 2026
saturn-acc pushed a commit to saturn-acc/sglang that referenced this pull request Aug 16, 2026
Atituiset pushed a commit to Atituiset/sglang that referenced this pull request Sep 10, 2026
apinge pushed a commit to apinge/sglang that referenced this pull request Oct 22, 2026
…_v0.5.21` (#54)

* Merge main; port the cuda_ipc ROCm gate to serving_hook

The transport resolution moved from ServerArgs._handle_multimodal_feature_transport
to arg_groups/serving_hook.handle_multimodal_feature_transport. Accept cuda_ipc on
CUDA or HIP there. Tests use override_platform instead of patching server_args.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KVPUFiK2bhzjErEnCMv26w
(cherry picked from commit 7453337)

* [AMD] Complete stream-ordered multimodal IPC support on ROCm

PR sgl-project#33747 opens the multimodal IPC gate on HIP, but the pool lifecycle
introduced by sgl-project#33949 still calls the NVIDIA CUDA driver. Dispatch the
ROCm ready/wait/ack words through small Triton kernels with system-scope
acquire/release atomics. Keep the NVIDIA path unchanged.

Native HIP stream wait crashed on peer IPC mappings in the tested ROCm
build; the GPU kernel path preserves copy ordering and lease safety.
Correct the inherited gate comment to describe this additional backend
requirement and register IPC coverage for AMD.

* support qwen3.5 fp8 ptpc model

Signed-off-by: Xiake Sun <[email protected]>

* Add Qwen3.5 + dflash support with cuda graph and target verify

Signed-off-by: Xiake Sun <[email protected]>

* Add evaluation guide and scripts

Signed-off-by: Xiake Sun <[email protected]>

* eval: update eval guide & scripts

Signed-off-by: Xiake Sun <[email protected]>

* Addess review comments

Signed-off-by: Xiake Sun <[email protected]>

* eval: update guide to enforce reinstall process

Signed-off-by: Xiake Sun <[email protected]>

* fix(qwen3.8 ple): release loader parameter references before FP8 postprocessing

The self-referencing PLE shard loader forms a closure cycle that retains
params_dict after weight loading. When FP8 postprocessing
(fp8e4m3->fp8e4m3nuz) replaces the parameters, the dictionary keeps
their original GPU storage alive until cyclic GC runs, causing
Qwen3.8 BF16-PLE TP2 launches OOM.

Clear params_dict before returning so obsolete weight storage can be
released during postprocessing. Preserve PLE GPU residency, weight
precision, and existing quantization behavior.

Signed-off-by: Xiake Sun <[email protected]>

* eval: add Qwen3.5 dflash model and eval guide

Signed-off-by: Xiake Sun <[email protected]>

---------

Signed-off-by: Xiake Sun <[email protected]>
Co-authored-by: vincentzed <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
sammysun0711 added a commit to apinge/sglang that referenced this pull request Nov 3, 2026
…anch (#75)

* [AMD] Allow multimodal CUDA IPC on ROCm in the Qwen3.8 branch

Adapt 881b8ec to the existing ServerArgs handler and platform mocks; this branch predates serving_hook.

Signed-off-by: Xiake Sun <[email protected]>

* [AMD] Complete stream-ordered multimodal IPC support on ROCm

PR sgl-project#33747 opens the multimodal IPC gate on HIP, but the pool lifecycle
introduced by sgl-project#33949 still calls the NVIDIA CUDA driver. Dispatch the
ROCm ready/wait/ack words through small Triton kernels with system-scope
acquire/release atomics. Keep the NVIDIA path unchanged.

Native HIP stream wait crashed on peer IPC mappings in the tested ROCm
build; the GPU kernel path preserves copy ordering and lease safety.
Correct the inherited gate comment to describe this additional backend
requirement and register IPC coverage for AMD.

Signed-off-by: Xiake Sun <[email protected]>

* fix(multimodal): bound ROCm IPC waits with server watchdog timeout

- Reuse --watchdog-timeout for stream-ordered ROCm IPC readiness waits.
- Track GPU completion independently of scheduler batch activity.
- Log wait diagnostics and terminate consumers on timeout or query failure.
- Preserve supervision after event-record failures and reject graph capture.
- Add timeout and cached/uncached peer-IPC tests with two-GPU AMD CI.

Signed-off-by: Xiake Sun <[email protected]>

* eval: enable cuda_ipc for qwen3.8 by default

Signed-off-by: Xiake Sun <[email protected]>

---------

Signed-off-by: Xiake Sun <[email protected]>

This branch was successfully deployed

1 active deployment
staging - docs — 2b361dfa Deployed Aug 10, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant