Skip to content
KernelIndex
Search⌘K

submission 639201

Amank-root · python · License unknown

Use it

Vendorable · source mirrored · license unknownView source →

No package. Vendor the mirrored source: 51 lines, June 9 Researcher Reciprocity License v1.0.

submission.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-amd-mxfp4-mm-639201?include=source"
interfacepython
Compatibility
measured onAMD Instinct MI355X
declared hardwareAMD Instinct MI355X
architecturesgfx950
dtypesbf16, mxfp4

Benchmark evidence

1 measurement across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
AMD MXFP4 GEMMsuite of 6 cases
AMD Instinct MI355X
24.2µs
#966 of 1143
2026-03-26

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:ea476ef6bcc7d46e29fd697d7181e67614c907842d004e270426489dfd045d7d
license declaredunknown
license concludedunknown
authorsAmank-root
imported2026-08-26

Techniques

Extracted from the mirrored source by pattern, never inferred. Each row cites its line.

fp4Optimized amd-mxfp4-mm kernel wrapper.

Kernel source

submission.py51 lines
"""
Optimized amd-mxfp4-mm kernel wrapper.

Flow: bf16 A, MXFP4 B -> MXFP4 per-1x32 quant A -> gemm_a4w4 -> bf16 C.
"""
from __future__ import annotations

from typing import Tuple

import torch
import aiter
from aiter import dtypes
from aiter.ops.triton.quant import dynamic_mxfp4_quant
from aiter.utility.fp4_utils import e8m0_shuffle

from task import input_t, output_t
# from utils import make_match_reference

def _quant_mxfp4_per_1x32_shuffled(x: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
    """
    Quantize bf16 -> MXFP4 per-1x32 and shuffle scales for GEMM.

    Returns:
        (x_fp4x2, x_scale_sh) as aiter dtypes.
    """
    x_fp4, x_scale = dynamic_mxfp4_quant(x)
    x_scale_sh = e8m0_shuffle(x_scale)
    return x_fp4.view(dtypes.fp4x2), x_scale_sh.view(dtypes.fp8_e8m0)


def custom_kernel(data: input_t) -> output_t:
    """
    Optimized path: quantize A once, use pre-shuffled B and scales.
    """
    A, _B, _B_q, B_shuffle, B_scale_sh = data
    A = A.contiguous()

    A_q, A_scale_sh = _quant_mxfp4_per_1x32_shuffled(A)

    return aiter.gemm_a4w4(
        A_q,
        B_shuffle,
        A_scale_sh,
        B_scale_sh,
        dtype=dtypes.bf16,
        bpreshuffle=True,
    )



scrolls · 51 lines total

Source code from GPU Mode and the KernelBot dataset · June 9 Researcher Reciprocity License v1.0

Best evidence level for this revision: reported

JSON