submission 68709
koshibat · python · License unknown
Use it
Vendorable · source mirrored · license unknownView source →
No package. Vendor the mirrored source: 42 lines, June 9 Researcher Reciprocity License v1.0.
submission_8192_32.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-grayscale-v2-68709?include=source"interfacepython
Compatibility
measured onNVIDIA B200
declared hardwareNVIDIA B200
architecturessm_100
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:25cf7f9334f4f605f211075e24a70ee04965070c579f822d3c5bf3deb70021f3
license declaredunknown
license concludedunknown
authorskoshibat
imported2026-08-15
Techniques
Extracted from the mirrored source by pattern, never inferred. Each row cites its line.
num-warps = 32
num_warps=32,stages = 2
num_stages=2,Kernel source
submission_8192_32.py42 lines
import torch
import triton
import triton.language as tl
@triton.jit
def rgb2gray_fast(
inp_ptr, out_ptr,
BLOCK_SIZE: tl.constexpr,
):
pid = tl.program_id(0)
i = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE) # (B,)
base = i + (i << 1)
r = tl.load(inp_ptr + base + 0, cache_modifier=".ca")
g = tl.load(inp_ptr + base + 1, cache_modifier=".ca")
b = tl.load(inp_ptr + base + 2, cache_modifier=".ca")
# gray = tl.fma(g, 0.5870, tl.fma(r, 0.2989, b * 0.1140))
gray = tl.fma(r, 0.2989, tl.fma(b, 0.1140, g * 0.5870))
# gray = tl.fma(b, 0.1140, tl.fma(g, 0.5870, r * 0.2989))
tl.store(out_ptr + i, gray)
def custom_kernel(data: torch.Tensor):
"""
Input: (H, W, 3) contiguous, dtype=float32 (元コードと同じ前提)
Output: (H, W) dtype=float32
"""
input, output = data
H, W, _ = input.shape
n_pixels = H * W
BLOCK = 8192
grid = (triton.cdiv(n_pixels, BLOCK), )
rgb2gray_fast[grid](
input, output,
BLOCK_SIZE=BLOCK,
num_warps=32,
num_stages=2,
)
return output
scrolls · 42 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