Skip to main content

spawnable

Function spawnable 

Source
pub fn spawnable(
    hardware: &HardwareProperties,
    cube_dim: CubeDim,
    cube_count: &CubeCount,
) -> Result<(), Refusal>
Expand description

Whether a device of hardware spawns cube_count cubes of cube_dim units, or the Refusal saying why not.

Three caps, and a launch clears all of them: the cube’s unit product, the cube’s per-axis shape, and the grid’s per-axis extent. Checking only the product passes a cube legal in size and illegal in shape: a CPU runtime reports its core count on every axis, and a cube of many planes overruns max_cube_dim.1 long before the product notices.

A zero axis is no launch rather than a small grid: cubecl’s CUDA server returns before dispatching one, so the outputs keep what they held and the call is timed as though it ran. A dynamic count lives on the device, and the kernel reading one owns its bound.