Why it matters

Stream capture is standard way to build graphs. Understanding shapes usage.

Advertisement

The architecture

cudaStreamBeginCapture.

Run kernels on stream.

cudaStreamEndCapture returns graph.

Stream capture flowBegin captureon streamLaunch kernelsas normalEnd captureget graphPyTorch offers torch.cuda.graph context manager wrapping this
Stream capture.
Advertisement

How it works end to end

Capture modes: global, thread-local, relaxed.

Cross-stream deps captured.

PyTorch: torch.cuda.graph.