Skip to main content

plan_workgroup_square

Function plan_workgroup_square 

Source
pub fn plan_workgroup_square(
    limits: &Limits,
    preferred_tile: u32,
) -> Workgroup2D
Expand description

Auto-tune a square 2-D workgroup tile for GEMM-style kernels.

Returns the largest power-of-two tile t such that:

  • t <= preferred_tile,
  • t <= max_workgroup_size_x and t <= max_workgroup_size_y, and
  • t * t <= max_invocations_per_workgroup.

For the portable default (256 invocations) this caps the tile at 16 (16 * 16 == 256); a desktop profile (1024) allows 32.