xnn.common.models.fast.graph_capture#

xnn.common.models.fast.graph_capture(graph, **kwargs)[source]#

torch.cuda.graph(graph, **kwargs) (pool, stream, capture_error_mode) with the cuBLAS workspaces cleared before and after the recording.

cuBLAS keeps a workspace per handle and stream, made at its first use and kept. Cleared, a workspace that the recording needs is made in the graph’s memory pool and lives as long as the graph. A workspace kept from elsewhere (from launches, or from another graph’s pool) could be freed while the graph still wrote into it: every recording starts by releasing the allocator’s free memory, so a later recording or launch could reuse it. A workspace made in the pool must not serve launches outside the graph either.

Parameters:

graph (CUDAGraph)

Return type:

Iterator[None]