Skip to main content

handle_with

Function handle_with 

Source
pub unsafe fn handle_with(
    call_frame: *mut XLA_FFI_CallFrame,
    memory: Memory,
    body: impl FnOnce(&FfiAttrs, &[FfiBuffer], &mut [FfiBuffer]) -> Result<(), String>,
) -> *mut XLA_FFI_Error
Expand description

handle with the call’s attributes, for buffers in memory.

With Memory::Cuda, the body sees host copies of the device buffers, so the same body serves handlers registered for the host and for CUDA devices (at the cost of the copies and of a synchronization).

§Safety

call_frame must be the pointer XLA passed to the handler, whose buffers are in memory.