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. Likewise support for CIG streams with Vulkan can be determined using device_get_attribute() with CU_DEVICE_ATTRIBUTE_VULKAN_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/buffer. All kernel launches and memory copy/memory set operations on the CIG stream will be recorded. When the command list/buffer 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/buffer. 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 sharedData is dependent on the type of the graphics client. For D3D12, sharedData is an ID3D12CommandList object pointer. For Vulkan, sharedData is an internal NVIDIA handle obtained via vkGetCommandBufferInternalHandleNV from the VK_NV_internal_handle extension. A VkCommandBuffer cannot be passed directly. The command buffer must be in the recording state whenever kernels are launched on the stream. The command list/buffer provided must belong to a device corresponding to the CIG context’s device, otherwise the behavior will be undefined. The stream object may not be destroyed until its associated command list/buffer has finished executing on the GPU. The 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/pipeline barriers on the command list/buffer prior to recording work that accesses them on the stream. Resubmission of the same recorded command list/buffer 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