Function offload
pub const fn offload<F, T: Tuple, R>(f: F, workgroup_dim: [u32; 3], thread_dim: [u32; 3], dyn_cache: u32, device_id: i32, args: T) -> R
Generates the LLVM body of a wrapper function to offload a kernel f.
Type Parameters:
F: The kernel to offload. Must be a function item.T: A tuple of arguments passed tof.R: The return type of the kernel.
Arguments:
f: The kernel function to offload.workgroup_dim: A 3D size specifying the number of workgroups to launch.thread_dim: A 3D size specifying the number of threads per workgroup.dyn_cache: The amount of dynamic shared memory to request for the kernel.device_id: The device to offload to. Use-1to select the default device.args: A tuple of arguments forwarded tof.
Example usage (pseudocode):
extern "C"
extern "gpu-kernel"
For reference, see the Clang documentation on offloading: https://clang.llvm.org/docs/OffloadingDesign.html.