Skip to content
KernelIndex
Search⌘K

gpt-o3 / cudaa7bbcf

gpt-o3_cuda_a7bbcf · gpt-o3 · cuda · Apache-2.0

Use it

Vendorable · source mirrored · Apache-2.0View source →

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

main.cpp
curl "https://kernelindex.com/api/v1/implementations/flashinfer-gpt-o3-cuda-a7bbcf?include=source"
interfacecuda
revisionda915083d4c7
symbolrun
pathmain.cpp
Compatibility
measured onNVIDIA B200
declared hardwareNVIDIA B200
architecturessm_100
dtypesbf16

Benchmark evidence

14 measurements across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
Fused add RMSNorm h4096bf16 · [4096] · batch_size=1
NVIDIA B200
16.4µs
#4 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=79
NVIDIA B200
17.2µs
#5 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=64
NVIDIA B200
17.4µs
#5 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=15
NVIDIA B200
17.7µs
#5 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=34
NVIDIA B200
17.8µs
#5 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=63
NVIDIA B200
17.8µs
#5 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=7
NVIDIA B200
17.9µs
#5 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=16
NVIDIA B200
18.0µs
#5 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=170
NVIDIA B200
21.4µs
#6 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=8804
NVIDIA B200
288.0µs
#7 of 8
2025-10-16
Show all 14 measurements ›
Fused add RMSNorm h4096bf16 · [4096] · batch_size=10827
NVIDIA B200
350.5µs
#7 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=11832
NVIDIA B200
380.1µs
#7 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=14418
NVIDIA B200
461.2µs
#7 of 8
2025-10-16
Fused add RMSNorm h4096bf16 · [4096] · batch_size=14509
NVIDIA B200
464.0µs
#7 of 8
2025-10-16

Reproduction-ready · How evidence levels are derived →

Source and license

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

Kernel source

main.cpp56 lines
#include <torch/extension.h>
#include <ATen/cuda/CUDAContext.h>
#include "kernel.h"

#define CHECK_CUDA(x)         TORCH_CHECK(x.is_cuda(), #x " must be a CUDA tensor")
#define CHECK_CONTIGUOUS(x)   TORCH_CHECK(x.is_contiguous(), #x " must be contiguous")
#define CHECK_BFLOAT16(x)     TORCH_CHECK(x.dtype() == torch::kBFloat16, #x " must be bfloat16")

torch::Tensor run(torch::Tensor hidden_states,
                  torch::Tensor residual,
                  torch::Tensor weight)
{
    /* --------------------------- sanity checks --------------------------- */
    CHECK_CUDA(hidden_states);
    CHECK_CUDA(residual);
    CHECK_CUDA(weight);

    CHECK_CONTIGUOUS(hidden_states);
    CHECK_CONTIGUOUS(residual);
    CHECK_CONTIGUOUS(weight);

    CHECK_BFLOAT16(hidden_states);
    CHECK_BFLOAT16(residual);
    CHECK_BFLOAT16(weight);

    TORCH_CHECK(hidden_states.dim() == 2 &&
                hidden_states.size(1) == 4096,
                "hidden_states must be [batch, 4096]");
    TORCH_CHECK(residual.sizes() == hidden_states.sizes(),
                "residual must match hidden_states");
    TORCH_CHECK(weight.dim() == 1 && weight.size(0) == 4096,
                "weight must be [4096]");

    const int batch_size = hidden_states.size(0);
    auto output = torch::empty_like(hidden_states);

    /* Current stream from PyTorch */
    cudaStream_t stream = at::cuda::getCurrentCUDAStream();

    fused_add_rmsnorm_h4096_launch(
        reinterpret_cast<const __nv_bfloat16*>(hidden_states.data_ptr<at::BFloat16>()),
        reinterpret_cast<const __nv_bfloat16*>(residual.data_ptr<at::BFloat16>()),
        reinterpret_cast<const __nv_bfloat16*>(weight.data_ptr<at::BFloat16>()),
        reinterpret_cast<__nv_bfloat16*>(output.data_ptr<at::BFloat16>()),
        batch_size,
        stream);

    return output;
}

/* ------------------------------- bindings ------------------------------- */
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
    m.def("run",
          &run,
          "Fused Add + RMSNorm with hidden_size=4096 (CUDA, B200 optimised)");
}
scrolls · 56 lines total

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

Best evidence level for this revision: reproducible

JSON