You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CUDA 13.3 adds cuStreamBeginRecaptureToGraph(CUstream hStream, CUstreamCaptureMode mode, CUgraph hGraph, CUgraphRecaptureCallback callbackFunc, void* userData):
begin a stream capture that re-captures into an existing graph instead of creating a new
one. The registered callback receives, per recaptured node, (void* data, CUgraphNode node, const CUgraphNodeParams* originalParams, const CUgraphNodeParams* recaptureParams, CUgraphRecaptureStatus status)
with status CU_GRAPH_RECAPTURE_{ELIGIBLE_FOR_UPDATE,INELIGIBLE_FOR_UPDATE,ERROR} (exact
invocation semantics to be confirmed against the 13.3 driver docs during design). Failures
surface as the new CUDA_ERROR_GRAPH_RECAPTURE_FAILURE.
This is update-by-recapture: rerun the capture-producing code and let the driver map it onto
the existing graph — complementing the setter-based node updates of #2352 / #2354 and the
general graph-updates task #1330. cuda.core's graph support is capture-based
(GraphBuilder), so this slots in naturally.
Starting point only, not a settled design — review in the cuda.core design meeting.
gb=graph.recapture(stream, mode="global") # names TBD; wraps cuStreamBeginRecaptureToGraphlaunch(stream, config, kernel, new_args) # replay the capture regiongb.end() # graph updated in place
Graph construction is the one flow where cuda.core deliberately uses a builder, so returning a
(re)capture-scoped GraphBuilder mirrors the existing API shape.
Open questions for the meeting:
The C callback fires from within capture — exposing an optional Python hook means calling
back into Python mid-capture (GIL/perf story). Verify whether a NULL callback is accepted
and make the Python hook opt-in.
Should cuda.core collect and report per-node recapture statuses (updated vs. ineligible)
after end()?
Interaction with GraphBuilder's existing capture-state guards (is_…capturing,
conditional handles).
Version gating: 13.3+ only; actionable error otherwise.
Summary
CUDA 13.3 adds
cuStreamBeginRecaptureToGraph(CUstream hStream, CUstreamCaptureMode mode, CUgraph hGraph, CUgraphRecaptureCallback callbackFunc, void* userData):begin a stream capture that re-captures into an existing graph instead of creating a new
one. The registered callback receives, per recaptured node,
(void* data, CUgraphNode node, const CUgraphNodeParams* originalParams, const CUgraphNodeParams* recaptureParams, CUgraphRecaptureStatus status)with status
CU_GRAPH_RECAPTURE_{ELIGIBLE_FOR_UPDATE,INELIGIBLE_FOR_UPDATE,ERROR}(exactinvocation semantics to be confirmed against the 13.3 driver docs during design). Failures
surface as the new
CUDA_ERROR_GRAPH_RECAPTURE_FAILURE.This is update-by-recapture: rerun the capture-producing code and let the driver map it onto
the existing graph — complementing the setter-based node updates of #2352 / #2354 and the
general graph-updates task #1330.
cuda.core's graph support is capture-based(
GraphBuilder), so this slots in naturally.Underlying C APIs to cover
cuStreamBeginRecaptureToGraph(stream, mode, graph, callback, userData)CUgraphCUgraphRecaptureCallbackCUgraphNodeParamsCUgraphRecaptureStatusELIGIBLE_FOR_UPDATE/INELIGIBLE_FOR_UPDATE/ERRORCUDA_ERROR_GRAPH_RECAPTURE_FAILUREDesign sketch (draft — needs design-meeting review)
Important
Starting point only, not a settled design — review in the cuda.core design meeting.
Graph construction is the one flow where cuda.core deliberately uses a builder, so returning a
(re)capture-scoped
GraphBuildermirrors the existing API shape.Open questions for the meeting:
back into Python mid-capture (GIL/perf story). Verify whether a NULL callback is accepted
and make the Python hook opt-in.
after
end()?GraphBuilder's existing capture-state guards (is_…capturing,conditional handles).
References
-- Leo's bot