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 struct
TileScheduler
struct TileScheduler[group_offsets_origin: ImmOrigin, offsets_layout: Layout, //, *, static_MN: Int, tile_shape: IndexList[Int(3)], cluster: IndexList[Int(3)] = Index[Int, Int, Int](Int(1), Int(1), Int(1)), cta_group: Int = Int(1), swizzle: Bool = False, swapAB: Bool = True]
Schedules output tiles across CTAs for a persistent grouped matmul kernel.
Parametersβ
- βgroup_offsets_origin (
ImmOrigin): Memory origin ofgroup_offsets(inferred). - βoffsets_layout (
Layout): Memory layout ofgroup_offsets(inferred). - βstatic_MN (
Int): Size of the static (non-reducing) output dimension. WhenswapABis true this is M, otherwise N. - βtile_shape (
IndexList[Int(3)]): Per-tile shape(M, N, K)of output tiles in the original non-swapped AB orientation. - βcluster (
IndexList[Int(3)]): CTA cluster multicast shape(M, N, K). Only the M dimension is supported;cluster[1]andcluster[2]must be 1. - βcta_group (
Int): CTAs cooperating per tile group along M. Must equalcluster[0]. - βswizzle (
Bool): Whether to swizzle block indices for improved L2 reuse. - βswapAB (
Bool): Whether to swap A and B operands. When true, the static dimension is M; when false, it is N.
Fieldsβ
- βnum_active_experts (
Int): - βgroup_offsets (
LayoutTensor[DType.uint32, offsets_layout, group_offsets_origin]): - βcurrent_iter (
Int32): - βcurrent_group_idx (
UInt32): - βcurrent_dynamic_dim_cumsum (
UInt32): - βblock_idx_start (
UInt32):
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
cta_group_tile_shapeβ
comptime cta_group_tile_shape = Index[Int, Int](Int((mul tile_shape[Int(0)], cta_group)), Int((mul tile_shape[Int(1)], cta_group)))
div_dynamic_blockβ
comptime div_dynamic_block = FastDiv(Index[Int, Int](Int((mul tile_shape[Int(0)], cta_group)), Int((mul tile_shape[Int(1)], cta_group)))[Int(1) if swapAB else Int(0)])
dynamic_dimβ
comptime dynamic_dim = Int(1) if swapAB else Int(0)
kNum1DBlocksPerGroupβ
comptime kNum1DBlocksPerGroup = UInt32(16)
num_static_dim_blocksβ
comptime num_static_dim_blocks = SIMD(ceildiv(static_MN, tile_shape[Int(0) if swapAB else Int(1)]))
static_dimβ
comptime static_dim = Int(0) if swapAB else Int(1)
Methodsβ
__init__β
def __init__(num_active_experts: Int, group_offsets: LayoutTensor[DType.uint32, offsets_layout, group_offsets_origin]) -> Self
fetch_next_workβ
def fetch_next_work(mut self) -> WorkInfo
Returns:
WorkInfo
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!