feat(graph): T99.1.2 mark Gemma4PLECombinedProducer non-capturable#92
Merged
feat(graph): T99.1.2 mark Gemma4PLECombinedProducer non-capturable#92
Conversation
Gemma4PLECombinedProducer performs a CPU-side gather over the shared PLE embedding table and then calls MulScalar on the freshly-allocated CPUStorage tensor. Inside a CUDA graph capture stream this triggers a synchronous H2D cudaMemcpy that CUDA rejects with "operation would make the legacy stream depend on a capturing blocking stream". Add the op to nonCapturableOps so the producer runs in pre-capture on every forward, outside the capturing stream. The producer runs once per forward pass before the transformer loop, so this placement keeps the layer-body capture region intact. Companion change in zerfoo/inference/gemma4_edge_ple_nodes.go (E99 T99.1.2) pre-slices the producer's outputs into stable GPU buffers so pleSliceNode stays fully capturable. Decision recorded in zerfoo/docs/adr/088-gemma4-ple-cuda-graph-capture.md.
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
Gemma4PLECombinedProducertononCapturableOpsingraph/cuda_graph.go.that path runs with
ZERFOO_DISABLE_CUDA_GRAPH=1because the producer'sCPU embedding gather plus
MulScalaron the fresh CPUStorage tensortriggers a synchronous H2D cudaMemcpy that CUDA rejects inside a capturing
stream.
outputs into stable per-layer GPU buffers so
pleSliceNodestays fullycapturable; that PR will follow.
Rationale
The producer runs once per forward pass before the transformer loop, so placing
it in pre-capture leaves the layer-body capture region intact. Alternative
approaches (pure GPU gather kernel; node-level
CanCaptureinterface) wererejected for scope -- see
zerfoo/docs/adr/088-gemma4-ple-cuda-graph-capture.md.Test plan
go test ./graph/-- passgo build ./...-- pass(tracked as E99 T99.1.3 in zerfoo/docs/plan.md).
Refs: zerfoo E99 (T99.1.1 / T99.1.2), ADR-088.