[ROCm][Perf] Enable CSA multi-stream overlap for DeepSeek-V4 - #51794
Conversation
|
This pull request has merge conflicts that must be resolved before it can be |
796108d to
5f88b24
Compare
48e4031 to
06d206b
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
06d206b to
d314c00
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
79ffd28 to
9301d95
Compare
0e4aade to
ec961e9
Compare
6a0acd4 to
1843b6a
Compare
Signed-off-by: Shanshan Shen <87969357+shen-shanshan@users.noreply.github.com>
1843b6a to
fb2e682
Compare
| Dict metadata marks piecewise cudagraph, whose eager breaks rebuild | ||
| the attention inputs on the owning stream. Forking side streams | ||
| there would rely on runtime HIP event sync, which is unreliable in | ||
| this overlap on ROCm (event waits can hang), so multi-stream only | ||
| runs where the fork/join becomes static graph edges: inside capture, | ||
| or with non-dict metadata (full cudagraph or the profile run), which | ||
| has no eager breaks. |
There was a problem hiding this comment.
QQ: do we still see this issue on the ROCm 10 nightly?
There was a problem hiding this comment.
QQ: do we still see this issue on the ROCm 10 nightly?
Now we need to land this PR both on rocm-7.x and rocm-10.0 (even though the perf gain on rocm-7.x is much smaller), so we still need this guard, since launching multi-stream with eager mode will come across GPU hang issues on rocm-7.x. Haven't get time to test eager multi-stream on rocm-10.0 yet.
|
LGTM! |
|
/ci run |
|
✅ Triggered Buildkite CI #88708 for commit |
| attn_metadata = get_forward_context().attn_metadata | ||
| return ( | ||
| self.aux_stream_list is not None | ||
| and envs.VLLM_ROCM_DSV4_CSA_MULTI_STREAM |
There was a problem hiding this comment.
Let's cache this envs.VLLM_ROCM_DSV4_CSA_MULTI_STREAM value before using it based on #17067
There was a problem hiding this comment.
Let's cache this
envs.VLLM_ROCM_DSV4_CSA_MULTI_STREAMvalue before using it based on #17067
Oh, in fact we plan to make this optimization default on and has removed the env gate. This line is the one that I forget to delete...
|
Full CI passed in https://buildkite.com/vllm/ci/builds/88708/list. |
Signed-off-by: Shanshan Shen <87969357+shen-shanshan@users.noreply.github.com>
|
/ci run |
|
✅ Triggered Buildkite CI #88774 for commit |
|
/ci run |
|
✅ Triggered Buildkite CI #88781 for commit |
…oject#51794) Signed-off-by: shen-shanshan <467638484@qq.com> Signed-off-by: Shanshan Shen <87969357+shen-shanshan@users.noreply.github.com>
…oject#51794) Signed-off-by: shen-shanshan <467638484@qq.com> Signed-off-by: Shanshan Shen <87969357+shen-shanshan@users.noreply.github.com>
Purpose
Enable kernel-level multi-stream overlap for DeepSeek-V4 CSA (Compressed Sparse Attention, compress_ratio=4) attention layers on ROCm. When enabled, the attention forward forks three HIP streams before the input GEMMs:
After the join, the indexer weights GEMM, the indexer q-side (wq_b + fused q rope+quant), the sparse indexer op (top-k selection), and the MLA attention run serially on the main stream. Moving the two compressor wkv_gate GEMMs onto side streams takes them off the serial critical path; each stream runs a self-contained chain straight from
hidden_states, so no fine-grained cross-stream dependencies are required.Trace Comparison (take
conc=4as an example)Before:
After (12.99% faster for CSA layer):
Test Plan
Server launch command:
8k1kworkload.gsm8kdataset.Test Result
Benchmark
Benchmark results based on
nightly-rocm100image:In summary, the PR provides an overall positive performance impact: throughput improves at every concurrency level, TPOT consistently decreases, and TTFT is improved at three out of four concurrency levels. The only notable trade-off is the minor TTFT regression at conc=16.
Accuracy Test
Full GSM8K evaluation on this change (1,319 examples) and both results exceed the required 94% threshold.
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.