Skip to main content

checked_cube_count

Function checked_cube_count 

Source
pub fn checked_cube_count(
    kernel: &'static str,
    x: u32,
    y: u32,
    z: u32,
    limits: &GpuLimits,
) -> Result<CubeCount, CubeclUtilsErrors>
Expand description

Build a static cube count, checked against the device’s per-dimension limit.

A dispatch that busts the limit is not a soft failure. The launch is rejected on the CubeCL server thread, that thread dies, and every subsequent call on the client returns an unrelated CallError from somewhere else entirely. Catching it here turns that into a typed error naming the kernel.

§Params

  • kernel - Kernel name, for the error message only
  • x - Requested cubes along x
  • y - Requested cubes along y
  • z - Requested cubes along z
  • limits - Device limits from GpuLimits::from_client

§Returns

CubeCount::Static(x, y, z), or CubeCountExceeded if any dimension is over the device limit.