Skip to content
KernelIndex
Search⌘K

submission 35770

tsu_ · python · License unknown

Use it

Vendorable · source mirrored · license unknownView source →

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

vectoradd.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-vectoradd-v2-35770?include=source"
interfacepython
Compatibility
measured onNVIDIA A100
declared hardwareNVIDIA A100
architecturessm_80
dtypesfp16

Benchmark evidence

1 measurement across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
FP16 vector additionsuite of 5 cases
NVIDIA A100
1.00ms
#48 of 87
2025-09-07

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:c9b9ae51b6e0a7ba539a38966f6cadfe7157e30f7d190f96ddc0e01118ff4a91
license declaredunknown
license concludedunknown
authorstsu_
imported2026-08-15

Kernel source

vectoradd.py39 lines
#!POPCORN leaderboard vectoradd_v2

# This is a submission template for popcorn leaderboard 'vectoradd_v2'.
# Your task is as follows:
# > Implement a float16 vector addition kernel.
# > 
# > Input: tuple(torch.Tensor, torch.Tensor) with tensors of shape (N, N) and type torch.float16. These tensors are from
# > a normal distribution with mean 0 and variance 1.
# > Output: torch.Tensor of shape (N, N) and type torch.float16
# 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 triton
import triton.language as tl
from task import input_t, output_t

@triton.jit
def add_kernel(x_ptr, y_ptr, z_ptr, n, b_sz: tl.constexpr):
  pid = tl.program_id(axis=0)
  start = pid * b_sz
  offsets = start + tl.arange(0, b_sz)
  mask = offsets < n
  x = tl.load(x_ptr + offsets, mask=mask)
  y = tl.load(y_ptr + offsets, mask=mask)
  z = x + y
  tl.store(z_ptr + offsets, z, mask=mask)


def custom_kernel(data: input_t) -> output_t:
    x, y, z = data
    n = x.numel()
    grid_lam = lambda meta: (triton.cdiv(n, meta["b_sz"]), )

    add_kernel[grid_lam](x, y, z, n, b_sz=1024)

    return z
scrolls · 39 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