pub enum KernelArg<'a> {
Buffer(DevicePtr),
Bytes(&'a [u8]),
}Expand description
Typed kernel argument, used by launch_typed.
CUDA’s cuLaunchKernel is type-blind — every arg is void* and the
driver interprets bytes by kernel signature. Metal’s
MTLComputeCommandEncoder is not: buffer arguments require
setBuffer:offset:atIndex: (the encoder tracks the resource) while
scalar/struct args require setBytes:length:atIndex:. KernelArg
preserves that distinction so both backends can dispatch correctly.
Variants§
Buffer(DevicePtr)
A device buffer at this base GPU address. The metal backend
resolves it to its owning MTLBuffer + offset via the alloc
registry; the cuda backend forwards the raw u64 to the driver.
Bytes(&'a [u8])
Inline scalar/struct bytes, e.g. a u32 count or an f32 eps.
Length is forwarded to Metal’s setBytes:length:; the cuda
backend zero-pads up to 8 bytes per slot.