Repository navigation
[Backport] Support CUDA IPC on ROCm for multimodal data in Qwen3.8 branch - #75
Conversation
Adapt 881b8ec to the existing ServerArgs handler and platform mocks; this branch predates serving_hook. Signed-off-by: Xiake Sun <[email protected]>
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]>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
What changed in this PR
Backports upstream changes to allow --mm-feature-transport=cuda_ipc on AMD ROCm/HIP by providing a ROCm-safe implementation of the CUDA-IPC pool’s stream-ordered ready/ack protocol, plus CI/tests to validate ROCm behavior.
Changes:
- Allow
cuda_ipcmultimodal feature transport on either NVIDIA CUDA or AMD ROCm/HIP. - Add ROCm stream-control ops via Triton (system-scope atomics) and route
stream_wait_value32/stream_write_value32to the HIP implementation when on ROCm. - Expand unit tests and CI registration to cover stream ordering and multi-consumer reconstruction.
| File | Description |
|---|---|
| test/registered/unit/server_args/test_server_args.py | Updates validation tests to accept ROCm for cuda_ipc and improves error-message coverage. |
| test/registered/unit/multimodal/test_cuda_ipc_transport.py | Adds ROCm CI registration and new tests for stream ordering and multi-consumer reconstruction. |
| python/sglang/srt/server_args.py | Updates platform gating for cuda_ipc to include ROCm/HIP and adjusts the error message. |
| python/sglang/srt/multimodal/transport/memory_pool.py | Routes stream wait/write ops to ROCm-safe implementations when torch.version.hip is set. |
| python/sglang/srt/multimodal/transport/hip_stream_ops.py | Introduces Triton kernels implementing system-scope atomic wait/write for control words on ROCm. |
Review effort: Lite
| def _wait_value32(address, value): | ||
| pointer = tl.cast(address, tl.pointer_type(tl.uint32)) | ||
| while tl.atomic_add(pointer, 0, sem="acquire", scope="sys") < value: | ||
| pass | ||
|
|
||
|
|
||
| @triton.jit | ||
| def _write_value32(address, value): | ||
| pointer = tl.cast(address, tl.pointer_type(tl.uint32)) | ||
| tl.atomic_xchg(pointer, value, sem="release", scope="sys") | ||
|
|
||
|
|
||
| def wait_value32(address: int, value: int) -> None: | ||
| _wait_value32[(1,)](address, value, num_warps=1) | ||
|
|
||
|
|
There was a problem hiding this comment.
The patch is not valid
- Uses
tl.static_range(2**31 - 1), which asks Triton to expand roughly 2.1 billion iterations during compilation. - Never exits early when the flag becomes ready.
- Returns after exhausting the loop without callers checking timeout status. The queued tensor copy and acknowledgement could then proceed before the data is ready.
I would like to keep this concern open for real customer case test.
There was a problem hiding this comment.
I try to bound CUDA IPC wait to align with server watchdog timeout to avoid infinity spin loop: b8fb891
- 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]>
9b54e09 to
b8fb891
Compare
Signed-off-by: Xiake Sun <[email protected]>
|
The majority of this PR is a port of 2 upstream changes, with 2 newly introduced implementation files:
Notice that there exit
|
|
Tested with conc1 ,5 image (960x1280)8kin 500out
In this record, enabling IPC reduced the Mean TTFT by 221.51 ms, approximately 13.26%. |
3004941
into
apinge:qwen38-flash-next-amd-current-fix-install

Motivation
This PR aim to support CUDA IPC on ROCm in Qwen3.8 branch for multimodal data transfer cross GPU.
Modifications
Backport following two upstream PR:
Accuracy Tests
Enable with following environment variable with Qwen3.8 server, text+image QA passed accuracy verification.
Speed Tests and Profiling
Not applicable.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci