[Bugfix] Bound KV block zeroing launch geometry - #52058
Conversation
Use a three-dimensional grid and masked wide chunks so hybrid KV page sizes cannot overflow the launch dimensions or collapse all zeroing work to four-element programs. Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
/ci run |
|
✅ Triggered Buildkite CI #83624 for commit |
Pull request was converted to draft
|
Independently reproduced the engine-killing overflow on 8×MI325X (gfx942) serving |
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com> (cherry picked from commit 79f3183)
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com> (cherry picked from commit 79f3183)
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com> (cherry picked from commit 79f3183)
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com> (cherry picked from commit 79f3183)
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com>
Purpose
Fix the
KVBlockZeroerlaunch overflow reproduced onmainnightly #83443, at commit3e372c5ff2:DeepSeek-V4 combines 181 KV segments with 9,344- and 292-element pages. The old zeroer selected the largest common power-of-two divisor, so the 292-element page forced every segment to use four-element chunks. Zeroing 6,870 blocks therefore flattened to:
That overflows the signed launch dimension passed by the NVIDIA wrapper.
This change:
(6,870, 181, 10), or 12,434,700 programs (233.6x fewer);The H100/H200
sm90_paged_mqa_logits_metadatafailures from the same CI build were separate. They are already fixed on currentmainby #52035; its exact 4xH100 KV-offload job passed both DeepSeek-V4 cases (2 passed).Duplicate-work check
Required open PR/issue searches were run for
KVBlockZeroer overflow,KV block zeroing grid, andsigned integer zeroing.#50485 also proposes a 3-D grid, but this is materially different:
Test plan and results
An exact-shape B200 validation launched grid
(6870, 181, 10), zeroed all storage, and completed in 0.334 seconds.No model eval was run because this only changes how already-selected KV-cache bytes are zeroed, not model outputs or scheduling semantics.
Disclosure
AI assistance (OpenAI Codex) was used to investigate the CI history, develop the change, and draft this description. reviewed by the submitter
Breaking PR and overlap
The failure became reachable after #51749 generalized worker-side KV zeroing to every allocating
AttentionSpec. That change is needed to prevent stale FP8 sliding-window pages; it exposed a pre-existing launch-geometry scaling bug when DeepSeek-V4 contributes many heterogeneous segments.#52062 addresses the same observed overflow by reverting #51749. This PR is materially different: it preserves generalized zeroing and bounds the kernel launch using a 3-D grid plus masked wide chunks, fixing the overflow without restoring the stale-cache bug that #51749 corrected.