Kimi-K2.6 · popcorn · l12_default_gpt
error 19_DepthwiseSeparableConv1D_GELU_ResAdd.py
model
Kimi-K2.6
turns / max
2 / 10
tool calls
1
tokens (total)
0
wall clock
—
truncated
no
backend
cuda fp32
variant
popcorn
runtime
—
ref runtime
0.00 μs
speedup
—
started
2026-05-02T16:46:33Z
reference PyTorch source (the prompt the agent sees)
import torch
import torch.nn as nn

class Model(nn.Module):
    """
    1D depthwise separable convolution block: pointwise Conv1d (channel mixing), depthwise Conv1d (spatial),
    GELU activation, and residual addition. Used in genomic foundation models (Enformer) for efficient
    sequence processing of DNA/RNA.
    """
    def __init__(self, channels, expanded_channels, kernel_size):
        super(Model, self).__init__()
        self.pointwise = nn.Conv1d(channels, expanded_channels, 1)
        self.depthwise = nn.Conv1d(expanded_channels, expanded_channels, kernel_size,
                                   padding=kernel_size // 2, groups=expanded_channels)
        self.activation = nn.GELU()
        self.project_back = nn.Conv1d(expanded_channels, channels, 1)

    def forward(self, x):
        residual = x
        x = self.pointwise(x)
        x = self.depthwise(x)
        x = self.activation(x)
        x = self.project_back(x)
        x = x + residual
        return x

batch_size = 32
channels = 256
expanded_channels = 512
seq_len = 4096
kernel_size = 9

def get_inputs():
    return [torch.randn(popcorn_pri.jitter_int(batch_size), channels, popcorn_pri.jitter_int(seq_len))]

def get_init_inputs():
    return [channels, expanded_channels, kernel_size]
turn 034.0s turn · 34.0s LLM · 0.0s tools
reasoning
We need to produce a custom CUDA kernel that implements the forward computation of the described model: pointwise Conv1d (1x1), depthwise Conv1d with kernel_size and padding='same' (kernel_size//2), GELU activation, project back pointwise Conv1d (1x1), and residual addition. Given that the reference is a small-ish model but potentially large inputs (bs=32, channels=256, expanded=512, seq_len=4096), a fused CUDA kernel that does everything in one pass over the data (or a few fused passes) should be significantly faster than the PyTorch reference, which launches many separate kernels and does many memory reads/writes. Need to use torch.utils.cpp_extension.load_inline to compile CUDA C++ code. Need to think about what the fastest approach on the GPU is. First, let's get the GPU specs to know the hardware details.
call → get_gpu_specs
callget_gpu_specs {}
result ← get_gpu_specs (ok)
okget_gpu_specs GPU specs for NVIDIA H100 80GB HBM3: total memory (runtime): 79.1 GB spec entry: H100 GPU Architecture: Hopper GPU Memory: 80GB Memory Bandwidth: 3.35 TB/s FP64 TFLOPS: 34 FP64 Tensor Core TFLOPS: 67 FP32 TFLOPS: 67 TF32 Tensor Core TFLOPS: 989 with sparsity BFLOAT16 Tensore Core TFLOPS: 1979 with sparsity FP16 Tensor Core TFLOPS: 1979 with sparsity FP8 Tensor Core TFLOPS: 3958 with sparsity INT8 Tensor Core TOPS: 3958 with sparsity Register File Size: 64K 32-bit registers per SM Maximum number of registers per thread: 255 Maximum number of thread blocks per SM: 32 Shared memory capacity per SM: 228 KB Maximum shared memory per thread block: 227 KB
turn 11992.6s turn · 1992.6s LLM · 0.0s tools
feedbackLLM call failed: APITimeoutError: Request timed out.