Skip to content
KernelIndex
Search⌘K

submission 677065

Anny-hudi · python · License unknown

Use it

Vendorable · source mirrored · license unknownView source →

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

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

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:687ec324940df0a0f77a34f646e1c72ebaeb42011942a1350f2acf1db494b92a
license declaredunknown
license concludedunknown
authorsAnny-hudi
imported2026-08-26

Kernel source

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

"""
优化版本2:条件性 contiguous() + 减少重复导入

优化点:
1. 只在必要时调用 contiguous()
2. 将导入移到函数外部(避免每次调用都导入)
3. 内联量化函数(减少函数调用开销)

预期提升:5-12%(比 v1 更好)
"""
import aiter
from aiter import QuantType, 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


def custom_kernel(data: input_t) -> output_t:
    """
    Optimized: Conditional contiguous() + reduced overhead.
    """
    A, B, B_q, B_shuffle, B_scale_sh = data
    
    # 🔥 优化1: 条件性 contiguous()
    # 只在必要时才调用,避免不必要的内存拷贝
    if not A.is_contiguous():
        A = A.contiguous()
    if not B.is_contiguous():
        B = B.contiguous()
    
    # 🔥 优化2: 内联量化逻辑,减少函数调用开销
    A_fp4, A_scale_raw = dynamic_mxfp4_quant(A)
    A_scale_sh = e8m0_shuffle(A_scale_raw)
    A_q = A_fp4.view(dtypes.fp4x2)
    A_scale_sh = A_scale_sh.view(dtypes.fp8_e8m0)
    
    out_gemm = aiter.gemm_a4w4(
        A_q,
        B_shuffle,
        A_scale_sh,
        B_scale_sh,
        dtype=dtypes.bf16,
        bpreshuffle=True,
    )
    return out_gemm
scrolls · 49 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