Skip to content
KernelIndex
Search⌘K

claude-opus-4-1 / cuda16cd03

claude-opus-4-1_cuda_16cd03 · claude-opus-4-1-20250805 · cuda · Apache-2.0

Use it

Vendorable · source mirrored · Apache-2.0View source →

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

main.cpp
curl "https://kernelindex.com/api/v1/implementations/flashinfer-claude-opus-4-1-cuda-16cd03?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
RMSNorm h7168bf16 · [7168] · batch_size=7
NVIDIA B200
23.9µs
#6 of 7
2025-10-16
RMSNorm h7168bf16 · [7168] · batch_size=32
NVIDIA B200
24.1µs
#6 of 7
2025-10-16
RMSNorm h7168bf16 · [7168] · batch_size=1
NVIDIA B200
24.4µs
#6 of 7
2025-10-16
RMSNorm h7168bf16 · [7168] · batch_size=18
NVIDIA B200
25.2µs
#6 of 7
2025-10-16
RMSNorm h7168bf16 · [7168] · batch_size=64
NVIDIA B200
27.0µs
#6 of 7
2025-10-16
RMSNorm h7168bf16 · [7168] · batch_size=539
NVIDIA B200
41.4µs
#6 of 7
2025-10-16
RMSNorm h7168bf16 · [7168] · batch_size=11949
NVIDIA B200
429.1µs
#7 of 7
2025-10-16
RMSNorm h7168bf16 · [7168] · batch_size=14521
NVIDIA B200
514.2µs
#7 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:8d50d7aee46f9c7f43128c48d656a903853c9df90d9a6ab0e03735ce3133b1ba
license declaredApache-2.0
license concludedApache-2.0
authorsclaude-opus-4-1-20250805
imported2026-08-20

Kernel source

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

torch::Tensor run(torch::Tensor hidden_states, torch::Tensor weight) {
    // Input validation
    TORCH_CHECK(hidden_states.device().is_cuda(), "hidden_states must be a CUDA tensor");
    TORCH_CHECK(weight.device().is_cuda(), "weight must be a CUDA tensor");
    TORCH_CHECK(hidden_states.is_contiguous(), "hidden_states must be contiguous");
    TORCH_CHECK(weight.is_contiguous(), "weight must be contiguous");
    TORCH_CHECK(hidden_states.scalar_type() == torch::kBFloat16, "hidden_states must be bfloat16");
    TORCH_CHECK(weight.scalar_type() == torch::kBFloat16, "weight must be bfloat16");
    
    // Check dimensions
    TORCH_CHECK(hidden_states.dim() == 2, "hidden_states must be 2D tensor");
    TORCH_CHECK(weight.dim() == 1, "weight must be 1D tensor");
    
    const int64_t batch_size = hidden_states.size(0);
    const int64_t hidden_size = hidden_states.size(1);
    
    TORCH_CHECK(hidden_size == 7168, "hidden_size must be 7168, got ", hidden_size);
    TORCH_CHECK(weight.size(0) == hidden_size, "weight size must match hidden_size");
    
    // Allocate output tensor
    torch::Tensor output = torch::empty_like(hidden_states);
    
    // Get CUDA stream
    cudaStream_t stream = at::cuda::getCurrentCUDAStream();
    
    // Launch kernel
    launch_rmsnorm_h7168(
        hidden_states.data_ptr(),
        weight.data_ptr(),
        output.data_ptr(),
        static_cast<int>(batch_size),
        stream
    );
    
    // Ensure kernel completes
    cudaError_t err = cudaStreamSynchronize(stream);
    TORCH_CHECK(err == cudaSuccess, "CUDA kernel execution error: ", cudaGetErrorString(err));
    
    return output;
}

PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
    m.def("run", &run, "RMSNorm forward pass for hidden_size=7168",
          py::arg("hidden_states"), py::arg("weight"));
}
scrolls · 50 lines total

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

Best evidence level for this revision: reproducible

JSON