Skip to content
KernelIndex
Search⌘K

gpt-o3 / cuda620cb5

gpt-o3_cuda_620cb5 · gpt-o3 · cuda · Apache-2.0

Use it

Vendorable · source mirrored · Apache-2.0View source →

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

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

Benchmark evidence

8 measurements across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
Fused add RMSNorm h7168bf16 · [7168] · batch_size=32
NVIDIA B200
16.0µs
#5 of 7
2025-10-16
Fused add RMSNorm h7168bf16 · [7168] · batch_size=64
NVIDIA B200
16.0µs
#5 of 7
2025-10-16
Fused add RMSNorm h7168bf16 · [7168] · batch_size=18
NVIDIA B200
16.2µs
#5 of 7
2025-10-16
Fused add RMSNorm h7168bf16 · [7168] · batch_size=7
NVIDIA B200
16.6µs
#5 of 7
2025-10-16
Fused add RMSNorm h7168bf16 · [7168] · batch_size=1
NVIDIA B200
16.6µs
#5 of 7
2025-10-16
Fused add RMSNorm h7168bf16 · [7168] · batch_size=539
NVIDIA B200
18.1µs
#4 of 7
2025-10-16
Fused add RMSNorm h7168bf16 · [7168] · batch_size=11949
NVIDIA B200
153.4µs
#5 of 7
2025-10-16
Fused add RMSNorm h7168bf16 · [7168] · batch_size=14521
NVIDIA B200
182.7µs
#5 of 7
2025-10-16

Reproduction-ready · How evidence levels are derived →

Source and license

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

Kernel source

main.cpp72 lines
#include "kernel.h"

#include <ATen/cuda/CUDAContext.h>
#include <torch/extension.h>

/* quick helpers ------------------------------------------------------------- */
#define CHECK_CUDA(x)      TORCH_CHECK(x.is_cuda(),        #x " must be a CUDA tensor")
#define CHECK_CONTIG(x)    TORCH_CHECK(x.is_contiguous(),  #x " must be contiguous")
#define CHECK_DTYPE(x, t)  TORCH_CHECK(x.scalar_type() == t, #x " must have dtype " #t)

/* -------------------------------------------------------------------------- */
/* Thin C++ wrapper that validates inputs, allocates output and launches CUDA */
/* -------------------------------------------------------------------------- */
torch::Tensor fused_add_rmsnorm_h7168(torch::Tensor hidden_states,
                                      torch::Tensor residual,
                                      torch::Tensor weight)
{
    /* safety checks --------------------------------------------------------- */
    CHECK_CUDA(hidden_states);
    CHECK_CUDA(residual);
    CHECK_CUDA(weight);

    CHECK_CONTIG(hidden_states);
    CHECK_CONTIG(residual);
    CHECK_CONTIG(weight);

    CHECK_DTYPE(hidden_states, at::kBFloat16);
    CHECK_DTYPE(residual,      at::kBFloat16);
    CHECK_DTYPE(weight,        at::kBFloat16);

    TORCH_CHECK(hidden_states.dim() == 2 &&
                hidden_states.size(1) == HIDDEN_SIZE,
                "hidden_states must be [N, 7168]");
    TORCH_CHECK(residual.sizes() == hidden_states.sizes(),
                "residual must have the same shape as hidden_states");
    TORCH_CHECK(weight.numel() == HIDDEN_SIZE,
                "weight must contain 7168 elements");

    /* allocate output ------------------------------------------------------- */
    torch::Tensor output = torch::empty_like(hidden_states);

    /* launch kernel --------------------------------------------------------- */
    cudaStream_t stream = at::cuda::getCurrentCUDAStream();
    launch_fused_add_rmsnorm_h7168(hidden_states,
                                   residual,
                                   weight,
                                   output,
                                   stream);

    return output;
}

/* -------------------------------------------------------------------------- */
/* Entry point expected by the benchmark harness                              */
/* -------------------------------------------------------------------------- */
torch::Tensor run(torch::Tensor hidden_states,
                  torch::Tensor residual,
                  torch::Tensor weight)
{
    return fused_add_rmsnorm_h7168(std::move(hidden_states),
                                   std::move(residual),
                                   std::move(weight));
}

/* -------------------------------------------------------------------------- */
/* pybind11 binding                                                           */
/* -------------------------------------------------------------------------- */
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m)
{
    m.def("run", &run,
          "Fused Add + RMSNorm (hidden=7168, BF16, optimised for Blackwell)");
}
scrolls · 72 lines total

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

Best evidence level for this revision: reproducible

JSON