warp.get_cuda_max_cluster_dim#

warp.get_cuda_max_cluster_dim(
kernel,
device=None,
*,
block_dim=None,
dynamic_smem_bytes=0,
)[source]#

Return the maximum cluster_dim kernel can launch with on device.

Probes the CUDA driver via cuOccupancyMaxActiveClusters for cluster sizes from 16 down to 2 and returns the largest one the driver reports as launchable. The result reflects actual hardware capability: integrated Hopper+ SoCs (NVIDIA Thor sm_101, DGX Spark sm_121) cap at the portable 8, while Hopper and Blackwell desktop parts typically support 16.

For a plain kernel (no cluster_dim declared) the result is the device’s true cluster limit. For a kernel with cluster_dim declared, the driver only accepts that declared size, so the function returns the declared value when the device supports it, or 1 when it does not.

Parameters:
  • kernel – A @warp.kernel-decorated kernel instance.

  • device (Device | str | None) – Target device. Defaults to the current device.

  • block_dim (int | None) – Threads per block at launch. If None, uses the kernel’s module-resolved block_dim.

  • dynamic_smem_bytes (int) – Dynamic shared memory bytes used at launch.

Returns:

The maximum cluster_dim as a 1D CTA count. Returns 1 on devices with compute capability < 9.0, on non-CUDA devices, and on driver error.

Return type:

int