submission 553928
bloomberg9383 · python · License unknown
Use it
Vendorable · source mirrored · license unknownView source →
No package. Vendor the mirrored source: 75 lines, June 9 Researcher Reciprocity License v1.0.
submission.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-causal-conv1d-553928?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:bd079564c72043f9ae4161eec8dd6df226d8816283a8992a427adb90ac5b35d1
license declaredunknown
license concludedunknown
authorsbloomberg9383
imported2026-08-15
Techniques
Extracted from the mirrored source by pattern, never inferred. Each row cites its line.
num-warps = 1
(1, 64, 64, 4): helion.Config(block_sizes=[8, 32], num_stages=2, num_warps=1, pid_type='flat'),stages = 2
(1, 64, 64, 4): helion.Config(block_sizes=[8, 32], num_stages=2, num_warps=1, pid_type='flat'),Kernel source
submission.py75 lines
from task import input_t, output_t
import torch
import helion
import helion.language as hl
# Per-shape configs: map (B, D, S, W) to optimized helion.Config objects.
# Autotune locally for each shape, then paste the best config here.
SHAPE_CONFIGS: dict[tuple, helion.Config] = {
# Test shapes
(1, 64, 64, 4): helion.Config(block_sizes=[8, 32], num_stages=2, num_warps=1, pid_type='flat'),
(2, 128, 128, 4): helion.Config(block_sizes=[16, 32], num_stages=1, num_warps=16, pid_type='flat'),
(1, 256, 256, 3): helion.Config(block_sizes=[32, 16], num_stages=1, num_warps=16, pid_type='flat'),
(1, 128, 64, 8): helion.Config(block_sizes=[32, 8], l2_groupings=[2], num_stages=1, num_warps=16, pid_type='flat'),
(4, 64, 128, 4): helion.Config(block_sizes=[8, 8], num_stages=1, num_warps=8, pid_type='flat'),
# Benchmark shapes
(1, 768, 512, 4): helion.Config(block_sizes=[32, 16], loop_orders=[[1, 0, 2]], num_stages=1, num_warps=8, pid_type='flat'),
(1, 768, 2048, 4): helion.Config(block_sizes=[16, 32], num_stages=1, num_warps=8, pid_type='flat'),
(1, 1536, 2048, 4): helion.Config(block_sizes=[32, 32], num_stages=1, num_warps=4, pid_type='flat'),
(1, 2560, 2048, 4): helion.Config(block_sizes=[8, 128], num_stages=1, num_warps=2, pid_type='flat'),
(1, 2560, 4096, 4): helion.Config(block_sizes=[32, 64], num_stages=1, num_warps=1, pid_type='flat'),
}
# Optional: add advanced_controls_file to your Config for extra performance (see docs).
# Autotune with autotune_search_acf to find the best ACF, then hardcode it:
# helion.Config(..., advanced_controls_file="/opt/booster_pack/causal_conv_0.acf")
def _make_kernel(config: helion.Config):
@helion.kernel(static_shapes=True, config=config)
def kernel(
x_pad: torch.Tensor, # (B, D, L) zero-padded input
w: torch.Tensor, # (D, W) filter coefficients
b: torch.Tensor, # (D,) additive offset
) -> torch.Tensor:
B = x_pad.size(0)
D = x_pad.size(1)
L = x_pad.size(2)
W = hl.specialize(w.size(1))
N = L - W + 1
y = torch.empty(B, D, N, dtype=x_pad.dtype, device=x_pad.device)
for rb, rd, rs in hl.tile([B, D, N], block_size=[1, None, None]):
bi = rb.begin
acc = hl.zeros([rd, rs], dtype=torch.float32)
for j in range(W):
c = w[rd, j].to(torch.float32)
x = hl.load(x_pad, [bi, rd, rs.index + j]).to(torch.float32)
acc = acc + x * c[:, None]
acc = acc + b[rd].to(torch.float32)[:, None]
y[rb, rd, rs] = acc[None, :, :].to(y.dtype)
return y
return kernel
_KERNEL_CACHE: dict[tuple, object] = {}
def custom_kernel(data: input_t) -> output_t:
x, weight, bias = data
B, D, S = x.shape
W = weight.shape[1]
key = (B, D, S, W)
if key not in _KERNEL_CACHE:
_KERNEL_CACHE[key] = _make_kernel(SHAPE_CONFIGS[key])
kernel = _KERNEL_CACHE[key]
pad_zeros = torch.zeros(B, D, W - 1, dtype=x.dtype, device=x.device)
padded = torch.cat([pad_zeros, x], dim=2)
return kernel(padded, weight, bias)
scrolls · 75 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