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

enqueue_fp4_materialize

def enqueue_fp4_materialize[out_type: DType](out_w: TileTensor[out_type, Storage=out_w.Storage, address_space=out_w.address_space, linear_idx_type=out_w.linear_idx_type], packed: TileTensor[DType.uint8, Storage=packed.Storage, address_space=packed.address_space, linear_idx_type=packed.linear_idx_type], scales: TileTensor[DType.float8_e4m3fn, Storage=scales.Storage, address_space=scales.address_space, linear_idx_type=scales.linear_idx_type], ctx: DeviceContext)

Enqueues fp4_materialize_kernel: packed FP4 + scales -> dense [N, K].

out_w is [N, K], packed is [N, K//2], scales is [N, K//16]. The grid is (ceil(K/16), ceil(N/16)) threadgroups of 16x16 threads; bounds are checked per thread so ragged K/N are fine.

Parameters:

  • ​out_type (DType): Output element dtype (bf16 for the Apple W4A16 path).

Args:

Was this page helpful?