Skip to main content

Mojo struct

BlockwiseFP8Smem

struct BlockwiseFP8Smem[a_type: DType, b_type: DType, c_type: DType, a_scales_type: DType, transpose_b: Bool, *, config: MatmulConfig[a_type, b_type, c_type, transpose_b]]

SMEM struct for blockwise FP8 matmul: A/B tiles, A-scales, C output, barriers.

Key differences from BlockScaledSmem:

  • A-scales stored in SMEM (1D: 1 x BM per pipeline stage)
  • No B-scales in SMEM (read from global memory during epilogue)
  • Used with register-based accumulation pattern

Fields

  • tiles (BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Tiles):
  • pipelines (BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Pipelines):

Implemented traits

AnyType, ImplicitlyDestructible

comptime members

__del__is_trivial

comptime __del__is_trivial = True

a_scales_smem_layout

comptime a_scales_smem_layout = Layout.row_major(1, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BM)

a_smem_layout

comptime a_smem_layout = BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Layouts.a_smem_layout

AScalesTileArray

comptime AScalesTileArray = BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Tiles.AScalesTileArray

ATileArray

comptime ATileArray = BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Tiles.ATileArray

b_smem_layout

comptime b_smem_layout = BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Layouts.b_smem_layout

BK

comptime BK = config.block_tile_shape.__getitem__[Int](2)

BM

comptime BM = config.block_tile_shape.__getitem__[Int](0)

BN

comptime BN = config.block_tile_shape.__getitem__[Int](1)

BTileArray

comptime BTileArray = BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Tiles.BTileArray

c_smem_layout

comptime c_smem_layout = BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Layouts.c_smem_layout

CTileArray

comptime CTileArray = BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].Tiles.CTileArray

Layouts

comptime Layouts = SmemLayouts[a_type, b_type, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BM, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BN, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BK, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].OutputM, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].OutputN, config.a_swizzle, config.b_swizzle, transpose_b]

MMA_M

comptime MMA_M = config.mma_shape.__getitem__[Int](0)

MMA_N

comptime MMA_N = config.mma_shape.__getitem__[Int](1)

num_accum_pipeline_stages

comptime num_accum_pipeline_stages = config.num_accum_pipeline_stages

num_clc_pipeline_stages

comptime num_clc_pipeline_stages = config.num_clc_pipeline_stages

num_group_pipeline_stages

comptime num_group_pipeline_stages = (BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].num_pipeline_stages // config)

num_output_stages

comptime num_output_stages = config.num_output_stages

num_pipeline_stages

comptime num_pipeline_stages = config.num_pipeline_stages

OutputM

comptime OutputM = config.output_tile_shape.__getitem__[Int](0)

OutputN

comptime OutputN = config.output_tile_shape.__getitem__[Int](1)

Pipelines

comptime Pipelines = SmemPipelineBundle[BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].num_group_pipeline_stages, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].num_accum_pipeline_stages, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].num_clc_pipeline_stages, BlockwiseFP8TilePayload[a_type, b_type, a_scales_type, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BM, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BK, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BN, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BK, 1, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BM, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].num_pipeline_stages]]

Tiles

comptime Tiles = BlockwiseFP8TileStorage[a_type, b_type, c_type, a_scales_type, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BM, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BK, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BN, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BK, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].OutputM, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].OutputN, 1, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BM, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].num_pipeline_stages, BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].num_output_stages]

Methods

a_tiles

a_tiles(ref[AddressSpace._value._mlir_value] self) -> BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].ATileArray

Get A tile array accessor.

Returns:

BlockwiseFP8Smem

b_tiles

b_tiles(ref[AddressSpace._value._mlir_value] self) -> BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].BTileArray

Get B tile array accessor.

Returns:

BlockwiseFP8Smem

c_tiles

c_tiles(ref[AddressSpace._value._mlir_value] self) -> BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].CTileArray

Get C tile array accessor.

Returns:

BlockwiseFP8Smem

a_scales_tiles

a_scales_tiles(ref[AddressSpace._value._mlir_value] self) -> BlockwiseFP8Smem[a_type, b_type, c_type, a_scales_type, transpose_b, config=config].AScalesTileArray

Get A-scales tile array accessor.

Returns:

BlockwiseFP8Smem

ab_pipeline_size

static ab_pipeline_size() -> Int

Total size of A+B tiles for all pipeline stages (in elements).

Returns:

Int

a_scales_pipeline_size

static a_scales_pipeline_size() -> Int

Total size of A-scales tiles for all pipeline stages (in elements).

Returns:

Int

c_output_size

static c_output_size() -> Int

Size of C tiles for all output stages (in elements).

Returns:

Int

total_tile_size

static total_tile_size() -> Int

Total tile storage size (A+B+A-scales+C) in elements.

Returns:

Int

Was this page helpful?