Skip to main content

DLPackCurrentWorkStream

Type Alias DLPackCurrentWorkStream 

Source
pub type DLPackCurrentWorkStream = Option<unsafe extern "C" fn(device_type: DLDeviceType, device_id: i32, out_current_stream: *mut *mut c_void) -> c_int>;
Expand description

\brief Obtain the current work stream of a device.

Obtain the current work stream of a device from the producer framework. For example, it should map to torch.cuda.current_stream in PyTorch.

When device_type is kDLCPU, the consumer do not have to query the stream and the producer can simply return NULL when queried. The consumer do not have to do anything on stream sync or setting. So CPU only framework can just provide a dummy implementation that always set out_current_stream[0] to NULL.

\param device_type The device type. \param device_id The device id. \param out_current_stream The output current work stream.

\return 0 on success, -1 on failure with a Python exception set. \note - As a C function, must not thrown C++ exceptions.

\sa DLPackExchangeAPI

Aliased Type§

pub enum DLPackCurrentWorkStream {
    None,
    Some(unsafe extern "C" fn(DLDeviceType, i32, *mut *mut c_void) -> i32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(DLDeviceType, i32, *mut *mut c_void) -> i32)

Some value of type T.