Skip to main content

fits_shared_memory

Function fits_shared_memory 

Source
pub fn fits_shared_memory(
    kernel: &'static str,
    requested: usize,
    limits: &GpuLimits,
) -> Result<(), CubeclUtilsErrors>
Expand description

Check a kernel’s shared-memory footprint against the device budget.

Over-allocating shared memory is silent: the kernel does no work, writes nothing, and reports no error. Anything whose SharedMemory::new argument depends on a user-facing parameter (a neighbour count, an embedding dimensionality, a graph degree) needs this before the launch.

§Params

  • kernel - Kernel name, for the error message only
  • requested - Total bytes the kernel’s shared allocations add up to
  • limits - Device limits from GpuLimits::from_client

§Returns

Ok(()) when it fits, SharedMemoryExceeded otherwise.