Skip to content
KernelIndex
Search⌘K

submission 132600

Nader · python · License unknown

Use it

Vendorable · source mirrored · license unknownView source →

No package. Vendor the mirrored source: 44 lines, June 9 Researcher Reciprocity License v1.0.

prefixsum_v2.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-prefixsum-v2-132600?include=source"
interfacepython
Compatibility
measured onNVIDIA H100
declared hardwareNVIDIA H100
architecturessm_90
dtypesfp32

Benchmark evidence

1 measurement across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
Inclusive prefix sumsuite of 11 cases
NVIDIA H100
870.5µs
#5 of 23
2025-12-08

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:c9fcfed6fc2d6627414be1b071380fb9d9c4f5abcf1e84ab570fdbd633636c81
license declaredunknown
license concludedunknown
authorsNader
imported2026-08-15

Kernel source

prefixsum_v2.py44 lines
#!POPCORN leaderboard prefixsum_v2

# This is a submission template for popcorn leaderboard 'prefixsum_v2'.
# Your task is as follows:
# > Implement an inclusive prefix sum (scan) kernel that matches the reference implementation.
# > The kernel should compute the cumulative sum of all elements up to each position.
# > Because of numerical instability, the tolerance is scaled by the square root of the input size.
# > 
# > Input:
# > - `data`: A 1D tensor of size `n`
# > Output:
# > - `output`: A 1D tensor of size `n`
# The deadline for this leaderboard is 2025-12-30 00:00:00+00:00

# You can automatically route this file to specific GPUs by adding a line
# `#!POPCORN gpus <GPUs>` to the header of this file.
# Happy hacking!

import subprocess

subprocess.run(["pip", "install", "cuda-cccl[cu12]==0.4.1"])

from task import input_t, output_t

import cuda.compute
from cuda.compute import OpKind
import torch

build_in = torch.empty(1, dtype=torch.float32, device="cuda")
build_out = torch.empty(1, dtype=torch.float32, device="cuda")

scanner = cuda.compute.make_inclusive_scan(build_in, build_out, OpKind.PLUS, None)

input_size = 268435456
temp_storage_size = scanner(None, build_in, build_out, input_size, None)
d_temp_storage = torch.empty(temp_storage_size, dtype=torch.uint8, device="cuda")

def custom_kernel(data: input_t) -> output_t:
    d_in, d_out = data
    scanner(d_temp_storage, d_in, d_out, len(d_in), None)


    return d_out
scrolls · 44 lines total

Source code from GPU Mode and the KernelBot dataset · June 9 Researcher Reciprocity License v1.0

Changes from previous submission

Against this author's previous submission submission 132594.

Best evidence level for this revision: reported

JSON