Skip to main content

define_kernel

Function define_kernel 

Source
pub fn define_kernel<K: CubeKernel + ?Sized>(
    kernel: &K,
) -> Result<KernelDefinition, CompilationError>
Expand description

kernel’s definition, or the panic its expansion raised, as a CompilationError.

Expansion runs the kernel’s own code, every assertion in it included, and a backend runs it on the device thread inside a launch nobody waits on. A panic there is caught by the device channel and only logged: the launch returns, its outputs are never written, and nothing marks them, so a later read hands back whatever the memory held before. As a CompilationError the panic takes the path a compiler’s refusal takes, and the outputs carry the failure to whoever reads them; as ExpansionPanicked it is not a refusal, so a harness that skips refused kernels reports it instead.