For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
attn_tmem_addr
def attn_tmem_addr[cluster_size: Int]() -> UInt32
Returns the TMEM base, 0, as a value ptxas cannot fold.
A literal 0 makes ptxas rebuild every TMEM operand per tcgen05.mma (an
IMAD.MOV plus an R2UR per use) instead of keeping one uniform
register; inline asm cannot hide it, since ptxas folds the PTX immediate.
A CTA's cluster rank is below cluster_size, so shifting it right by
log2_ceil(cluster_size) is a run-time 0 that costs an S2R and a shift.
Inline asm hides the rank from LLVM, which folds cluster.ctarank to 0
under nvvm.cluster_dim = (1, 1, 1), and ptxas folds neither the rank
nor the shift. %cluster_ctaid.y is also 0 in these 1-D clusters, but
ptxas computes it as %ctaid.y modulo the cluster shape: three
constant-bank loads and a reciprocal division.
Parameters:
- cluster_size (
Int): CTAs per cluster, or 1 when launched without a cluster.
Returns: