submission 612258
dannywillowliu-uchi · python · License unknown
Use it
Vendorable · source mirrored · license unknownView source →
No package. Vendor the mirrored source: 51 lines, June 9 Researcher Reciprocity License v1.0.
submission.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-prefixsum-v2-612258?include=source"interfacepython
Compatibility
measured onNVIDIA B200
declared hardwareNVIDIA B200
architecturessm_100
dtypesfp32
Benchmark evidence
1 measurement across 1 GPU, fastest first.
Operation / workload
Hardware
Latency
Rank
Observed
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:5ed08dba6232904cbea60280c05cbf97251550a38c4c4c0fee93e7d8dd380567
license declaredunknown
license concludedunknown
authorsdannywillowliu-uchi
imported2026-08-15
Kernel source
submission.py51 lines
import os
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
import torch
from torch.utils.cpp_extension import load_inline
from task import input_t, output_t
cuda_source = r"""
#include <torch/extension.h>
#include <cub/cub.cuh>
#include <cuda_runtime.h>
static void* d_temp_storage = nullptr;
static size_t temp_storage_bytes = 0;
static int last_n = 0;
void inclusive_scan(torch::Tensor input, torch::Tensor output) {
int n = input.numel();
float* d_in = input.data_ptr<float>();
float* d_out = output.data_ptr<float>();
if (n != last_n) {
if (d_temp_storage) cudaFree(d_temp_storage);
temp_storage_bytes = 0;
cub::DeviceScan::InclusiveSum(nullptr, temp_storage_bytes, d_in, d_out, n);
cudaMalloc(&d_temp_storage, temp_storage_bytes);
last_n = n;
}
cub::DeviceScan::InclusiveSum(d_temp_storage, temp_storage_bytes, d_in, d_out, n);
}
"""
cpp_source = r"""
void inclusive_scan(torch::Tensor input, torch::Tensor output);
"""
module = load_inline(
name="cub_scan",
cpp_sources=[cpp_source],
cuda_sources=[cuda_source],
functions=["inclusive_scan"],
extra_cuda_cflags=["-O3", "--use_fast_math"],
verbose=False,
)
def custom_kernel(data: input_t) -> output_t:
data, output = data
module.inclusive_scan(data, output)
return output
scrolls · 51 lines total
Source code from GPU Mode and the KernelBot dataset · June 9 Researcher Reciprocity License v1.0
Best evidence level for this revision: reported
JSON