pack_kernel_args

Function pack_kernel_args 

Source
pub fn pack_kernel_args(args: &[KernelArg<'_>]) -> (Vec<u64>, Vec<usize>)
Expand description

Pack typed args into u64 slots, returning the slots and each argument’s STARTING slot index.

Slots are u64-granular, but an argument is NOT limited to one slot: a by-value struct parameter (CUtensorMap is 128 bytes) occupies ceil(len/8) CONSECUTIVE slots and contributes exactly ONE entry to the param array, pointing at the first.

★ The packing this replaces was let n = b.len().min(8) — anything wider was TRUNCATED TO ITS FIRST 8 BYTES AND LAUNCHED, with no error. Nothing passed more than 8 bytes yet, so it never fired; the first caller that did would have got a kernel reading garbage out of a struct parameter and no diagnostic anywhere. Silent truncation is not an acceptable failure mode on the launch path, so this is a free function with its own tests rather than eight lines buried in a default trait method.