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

padded_depth

def padded_depth[dtype: DType, swizzle_mode: TensorMapSwizzle, depth: Int]() -> Int

Aligns depth up to the nearest multiple of the swizzle granularity.

The returned depth is the smallest value greater than or equal to depth that is evenly divisible by swizzle_granularity[dtype, swizzle_mode], ensuring the inner dimension satisfies TMA swizzle alignment requirements.

Parameters:

  • โ€‹dtype (DType): The element dtype used to convert the swizzle byte width into an element-count granularity.
  • โ€‹swizzle_mode (TensorMapSwizzle): The TMA swizzle mode whose byte width determines the alignment granularity.
  • โ€‹depth (Int): The inner-dimension depth in elements to align upward.

Returns:

Int