Skip to content
KernelIndex
Search⌘K

submission 625855

NHDBL · python · License unknown

Use it

Vendorable · source mirrored · license unknownView source →

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

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

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:dd451f1f3dbd5fd01cba32b91c77fcdb0b70ddbead1af315bf82dad7cabf427c
license declaredunknown
license concludedunknown
authorsNHDBL
imported2026-08-26

Techniques

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

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

Kernel source

submission.py61 lines
#!POPCORN leaderboard amd-mxfp4-mm
#!POPCORN gpu MI355X

"""
FP4 quant + FP4 GEMM: bf16 A, MXFP4 B -> MXFP4 per-1x32 quant A -> gemm_a4w4 -> bf16 C.
Optimized with per-shape CUDA graph caching to eliminate kernel launch overhead.
"""
from task import input_t, output_t

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

# Cache: shape_key -> (graph, static_A, static_B_shuffle, static_B_scale_sh, static_out)
_cache = {}


def custom_kernel(data: input_t) -> output_t:
    A, B, B_q, B_shuffle, B_scale_sh = data
    A = A.contiguous()
    m, k = A.shape
    n = B_shuffle.shape[0]
    key = (m, n, k)

    if key not in _cache:
        static_A = A.clone()
        static_B_shuffle = B_shuffle.clone()
        static_B_scale_sh = B_scale_sh.clone()

        # Warmup (Triton JIT + allocator)
        for _ in range(3):
            A_q, A_scale = dynamic_mxfp4_quant(static_A)
            A_q = A_q.view(dtypes.fp4x2)
            A_scale = e8m0_shuffle(A_scale).view(dtypes.fp8_e8m0)
            _ = aiter.gemm_a4w4(
                A_q, static_B_shuffle, A_scale, static_B_scale_sh,
                dtype=dtypes.bf16, bpreshuffle=True,
            )

        # Capture graph
        graph = torch.cuda.CUDAGraph()
        with torch.cuda.graph(graph):
            A_q, A_scale = dynamic_mxfp4_quant(static_A)
            A_q = A_q.view(dtypes.fp4x2)
            A_scale = e8m0_shuffle(A_scale).view(dtypes.fp8_e8m0)
            static_out = aiter.gemm_a4w4(
                A_q, static_B_shuffle, A_scale, static_B_scale_sh,
                dtype=dtypes.bf16, bpreshuffle=True,
            )

        _cache[key] = (graph, static_A, static_B_shuffle, static_B_scale_sh, static_out)

    graph, static_A, static_B_shuffle, static_B_scale_sh, static_out = _cache[key]
    static_A.copy_(A)
    static_B_shuffle.copy_(B_shuffle)
    static_B_scale_sh.copy_(B_scale_sh)
    graph.replay()
    return static_out
scrolls · 61 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