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()withCU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED. Likewise support for CIG streams with Vulkan can be determined usingdevice_get_attribute()withCU_DEVICE_ATTRIBUTE_VULKAN_CIG_STREAMS_SUPPORTED. Begin CIG (CUDA in Graphics) capture onh_streamfor the graphics API as provided instream_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 ifstreamis 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 andCUDA_ERROR_INVALID_CONTEXTwill be returned. Data from the graphics client can be shared with CUDA via thestreamSharedDatainstream_cig_capture_params. The format ofsharedDatais dependent on the type of the graphics client. For D3D12,sharedDatais an ID3D12CommandList object pointer. For Vulkan,sharedDatais 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 tocuStreamEndCaptureToCigis 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 tocuStreamBeginCapturewith theCU_STREAM_CAPTURE_MODE_RELAXEDoption. 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:cuLaunchHostFunccuStreamAddCallbackcuStreamSynchronizecuStreamWaitValue32cuStreamWaitValue64cuStreamBatchMemOpcuStreamBeginCapturecuStreamBeginCaptureToGraphcuMemAllocAsynccuMemFreeAsync.- 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