[Bugfix] Make _fold_seqlen_indptr cudagraph-safe (avoid scalar H2D copy) - #5202
Conversation
Signed-off-by: Micah Williamson <micah.williamson@amd.com>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
|
Can we ensure any missing CI tests are also added for this issue? they can ofc be vibe coded. |
Signed-off-by: Micah Williamson <micah.williamson@amd.com>
|
@AndreasKaratzas good call, done. |
|
The fix is right. I checked The only hard blocker is one line of formatting. Black wants the two adjacent string literals joined: aiter.logger.info(
- "_fold_seqlen_indptr cuda-graph capture/replay: all passed "
- "(fold_factor=%s)",
+ "_fold_seqlen_indptr cuda-graph capture/replay: all passed " "(fold_factor=%s)",Worth stating the knock-on: On the test itself — most of it cannot fail. Measured on gfx942 (ROCm 7.0, torch 2.9.1), capturing the pre-fix implementation: Every combination raises the same error at the same place, so The replay half is dead for the same reason: the exception fires inside Structure. The call site sits at module top level, while the test it cites as its model keeps everything inside Minor: Comments are 33% of the added block (20 docstring + 7 Suggested shape: one capture, one shape, pass if it doesn't raise — about ten lines — and move the call inside a function rather than running it at import. The capture-safety check is the right instinct; aiter's op_tests are eager-only, which is why this had to surface in vLLM CI instead of here. |
Signed-off-by: Micah Williamson <micah.williamson@amd.com>
|
@zufayu Fixed, thanks! |
Motivation
This PR fixes a bug in
_fold_seqlen_indptr(introduced in #4964) in which the function is not cudagraph safe as it can trigger a H2D transfer.Technical Details
_fold_seqlen_indptrdoes:out[0] = 0is unsafe during cuda graph capture as it can be lowered to an H2D copy, resulting inoperation not permitted when stream is capturing.Test Plan
This was first exposed in vLLM CI when running the following test on MI300
HIP_VISIBLE_DEVICES=0 pytest -v -s tests/v1/e2e/spec_decode/eagle/test_eagle_correctness.py::test_eagle_correctness_light[ROCM_AITER_FA-deepseek_eagle]https://buildkite.com/vllm/amd-ci/builds/12434/list?jid=01a05932-e4b1-4cd7-90df-6cefc7be92f9&tab=output#L1820
Test Result
Test passes with this PR: