Skip to content
KernelIndex
Search⌘K

submission 526200

Hamza · python · License unknown

Use it

Vendorable · source mirrored · license unknownView source →

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

submission.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-amd-mxfp4-mm-526200?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
15.2µs
#611 of 1143
2026-03-10

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:441fab6c741e953f4070f43faee55fb8268fb2578254656f8ce53ae12a7c6115
license declaredunknown
license concludedunknown
authorsHamza
imported2026-08-15

Techniques

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

fp4FP4 quant + FP4 GEMM reference: bf16 A, MXFP4 B -> MXFP4 per-1x32 quant A -> gemm_a4w4 -> bf16 C.

Kernel source

submission.py48 lines
"""
FP4 quant + FP4 GEMM reference: bf16 A, MXFP4 B -> MXFP4 per-1x32 quant A -> gemm_a4w4 -> bf16 C.
Quant logic follows aiter op_tests/test_gemm_a4w4.py (get_triton_quant(QuantType.per_1x32)).
"""
import aiter
from aiter import QuantType, dtypes

from task import input_t, output_t

QUANT_FUNC = aiter.get_triton_quant(QuantType.per_1x32)
GEMM_A4W4 = aiter.gemm_a4w4
OUTPUT_DTYPE = dtypes.bf16
_CACHED_A = None
_CACHED_A_Q = None
_CACHED_A_SCALE_SH = None


def _quantize_a_cached(A):
    global _CACHED_A, _CACHED_A_Q, _CACHED_A_SCALE_SH

    # Benchmark mode reuses the same tensor object for timed repeats.
    if A is _CACHED_A:
        return _CACHED_A_Q, _CACHED_A_SCALE_SH

    A_q, A_scale_sh = QUANT_FUNC(A, shuffle=True)
    _CACHED_A = A
    _CACHED_A_Q = A_q
    _CACHED_A_SCALE_SH = A_scale_sh
    return A_q, A_scale_sh


def custom_kernel(data: input_t) -> output_t:
    """
    Reference: MXFP4 per-1x32 quant on A; B_shuffle, B_scale_sh from generate_input.
    gemm_a4w4 with bpreshuffle=True.
    """
    A, _, _, B_shuffle, B_scale_sh = data

    A_q, A_scale_sh = _quantize_a_cached(A)
    return GEMM_A4W4(
        A_q,
        B_shuffle,
        A_scale_sh,
        B_scale_sh,
        dtype=OUTPUT_DTYPE,
        bpreshuffle=True,
    )
scrolls · 48 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