gpt-o3 / cudac24d60
gpt-o3_cuda_c24d60 · gpt-o3 · cuda · Apache-2.0
Use it
Vendorable · source mirrored · Apache-2.0View source →
No package. Vendor the mirrored source: 46 lines, Apache-2.0, pinned at da91508.
main.cpp
curl "https://kernelindex.com/api/v1/implementations/flashinfer-gpt-o3-cuda-c24d60?include=source"interfacecuda
revisionda915083d4c7
symbolrun
pathmain.cpp
Compatibility
declared hardwareNVIDIA B200
architecturessm_100
dtypesfp32
Benchmark evidence
No published measurement for this revision.
No evidence · How evidence levels are derived →
Source and license
sourcehttps://huggingface.co/datasets/flashinfer-ai/flashinfer-trace
commitda915083d4c7c5e61aa3005e3d17ae488e0fc71c
revision digestsha256:abea3721e40049bd4089be3ca3c8b2db23e8cb2e3f741ea8cd7bb5134776a08c
license declaredApache-2.0
license concludedApache-2.0
authorsgpt-o3
imported2026-08-20
Kernel source
main.cpp46 lines
#include <torch/extension.h>
#include <ATen/cuda/CUDAContext.h>
#include "kernel.h"
/* -------------------------------------------------------------------------- */
/* Python-visible wrapper */
/* -------------------------------------------------------------------------- */
torch::Tensor run(torch::Tensor probs, /* [B, 128256] - float32 */
torch::Tensor top_p) /* [B] - float32 */
{
TORCH_CHECK(probs.is_cuda(), "probs must reside on CUDA");
TORCH_CHECK(top_p.is_cuda(), "top_p must reside on CUDA");
TORCH_CHECK(probs.dtype() == torch::kFloat32, "probs must be float32");
TORCH_CHECK(top_p.dtype() == torch::kFloat32, "top_p must be float32");
TORCH_CHECK(probs.dim() == 2, "probs must be 2-D (batch, vocab)");
TORCH_CHECK(probs.size(1) == VOCAB_SIZE,
"vocab dimension must be ", VOCAB_SIZE);
probs = probs.contiguous();
top_p = top_p.contiguous();
const int batch_size = static_cast<int>(probs.size(0));
auto out_opts = probs.options().dtype(torch::kInt64);
torch::Tensor samples = torch::empty({batch_size}, out_opts);
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
top_p_sampling_from_probs_v128256_launcher(
probs.data_ptr<float>(),
top_p.data_ptr<float>(),
samples.data_ptr<int64_t>(),
batch_size,
stream);
return samples;
}
/* -------------------------------------------------------------------------- */
/* PyBind11 binding */
/* -------------------------------------------------------------------------- */
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m)
{
m.def("run", &run,
"top_p_sampling_from_probs_v128256 (CUDA - optimised for B200)");
}scrolls · 46 lines total
Source code from the importing source · Apache-2.0
No published measurement for this revision
JSON