submission 569099
Aman Kushwaha · python · License unknown
Use it
Vendorable · source mirrored · license unknownView source →
No package. Vendor the mirrored source: 48 lines, June 9 Researcher Reciprocity License v1.0.
submission.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-vectorsum-v2-569099?include=source"interfacepython
Compatibility
measured onNVIDIA A100
declared hardwareNVIDIA A100
architecturessm_80
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:5dd6332dff1d2e5439c442900cf79051dd5eef8fc5d2843c00c2de1a3c62f979
license declaredunknown
license concludedunknown
authorsAman Kushwaha
imported2026-08-15
Kernel source
submission.py48 lines
import torch
import triton
import triton.language as tl
from task import input_t, output_t # evaluator types
@triton.jit
def _vecsum_kernel(X, PARTIAL, N, BLOCK_SIZE: tl.constexpr):
"""
Each program sums a block of BLOCK_SIZE elements from X
and writes the partial sum to PARTIAL.
"""
pid = tl.program_id(0)
offsets = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
mask = offsets < N
# Load input elements
x = tl.load(X + offsets, mask=mask, other=0.0)
# Accumulate in float64 for accuracy
x = x.to(tl.float64)
s = tl.sum(x, axis=0)
# Store partial sum
tl.store(PARTIAL + pid, s)
def custom_kernel(data: input_t) -> output_t:
"""
Fast vector sum reduction using Triton.
Produces identical output as reference (float64 accumulation → float32 scalar).
"""
data, _ = data
N = data.numel()
BLOCK_SIZE = 1024
# Compute number of programs
num_blocks = triton.cdiv(N, BLOCK_SIZE)
# Allocate partial sums
partial = torch.empty(num_blocks, device=data.device, dtype=torch.float64)
# Launch kernel
_vecsum_kernel[(num_blocks,)](data, partial, N, BLOCK_SIZE=BLOCK_SIZE)
# Final reduction (small tensor, PyTorch is fine)
result = partial.sum().to(torch.float32)
return resultscrolls · 48 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