claude-opus-4-1 / cuda1970e7
claude-opus-4-1_cuda_1970e7 · claude-opus-4-1-20250805 · cuda · Apache-2.0
Use it
Vendorable · source mirrored · Apache-2.0View source →
No package. Vendor the mirrored source: 63 lines, Apache-2.0, pinned at da91508.
main.cpp
curl "https://kernelindex.com/api/v1/implementations/flashinfer-claude-opus-4-1-cuda-1970e7?include=source"interfacecuda
revisionda915083d4c7
symbolrun
pathmain.cpp
Compatibility
measured onNVIDIA B200
declared hardwareNVIDIA B200
architecturessm_100
dtypesfp16
Benchmark evidence
22 measurements across 1 GPU, fastest first.
Operation / workload
Hardware
Latency
Rank
Observed
Show all 22 measurements ›Showing all 22 measurements ⌄
Reproduction-ready · How evidence levels are derived →
Source and license
sourcehttps://huggingface.co/datasets/flashinfer-ai/flashinfer-trace
commitda915083d4c7c5e61aa3005e3d17ae488e0fc71c
revision digestsha256:97b87e562d6fecf308c954cc6602a86a0672190908046ae9b46f8e4444966d8a
license declaredApache-2.0
license concludedApache-2.0
authorsclaude-opus-4-1-20250805
imported2026-08-20
Kernel source
main.cpp63 lines
#include <torch/extension.h>
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include "kernel.h"
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
torch::Tensor run(torch::Tensor A, torch::Tensor B) {
// Input validation
TORCH_CHECK(A.dtype() == torch::kFloat16, "A must be float16");
TORCH_CHECK(B.dtype() == torch::kFloat16, "B must be float16");
TORCH_CHECK(A.is_cuda(), "A must be a CUDA tensor");
TORCH_CHECK(B.is_cuda(), "B must be a CUDA tensor");
TORCH_CHECK(A.is_contiguous(), "A must be contiguous");
TORCH_CHECK(B.is_contiguous(), "B must be contiguous");
// Dimension validation
TORCH_CHECK(A.dim() == 2, "A must be 2D");
TORCH_CHECK(B.dim() == 2, "B must be 2D");
const int64_t M = A.size(0);
const int64_t K_A = A.size(1);
const int64_t N = B.size(0);
const int64_t K_B = B.size(1);
TORCH_CHECK(K_A == 4096, "A's K dimension must be 4096");
TORCH_CHECK(N == 4096, "B's N dimension must be 4096");
TORCH_CHECK(K_B == 4096, "B's K dimension must be 4096");
// Set the CUDA device
c10::cuda::CUDAGuard device_guard(A.device());
// Create output tensor
auto options = torch::TensorOptions()
.dtype(torch::kFloat16)
.device(A.device())
.requires_grad(false);
torch::Tensor C = torch::empty({M, N}, options);
// Get CUDA stream
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
// Get raw pointers
const half* A_ptr = reinterpret_cast<const half*>(A.data_ptr<at::Half>());
const half* B_ptr = reinterpret_cast<const half*>(B.data_ptr<at::Half>());
half* C_ptr = reinterpret_cast<half*>(C.data_ptr<at::Half>());
// Launch kernel
launch_gemm_kernel(A_ptr, B_ptr, C_ptr, static_cast<int>(M), stream);
// Check for errors
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
TORCH_CHECK(false, "CUDA kernel launch failed: ", cudaGetErrorString(err));
}
return C;
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("run", &run, "Optimized GEMM for N=4096, K=4096",
py::arg("A"), py::arg("B"));
}scrolls · 63 lines total
Source code from FlashInfer-Bench (flashinfer-ai/flashinfer-trace) · Apache-2.0
Best evidence level for this revision: reproducible
JSON