cuda.bindings._v2.driver.stream_begin_capture_to_cig#

cuda.bindings._v2.driver.stream_begin_capture_to_cig(
intptr_t h_stream,
stream_cig_capture_params,
)#

Begins capture to CIG on a stream.

Support for CIG streams with D3D12 can be determined using device_get_attribute() with CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED. Begin CIG (CUDA in Graphics) capture on h_stream for the graphics API as provided in stream_cig_capture_params. When a stream is in CIG capture mode, all operations pushed into the stream will not be executed, but will instead be captured into a graphics API command list/command buffer. All kernel launches and memory copy/memory set operations on the CIG stream will be recorded. When the command list is executed by the graphics API, all the stream’s operations will execute in order along with other graphics API commands in the command list. CIG stream capture may not be initiated if stream is CU_STREAM_LEGACY. Capture must be ended on the same stream in which it was initiated, and it may only be initiated if the stream is not already in CIG capture mode. The context must be also created in CIG mode previously, otherwise this operation will fail and CUDA_ERROR_INVALID_CONTEXT will be returned. Data from the graphics client can be shared with CUDA via the streamSharedData in stream_cig_capture_params. The format of streamSharedData is dependent on the type of the graphics client. For D3D12, streamSharedData is an ID3D12CommandList object pointer. The command list must be in ready state for recording commands whenever kernels are launched on the stream. The command list provided must belong to the graphics API device that the CIG context was created with, otherwise the behavior will be undefined. The stream object may not be destroyed until its associated command list has finished executing on the GPU. The command list/command buffer used for capture may not be submitted for execution before a call to cuStreamEndCaptureToCig is made on the associated stream. Graphics resources to be accessed by work recorded on the CIG stream must use UAV barriers on the command list prior to recording work that accesses them on the stream. Resubmission of the same recorded command list is not allowed. Further more, care must be taken for the order of execution of the recorded CUDA work with regards to other CUDA work submitted under the same CIG context. Out-of-order execution can lead to device hangs or exceptions. CIG capture mode operates similarly to cuStreamBeginCapture with the CU_STREAM_CAPTURE_MODE_RELAXED option. There are additional limitations to streams in CIG capture mode. The following functions are not allowed for CIG streams whether directly or indirectly via a recorded graph launch: cuLaunchHostFunc cuStreamAddCallback cuStreamSynchronize cuStreamWaitValue32 cuStreamWaitValue64 cuStreamBatchMemOp cuStreamBeginCapture cuStreamBeginCaptureToGraph cuMemAllocAsync cuMemFreeAsync.

Parameters:
  • h_stream (intptr_t) – Stream in which to initiate capture to CIG.

  • stream_cig_capture_params (intptr_t) – CIG capture parameters.

See also

cuStreamBeginCaptureToCig