gpt-o3 / cuda0743e3
gpt-o3_cuda_0743e3 · gpt-o3 · cuda · Apache-2.0
Use it
Vendorable · source mirrored · Apache-2.0View source →
No package. Vendor the mirrored source: 41 lines, Apache-2.0, pinned at da91508.
main.cpp
curl "https://kernelindex.com/api/v1/implementations/flashinfer-gpt-o3-cuda-0743e3?include=source"interfacecuda
revisionda915083d4c7
symbolrun
pathmain.cpp
Compatibility
declared hardwareNVIDIA B200
architecturessm_100
dtypesfp32, int32
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:949b0f18a955a86cba8e48ac170658451a3bd84ebb87b23644a48ffd40ee64eb
license declaredApache-2.0
license concludedApache-2.0
authorsgpt-o3
imported2026-08-20
Kernel source
main.cpp41 lines
#include <torch/extension.h>
#include "kernel.h"
/*
* Python entry point
* samples = run(probs, top_k)
*
* All tensors must already live on the desired CUDA device.
*/
torch::Tensor run(torch::Tensor probs, torch::Tensor top_k)
{
TORCH_CHECK(probs.is_cuda(), "probs must reside on CUDA");
TORCH_CHECK(top_k.is_cuda(), "top_k must reside on CUDA");
TORCH_CHECK(probs.scalar_type() == torch::kFloat32, "probs must be float32");
TORCH_CHECK(top_k.scalar_type() == torch::kInt32 , "top_k must be int32");
TORCH_CHECK(probs.dim() == 2 && probs.size(1) == 151936,
"probs must have shape [batch_size, 151936]");
const int64_t batch_size = probs.size(0);
auto out_opts = torch::TensorOptions()
.dtype(torch::kInt64)
.device(probs.device());
torch::Tensor samples = torch::empty({batch_size}, out_opts);
/* delegate to CUDA implementation */
top_k_sampling_from_probs_v151936_cuda(
probs.contiguous(),
top_k.contiguous(),
samples);
return samples;
}
/* PyBind11 --------------------------------------------------------------- */
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m)
{
m.def("run", &run,
"Top-k sampling for Qwen-3 vocab (CUDA)");
}scrolls · 41 lines total
Source code from the importing source · Apache-2.0
No published measurement for this revision
JSON