submission 68762
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-68762?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:bd8e26fd58225afbc7de87dbac88bbb18a9b5ac34397d9078514b2a574c423c4
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 = 8
num_warps=8,stages = 0
num_stages=0,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 = 4096
grid = (triton.cdiv(n_pixels, BLOCK), )
rgb2gray_fast[grid](
input, output,
BLOCK_SIZE=BLOCK,
num_warps=8,
num_stages=0,
)
return output
scrolls · 42 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 68709.
⋯ 13 unchanged linesr = 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(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)⋯ 7 unchanged linesH, W, _ = input.shapen_pixels = H * W- BLOCK = 8192+ BLOCK = 4096grid = (triton.cdiv(n_pixels, BLOCK), )rgb2gray_fast[grid](input, output,BLOCK_SIZE=BLOCK,- num_warps=32,- num_stages=2,+ num_warps=8,+ num_stages=0,)return output
scrolls · 28 diff lines total
Best evidence level for this revision: reported
JSON