Skip to content
KernelIndex
Search⌘K

gpt-5 / cudabd7484

gpt-5_cuda_bd7484 · gpt-5-2025-08-07 · cuda · Apache-2.0

Use it

Vendorable · source mirrored · Apache-2.0View source →

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

main.cpp
curl "https://kernelindex.com/api/v1/implementations/flashinfer-gpt-5-cuda-bd7484?include=source"
interfacecuda
revisionda915083d4c7
symbolrun
pathmain.cpp
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 n4096 k14336fp16 · [2, 14336]
NVIDIA B200
1.11ms
#5 of 6
2025-10-20
GEMM n4096 k14336fp16 · [1, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [7, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [4, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [8, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [15, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [16, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [24, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [40, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [32, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
Show all 43 measurements ›
GEMM n4096 k14336fp16 · [35, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [48, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [136, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [144, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [152, 14336]
NVIDIA B200
1.11ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [56, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [160, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [168, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [176, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [64, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [184, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [70, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [72, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [192, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [200, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [208, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [216, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [80, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [232, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [240, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [88, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [96, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [248, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [256, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [104, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [112, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [128, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [120, 14336]
NVIDIA B200
1.12ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [224, 14336]
NVIDIA B200
1.16ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [972, 14336]
NVIDIA B200
4.43ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [2053, 14336]
NVIDIA B200
8.87ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [2379, 14336]
NVIDIA B200
9.95ms
#6 of 6
2025-10-20
GEMM n4096 k14336fp16 · [8192, 14336]
NVIDIA B200
30.9ms
#6 of 6
2025-10-20

Reproduction-ready · How evidence levels are derived →

Source and license

sourcehttps://huggingface.co/datasets/flashinfer-ai/flashinfer-trace
commitda915083d4c7c5e61aa3005e3d17ae488e0fc71c
revision digestsha256:7d7ef720c14aa971ec4575eb2759ab3ef4c5e99fbf5a70b96865cab1441b50c8
license declaredApache-2.0
license concludedApache-2.0
authorsgpt-5-2025-08-07
imported2026-08-20

Kernel source

main.cpp54 lines
#include <torch/extension.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <vector>
#include <stdexcept>
#include "kernel.h"

static inline void check_inputs(const torch::Tensor& A, const torch::Tensor& B) {
  TORCH_CHECK(A.dim() == 2, "A must be 2D [M, K]");
  TORCH_CHECK(B.dim() == 2, "B must be 2D [N, K]");
  TORCH_CHECK(B.size(0) == GEMM_N_CONST, "B.size(0) must be 4096 (N constant)");
  TORCH_CHECK(A.size(1) == GEMM_K_CONST, "A.size(1) must be 14336 (K constant)");
  TORCH_CHECK(B.size(1) == GEMM_K_CONST, "B.size(1) must be 14336 (K constant)");
}

torch::Tensor run(torch::Tensor A, torch::Tensor B) {
  check_inputs(A, B);

  // Select device
  at::Device target_device = at::Device(at::kCUDA, 0);
  if (A.is_cuda()) target_device = A.device();
  else if (B.is_cuda()) target_device = B.device();

  // Convert dtypes to half and move to target device
  auto a_opt = torch::TensorOptions().dtype(torch::kFloat16).device(target_device);
  auto b_opt = torch::TensorOptions().dtype(torch::kFloat16).device(target_device);
  auto out_opt = torch::TensorOptions().dtype(torch::kFloat16).device(target_device);

  torch::Tensor A_dev = A.to(a_opt, /*non_blocking=*/true).contiguous();
  torch::Tensor B_dev = B.to(b_opt, /*non_blocking=*/true).contiguous();

  const int64_t M = A.size(0);
  torch::Tensor C_dev = torch::empty({M, (int64_t)GEMM_N_CONST}, out_opt);

  // Launch CUDA kernel on the current stream associated with the chosen device
  c10::cuda::CUDAGuard device_guard(target_device);
  cudaStream_t stream = at::cuda::getCurrentCUDAStream();

  const __half* A_ptr = reinterpret_cast<const __half*>(A_dev.data_ptr<at::Half>());
  const __half* B_ptr = reinterpret_cast<const __half*>(B_dev.data_ptr<at::Half>());
  __half* C_ptr = reinterpret_cast<__half*>(C_dev.data_ptr<at::Half>());

  gemm_n_4096_k_14336_launcher(A_ptr, B_ptr, C_ptr, M, stream);

  // If both inputs were CPU, return the result on CPU to match the reference behavior
  if (!A.is_cuda() && !B.is_cuda()) {
    return C_dev.to(torch::kCPU);
  }
  return C_dev;
}

PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
  m.def("run", &run, "gemm_n_4096_k_14336 (CUDA)");
}
scrolls · 54 lines total

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

Best evidence level for this revision: reproducible

JSON