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_swiglu_quantize_dynamic_block_scaled

struct Struct_swiglu_quantize_dynamic_block_scaled

Registers the quantization.swiglu.quantize.dynamic.block.scaled graph op with the graph compiler.

Implemented traits​

AnyType, Deinitable, Movable

Methods​

execute​

static def execute[SF_VECTOR_SIZE: Int, activation: StaticString, swiglu_alpha: Float32, swiglu_limit: Float32](output: T, scales: T, gate_up: T, tensor_sf: Float32, context: DeviceContext)

Quantizes activation(gate, up) of a [gate | up] input to a block-scaled format.

Parameters:

  • ​SF_VECTOR_SIZE (Int): Elements per block scale.
  • ​activation (StaticString): Activation name, bound from the op's same-named attribute; the activation is built at compile time.
  • ​swiglu_alpha (Float32): The activation's alpha constant.
  • ​swiglu_limit (Float32): The activation's clamp limit.

Args:

  • ​output (T): The quantized activation of shape [M, N] (or N // 2 packed FP4).
  • ​scales (T): The block scales in the 5D TCGEN interleaved layout on SM100/SM120, or rank-2 row-major on AMD CDNA4.
  • ​gate_up (T): The input of shape [M, 2 * N], gate then up.
  • ​tensor_sf (Float32): The tensor-wise scale factor.
  • ​context (DeviceContext): The device context.

Was this page helpful?