Skip to content

[ROCm] Allow full CUDA graphs with DCP for the a2a backend - #53587

Closed
seungrokj wants to merge 1 commit into
vllm-project:mainfrom
seungrokj:rocm-dcp-a2a-full-cudagraph
Closed

seungrokj wants to merge 1 commit into
vllm-project:mainfrom
seungrokj:rocm-dcp-a2a-full-cudagraph

Conversation

@seungrokj

Copy link
Copy Markdown
Contributor

Summary

The ROCm platform (vllm/platforms/rocm.py) unconditionally downgrades
cudagraph_mode to PIECEWISE whenever decode context parallel (DCP) is
enabled. This is broader than necessary.

The all-to-all (a2a) DCP reduce path
(vllm/v1/attention/ops/dcp.py::dcp_a2a_lse_reduce) is built from Triton
(@triton.jit) pack/unpack kernels over private-pool torch.empty send/recv
buffers that are explicitly designed to be full-cudagraph capture-safe (see the
comment in _dcp_a2a_send_recv_buffers). CUDA already runs this exact path
under full CUDA graphs — cuda.py has no equivalent downgrade. Only the
ag_rs and prefill-context-parallel (PCP) paths need the PIECEWISE fallback on
ROCm.

This gates the DCP downgrade on dcp_comm_backend != "a2a", bringing ROCm to
parity with CUDA for the a2a backend. CUDA behavior is unchanged; ag_rs
(default) and PCP still downgrade to PIECEWISE.

Not a duplicate

Searched open PRs/issues for DCP + CUDA graph + ROCm (e.g. #48248 FlashInfer
A2A backend, #53001 Aiter non-causal draft, #46249 NCCL cudagraph eager-break).
None modify the ROCm DCP cudagraph-mode override.

Test plan / results

Hardware: AMD MI355x (gfx950), Kimi-K3, TP8/DCP8, --dcp-comm-backend a2a
(non-direct path, VLLM_USE_DIRECT_DCP_A2A=0), TRITON_MLA, fp8 KV,
--compilation-config cudagraph_mode=FULL_AND_PIECEWISE.

  • Before: boot logs Overriding cudagraph_mode to PIECEWISE; FULL cudagraph
    captures = 0.
  • After: no override; boot captures full graphs (Capturing CUDA graphs (FULL)), Graph capturing finished ~4 GiB/worker, no illegal memory access,
    engine healthy.

vllm bench serve (random, 8192-in / 1024-out, 40 prompts, max-concurrency 8):

metric PIECEWISE (before) FULL cudagraph (after)
Successful 40/40 40/40
Output tok/s 53.3 191 (peak 216)
Total tok/s 479 1723
Mean TPOT 148.5 ms 40.0 ms
Mean ITL 148.5 ms 40.0 ms
Mean TTFT 1721 ms 1883 ms
Duration 769 s 214 s

~3.6x throughput / 3.7x TPOT. Output is unchanged and coherent (spot-check:
"The capital of France is" -> " Paris."). TTFT is unchanged because prefill is
not cudagraph-captured.

Note: the "CUDA already runs this path under full graphs" statement is based on
cuda.py having no DCP cudagraph downgrade; it was validated on ROCm hardware,
not re-verified on NVIDIA.

AI assistance

This change was developed with AI assistance (Claude). The submitter has
reviewed every changed line and run the tests above.

The ROCm platform unconditionally downgrades cudagraph_mode to PIECEWISE
whenever decode context parallel (DCP) is enabled. This is broader than
necessary: the all-to-all ("a2a") DCP reduce path is built from Triton
pack/unpack kernels over private-pool torch.empty send/recv buffers that
are designed to be full-cudagraph capture-safe, and CUDA already runs this
path under full CUDA graphs (cuda.py has no such downgrade). Only the
ag_rs and PCP paths need the PIECEWISE fallback.

Gate the DCP downgrade on dcp_comm_backend != "a2a" so ROCm reaches full
CUDA graphs for the a2a backend, matching CUDA.

Measured on MI355x (gfx950), Kimi-K3 TP8/DCP8, a2a backend, fp8 KV,
random 8192-in/1024-out at concurrency 8: full CUDA graphs vs the
forced-PIECEWISE baseline improve output throughput 53 -> 191 tok/s (3.6x)
and mean TPOT 148 -> 40 ms (3.7x), 40/40 requests successful, generation
unchanged and coherent.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: seungrokj <seungrok.jung@amd.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment /ci run for upstream CI or /amd-ci run for AMD CI only whenever CI signals are needed.

Once the PR is approved or has the ready label, the PR author can also use the corresponding /ci run, /ci retry, and /ci cancel commands, or their /amd-ci variants. New commits do not start upstream CI automatically.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nvidia rocm Related to AMD ROCm

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant