Skip to content
KernelIndex
Search⌘K

gpt-o3 / tritonfc01fa

gpt-o3_triton_fc01fa · gpt-o3 · triton · Apache-2.0

Use it

Vendorable · source mirrored · Apache-2.0View source →

No package. Vendor the mirrored source: 111 lines, Apache-2.0, pinned at da91508.

main.py
curl "https://kernelindex.com/api/v1/implementations/flashinfer-gpt-o3-triton-fc01fa?include=source"
interfacetriton
revisionda915083d4c7
symbolrun
pathmain.py
Compatibility
measured onNVIDIA B200
declared hardwareNVIDIA B200
architecturessm_100
dtypesfp16

Benchmark evidence

43 measurements across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
GEMM n6144 k4096fp16 · [56, 4096]
NVIDIA B200
69.9µs
#3 of 5
2025-10-16
GEMM n6144 k4096fp16 · [35, 4096]
NVIDIA B200
70.2µs
#3 of 5
2025-10-16
GEMM n6144 k4096fp16 · [32, 4096]
NVIDIA B200
70.3µs
#3 of 5
2025-10-16
GEMM n6144 k4096fp16 · [48, 4096]
NVIDIA B200
70.4µs
#3 of 5
2025-10-16
GEMM n6144 k4096fp16 · [24, 4096]
NVIDIA B200
70.4µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [64, 4096]
NVIDIA B200
70.5µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [40, 4096]
NVIDIA B200
70.6µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [15, 4096]
NVIDIA B200
70.8µs
#5 of 6
2025-10-16
GEMM n6144 k4096fp16 · [4, 4096]
NVIDIA B200
70.9µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [16, 4096]
NVIDIA B200
70.9µs
#4 of 5
2025-10-16
Show all 43 measurements ›
GEMM n6144 k4096fp16 · [70, 4096]
NVIDIA B200
71.0µs
#3 of 5
2025-10-16
GEMM n6144 k4096fp16 · [8, 4096]
NVIDIA B200
71.0µs
#5 of 6
2025-10-16
GEMM n6144 k4096fp16 · [7, 4096]
NVIDIA B200
71.1µs
#5 of 6
2025-10-16
GEMM n6144 k4096fp16 · [72, 4096]
NVIDIA B200
71.2µs
#4 of 5
2025-10-16
GEMM n6144 k4096fp16 · [1, 4096]
NVIDIA B200
71.2µs
#5 of 6
2025-10-16
GEMM n6144 k4096fp16 · [80, 4096]
NVIDIA B200
71.2µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [184, 4096]
NVIDIA B200
71.2µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [2, 4096]
NVIDIA B200
71.4µs
#4 of 5
2025-10-16
GEMM n6144 k4096fp16 · [192, 4096]
NVIDIA B200
71.5µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [176, 4096]
NVIDIA B200
71.6µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [160, 4096]
NVIDIA B200
71.6µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [152, 4096]
NVIDIA B200
71.6µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [168, 4096]
NVIDIA B200
71.7µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [144, 4096]
NVIDIA B200
71.7µs
#4 of 5
2025-10-16
GEMM n6144 k4096fp16 · [96, 4096]
NVIDIA B200
71.8µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [88, 4096]
NVIDIA B200
71.8µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [200, 4096]
NVIDIA B200
71.8µs
#5 of 6
2025-10-16
GEMM n6144 k4096fp16 · [136, 4096]
NVIDIA B200
71.9µs
#5 of 6
2025-10-16
GEMM n6144 k4096fp16 · [208, 4096]
NVIDIA B200
71.9µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [216, 4096]
NVIDIA B200
72.0µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [104, 4096]
NVIDIA B200
72.2µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [224, 4096]
NVIDIA B200
72.5µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [112, 4096]
NVIDIA B200
72.8µs
#4 of 5
2025-10-16
GEMM n6144 k4096fp16 · [120, 4096]
NVIDIA B200
72.8µs
#3 of 5
2025-10-16
GEMM n6144 k4096fp16 · [232, 4096]
NVIDIA B200
73.1µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [240, 4096]
NVIDIA B200
73.6µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [248, 4096]
NVIDIA B200
73.6µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [128, 4096]
NVIDIA B200
73.7µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [256, 4096]
NVIDIA B200
73.8µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [972, 4096]
NVIDIA B200
77.7µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [2053, 4096]
NVIDIA B200
137.8µs
#4 of 6
2025-10-16
GEMM n6144 k4096fp16 · [2379, 4096]
NVIDIA B200
186.1µs
#5 of 6
2025-10-16
GEMM n6144 k4096fp16 · [8192, 4096]
NVIDIA B200
513.3µs
#4 of 6
2025-10-16

Reported · How evidence levels are derived →

Source and license

sourcehttps://huggingface.co/datasets/flashinfer-ai/flashinfer-trace
commitda915083d4c7c5e61aa3005e3d17ae488e0fc71c
revision digestsha256:a178934502ffc4577bd679c1e912ac88cf557801d983df9b6ad2143cbac16307
license declaredApache-2.0
license concludedApache-2.0
authorsgpt-o3
imported2026-08-20

Techniques

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

mmaacc += tl.dot(a, b)
num-warps = 8num_warps = 8
tile-k = 32BLOCK_K = 32
tile-m = 128BLOCK_M = 128
tile-n = 128BLOCK_N = 128

Kernel source

main.py111 lines
import math
import torch
import triton
import triton.language as tl


@triton.jit
def _gemm_kernel(
    A_ptr, B_ptr, C_ptr,
    M, N, K,
    stride_am, stride_ak,
    stride_bn, stride_bk,
    stride_cm, stride_cn,
    BLOCK_M: tl.constexpr,
    BLOCK_N: tl.constexpr,
    BLOCK_K: tl.constexpr,
):
    pid_m = tl.program_id(axis=0)
    pid_n = tl.program_id(axis=1)

    offs_m = pid_m * BLOCK_M + tl.arange(0, BLOCK_M)
    offs_n = pid_n * BLOCK_N + tl.arange(0, BLOCK_N)
    offs_k = tl.arange(0, BLOCK_K)

    a_ptrs = A_ptr + (offs_m[:, None] * stride_am + offs_k[None, :] * stride_ak)
    b_ptrs = B_ptr + (offs_n[None, :] * stride_bn + offs_k[:, None] * stride_bk)

    acc = tl.zeros((BLOCK_M, BLOCK_N), dtype=tl.float32)

    for k in range(0, K, BLOCK_K):
        a = tl.load(a_ptrs, mask=(offs_m[:, None] < M) & (k + offs_k[None, :] < K), other=0.0)
        b = tl.load(b_ptrs, mask=(offs_n[None, :] < N) & (k + offs_k[:, None] < K), other=0.0)
        acc += tl.dot(a, b)
        a_ptrs += BLOCK_K * stride_ak
        b_ptrs += BLOCK_K * stride_bk

    acc = acc.to(tl.float16)
    c_ptrs = C_ptr + offs_m[:, None] * stride_cm + offs_n[None, :] * stride_cn
    tl.store(c_ptrs, acc, mask=(offs_m[:, None] < M) & (offs_n[None, :] < N))


def _ensure_device(t):
    if t.is_cuda:
        return t
    if not torch.cuda.is_available():
        raise RuntimeError("CUDA device required but not available.")
    return t.cuda()


def run(A, B):
    """
    Optimized GEMM: C = A @ B.T
    A: [M, 4096] float16
    B: [6144, 4096] float16
    Returns C: [M, 6144] float16
    """
    if A.dtype != torch.float16 or B.dtype != torch.float16:
        raise TypeError("Only float16 tensors are supported.")
    if A.shape[1] != 4096 or B.shape != (6144, 4096):
        raise ValueError("Incorrect tensor shapes for A or B.")

    orig_device_A = A.device
    orig_device_B = B.device

    A_gpu = _ensure_device(A.contiguous())
    B_gpu = _ensure_device(B.contiguous())

    M = A_gpu.shape[0]
    N = 6144
    K = 4096

    C_gpu = torch.empty((M, N), dtype=torch.float16, device=A_gpu.device)

    BLOCK_M = 128
    BLOCK_N = 128
    BLOCK_K = 32
    num_warps = 8
    num_ctas = 1  # per program_id—Triton handles grid dims below

    grid = (triton.cdiv(M, BLOCK_M), triton.cdiv(N, BLOCK_N))

    _gemm_kernel[grid](
        A_gpu, B_gpu, C_gpu,
        M, N, K,
        A_gpu.stride(0), A_gpu.stride(1),
        B_gpu.stride(0), B_gpu.stride(1),
        C_gpu.stride(0), C_gpu.stride(1),
        BLOCK_M=BLOCK_M,
        BLOCK_N=BLOCK_N,
        BLOCK_K=BLOCK_K,
        num_warps=num_warps,
        num_ctas=num_ctas,
    )

    if not orig_device_A.type == 'cuda':
        C_out = C_gpu.cpu()
    else:
        C_out = C_gpu

    return C_out


if __name__ == "__main__":
    # Quick correctness test
    M_test = 256
    A_test = torch.randn((M_test, 4096), dtype=torch.float16)
    B_test = torch.randn((6144, 4096), dtype=torch.float16)
    C_ref = torch.matmul(A_test.cuda(), B_test.cuda().T).cpu()
    C_triton = run(A_test, B_test)
    assert torch.allclose(C_ref, C_triton, atol=1e-2, rtol=1e-2)
    print("Triton GEMM passed the correctness test.")
scrolls · 111 lines total

Source code from FlashInfer-Bench (flashinfer-ai/flashinfer-trace) · Apache-2.0

Best evidence level for this revision: reported

JSON