submission 545070
rajesh0042 · python · License unknown
Use it
Vendorable · source mirrored · license unknownView source →
No package. Vendor the mirrored source: 28 lines, June 9 Researcher Reciprocity License v1.0.
vectoradd_v2_triton.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-vectoradd-v2-545070?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
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:96278b9c0423d86d6da32553faaef082e63732beda01eb3289c0ac3b2d78128e
license declaredunknown
license concludedunknown
authorsrajesh0042
imported2026-08-15
Kernel source
vectoradd_v2_triton.py28 lines
import os
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
import torch
import triton
import triton.language as tl
from task import input_t, output_t
@triton.jit
def vectoradd_kernel(
a_ptr, b_ptr, out_ptr, n_elements,
BLOCK_SIZE: tl.constexpr,
):
pid = tl.program_id(0)
offsets = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
mask = offsets < n_elements
a = tl.load(a_ptr + offsets, mask=mask)
b = tl.load(b_ptr + offsets, mask=mask)
tl.store(out_ptr + offsets, a + b, mask=mask)
def custom_kernel(data: input_t) -> output_t:
A, B, output = data
n = A.numel()
BLOCK_SIZE = 1024
grid = ((n + BLOCK_SIZE - 1) // BLOCK_SIZE,)
vectoradd_kernel[grid](A, B, output, n, BLOCK_SIZE=BLOCK_SIZE)
return output
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 545031.
⋯ 1 unchanged linesos.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"import torch+ import triton+ import triton.language as tlfrom task import input_t, output_t+ @triton.jit+ def vectoradd_kernel(+ a_ptr, b_ptr, out_ptr, n_elements,+ BLOCK_SIZE: tl.constexpr,+ ):+ pid = tl.program_id(0)+ offsets = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)+ mask = offsets < n_elements+ a = tl.load(a_ptr + offsets, mask=mask)+ b = tl.load(b_ptr + offsets, mask=mask)+ tl.store(out_ptr + offsets, a + b, mask=mask)+def custom_kernel(data: input_t) -> output_t:A, B, output = data- torch.add(A, B, out=output)+ n = A.numel()+ BLOCK_SIZE = 1024+ grid = ((n + BLOCK_SIZE - 1) // BLOCK_SIZE,)+ vectoradd_kernel[grid](A, B, output, n, BLOCK_SIZE=BLOCK_SIZE)return output
scrolls · 28 diff lines total
Best evidence level for this revision: reported
JSON