[FlyDSL] split-K hgemm: make semaphore/signal workspace CUDA-graph-capture safe - #4715
Draft
xiaohuguo2023 wants to merge 1 commit into
Draft
[FlyDSL] split-K hgemm: make semaphore/signal workspace CUDA-graph-capture safe#4715xiaohuguo2023 wants to merge 1 commit into
xiaohuguo2023 wants to merge 1 commit into
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
xiaohuguo2023
force-pushed
the
xiaohuguo/flydsl-splitk-cudagraph-capture-fix
branch
from
August 21, 2026 11:14
b00cd17 to
a40438c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The FlyDSL split-K GEMM path uses a per-
(device, stream)semaphore/signalworkspace from
_get_split_k_tensors, memoized withfunctools.lru_cacheandzero-initialized once, eagerly. The split-K reduction kernel treats these as
atomic counters: each workgroup decrements as it retires and the "last workgroup"
performs the cross-split reduction, which requires the counters to start at their
zeroed state on every launch.
Under CUDA-graph capture + replay this invariant breaks. The one-time
torch.zeros(...)ran before capture, so it is not recorded as a node in thegraph. On replay the workspace is never re-zeroed, the counters never return to
their initial state, the last-workgroup handshake never re-arms, and the kernel
hangs. This is the same failure mode fixed for the a16w16 ASM GEMM path in
#4494 — this PR applies the same remedy to the FlyDSL split-K path.
Any split-K FlyDSL GEMM captured in a full CUDA graph is affected. In practice it
shows up on skinny decode shapes that select
split_k4–8 (e.g.N=1024/384, K=7168at small M) inside a FULL decode cudagraph.Fix
Mirror #4494:
_get_split_k_tensors_cached(stilllru_cached on(device, stream))._get_split_k_tensors, whentorch.cuda.is_current_stream_capturing()istrue, allocate a fresh, zeroed workspace for that launch so the zero-fill is
recorded as a graph node and re-establishes the initial counter state on every
replay. Distinct captured launches therefore never alias one another's counters.
(
_captured_split_k_keepalive) so the graph-recorded zero-fill always has validbacking storage.
Call sites are unchanged —
_get_split_k_tensors(device, stream)keeps its nameand signature.