pub struct KernelLaunch<'a> { /* private fields */ }Expand description
Builder for type-safe kernel launches across CUDA + Metal.
Accumulates grid dimensions, block dimensions, and typed kernel
arguments. launch() packages the args as &[KernelArg] and
calls GpuBackend::launch_typed.
Implementations§
Source§impl<'a> KernelLaunch<'a>
impl<'a> KernelLaunch<'a>
pub fn new(gpu: &'a dyn GpuBackend, kernel: KernelHandle) -> Self
pub fn grid(self, grid: [u32; 3]) -> Self
pub fn block(self, block: [u32; 3]) -> Self
Sourcepub fn arg_tensormap(self, map: &[u8; 128]) -> Self
pub fn arg_tensormap(self, map: &[u8; 128]) -> Self
Add a 128-byte CUtensorMap by value, for a kernel parameter declared
__grid_constant__ const CUtensorMap.
TMA descriptors are the one argument on this path that is not
pointer-or-scalar sized: the driver copies all 128 bytes into the
parameter buffer, so the bytes must land in ceil(128/8) = 16
CONSECUTIVE slots contributing ONE param entry. See
gpu::pack_kernel_args, and a_128_byte_arg_is_not_truncated.
Sourcepub fn launch(self, stream: u64) -> Result<()>
pub fn launch(self, stream: u64) -> Result<()>
Execute the kernel launch via GpuBackend::launch_typed.
Builds a typed KernelArg slice from the recorded storage +
kinds. The cuda backend’s default launch_typed flattens this
back into the legacy void** shape; the metal backend
overrides launch_typed to use setBuffer: / setBytes: per
arg. The storage vec is not reallocated between building the
args and launching, so all byte slices remain valid.