In this article
Cross-stream capture forms a dependency graph; every captured branch must rejoin the origin before ending capture.
A second stream changes the capture problem
A preprocessing stage and a model stage may originally execute in a single CUDA stream. Moving independent work to another stream creates a dependency-design problem when that sequence is captured into a graph. Wrapping the original stream in begin/end calls does not automatically explain the lifetime of the new branch.
The CUDA Graphs guide describes capture as construction of graph nodes rather than immediate execution of the captured work. Read stream events in that context.
A captured event can introduce a branch
An event recorded in a capturing stream represents dependencies within the capture graph. Waiting for that event in another stream can bring the waiting stream into the same capture. Subsequent operations then acquire the relevant dependencies.
The stream API reference supplies the contracts for cudaStreamBeginCapture, cudaStreamWaitEvent, and cudaStreamEndCapture. Maintain explicit names for the origin and branch streams in application code; an arbitrary stream handle is not interchangeable with the origin.
Joining establishes the return path
After the branch work, record an event on that branch and make the origin wait on it. The guide requires streams participating through these event dependencies to rejoin the origin, and capture must end in the stream where it began.
The important object is the dependency path, not host-call proximity. Placing an end-capture call textually after the branch launch does not by itself create the return edge. A missing rejoin can fail capture even if the uncaptured program previously appeared to run correctly.
Inspect the graph that was actually built
The graph management reference documents cudaGraphDebugDotPrint for exporting a graph description. Inspect the expected producer, independent branch, join, and consumer paths before attributing a replay discrepancy to kernel arithmetic.
Topology inspection is a proposed verification step, not proof that a particular application graph was tested here. It complements the capture restrictions guide, which addresses operations that cannot participate in capture.
Separate capture validity from concurrency
A valid fork/join graph describes allowed ordering. It does not guarantee that independent nodes overlap on every GPU or under every resource configuration. A branch may compete for execution resources despite having no dependency edge to its sibling.
Compare captured and uncaptured outputs first, then use the benchmark methodology to evaluate replay behavior. Keep graph creation, instantiation, warm-up, and repeated execution distinguishable so a topology correction is not confused with a performance result.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.