IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

clusters_per_wave

def clusters_per_wave[cluster_size: Int, sm_count: Int]() -> Int

Number of size-cluster_size thread-block clusters that fit on the target Blackwell datacenter GPU in ONE wave, honoring GPC co-residency.

A cluster's CTAs must all live inside a single GPC, so a size-C cluster occupies C SMs within one GPC and only floor(gpc_sm / C) such clusters fit per GPC. The usable count is therefore below the flat sm_count / C; it is the per-GPC histogram sum_g floor(gpc_sm[g] / C). GPC layout is not queryable (neither DeviceAttribute nor GPUInfo exposes it), so it is hardcoded per chip; the whole expression folds at comptime since both parameters are comptime.

B200 (148 SMs) has 11 GPCs with an irregular layout -- three 20s, four 18s, one 10, three 2s (2x the pair counts 10,10,10,9,9,9,9,5,1,1,1). B300 / Blackwell Ultra (160 SMs) is the full die with 8 GPCs of a UNIFORM 20 SMs each, so the histogram collapses to 8 * (20 // C).

Non-increasing in cluster_size, so scanning candidate sizes largest-first yields the largest that fits. Only B200 (148) and B300 (160) are modeled; the else branch is a comptime error on any other chip.

Returns:

Int

Was this page helpful?