IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Mojo struct

Struct_moe_gather_quantize_dynamic_block_scaled

struct Struct_moe_gather_quantize_dynamic_block_scaled

Registers the mo.moe.gather.quantize.dynamic.block.scaled graph op with the graph compiler.

Implemented traits​

AnyType, Deinitable, Movable

Methods​

execute​

static def execute[SF_VECTOR_SIZE: Int, TOPK: Int](output: T, scales: T, input: T, token_expert_order: T, context: DeviceContext)

Gathers and quantizes MoE-sorted rows to MXFP8 in one launch.

Sorted row p reads source token row token_expert_order[p] // TOPK from the bf16 input and quantizes it as mo.quantize.dynamic.block.scaled does on AMD CDNA4, producing byte-identical payload and scale rows.

Args:

  • ​output (T): [P, K] float8_e4m3fn, one row per sorted slot.
  • ​scales (T): [P, K // SF_VECTOR_SIZE] float8_e8m0fnu block scales, row-major.
  • ​input (T): [M, K] bfloat16 activations, one row per token.
  • ​token_expert_order (T): moe_create_indices's [P] uint32 order, with P == M * TOPK.
  • ​context (DeviceContext): The device context.

Was this page helpful?