Skip to content
KernelIndex
Search⌘K

submission 66187

pmixer · 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_v2.00.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-vectoradd-v2-66187?include=source"
interfacepython
Compatibility
measured onNVIDIA L4
declared hardwareNVIDIA L4
architecturessm_89
dtypesfp16

Benchmark evidence

1 measurement across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
FP16 vector additionsuite of 5 cases
NVIDIA L4
6.94ms
#19 of 26
2025-10-16

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:2840a324d151f5e4da956e6c5a3620982b305a26b8d48ff5ead229893c0798e7
license declaredunknown
license concludedunknown
authorspmixer
imported2026-08-15

Kernel source

vectoradd_v2.00.py39 lines
from utils import make_match_reference, DeterministicContext
import torch
from task import input_t, output_t


def custom_kernel(data: input_t) -> output_t:
    """
    Reference implementation of vector addition using PyTorch.
    Args:
        data: Tuple of tensors [A, B] to be added.
    Returns:
        Tensor containing element-wise sums.
    """
    with DeterministicContext():
        A, B, output = data
        # output[...] = A + B
        torch.add(A, B, out=output)
        return output


def generate_input(size: int, seed: int) -> input_t:
    """
    Generates random input tensors of specified shapes.
    Returns:
        Tuple of tensors [A, B] to be added.
    """
    gen = torch.Generator(device="cuda")
    gen.manual_seed(seed)
    A = torch.randn(
        size, size, device="cuda", dtype=torch.float16, generator=gen
    ).contiguous()
    B = torch.randn(
        size, size, device="cuda", dtype=torch.float16, generator=gen
    ).contiguous()
    C = torch.empty(size, size, device="cuda", dtype=torch.float16).contiguous()
    return A, B, C


# check_implementation = make_match_reference(ref_kernel)
scrolls · 39 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 66186.

Best evidence level for this revision: reported

JSON