Function offload

const fn offload<F, T: crate::marker::Tuple, R>(f: F, workgroup_dim: [u32; 3], thread_dim: [u32; 3], args: T) -> R

Generates the LLVM body of a wrapper function to offload a kernel f.

Type Parameters:

Arguments:

Example usage (pseudocode):

fn kernel(x: *mut [f64; 128]) {
    core::intrinsics::offload(kernel_1, [256, 1, 1], [32, 1, 1], (x,))
}

#[cfg(target_os = "linux")]
extern "C" {
    pub fn kernel_1(array_b: *mut [f64; 128]);
}

#[cfg(not(target_os = "linux"))]
#[rustc_offload_kernel]
extern "gpu-kernel" fn kernel_1(x: *mut [f64; 128]) {
    unsafe { (*x)[0] = 21.0 };
}

For reference, see the Clang documentation on offloading: https://clang.llvm.org/docs/OffloadingDesign.html.