--- id: causal-conv1d version: "1.6.2.post1" license: unclear license_treatment: permissive maintenance: active --- # causal-conv1d — Causal depthwise conv1d in CUDA, with a PyTorch interface License: permissive · Maintenance: active · Downloads: 121.0K/mo ## What it is and what it does Causal-conv1d provides a CUDA kernel for depthwise 1D convolution that maintains causality—the output at each position depends only on current and past inputs, never future ones. It wraps this kernel with a PyTorch interface, accepting batched sequences and returning convolved outputs in the same shape. The operation is mathematically equivalent to torch.nn.functional.conv1d with causal padding, but implemented as a fused CUDA kernel for lower latency and memory overhead. The package targets machine learning workloads where causal convolutions are essential, such as autoregressive language models, time-series processing, and streaming inference. It supports mixed precision (fp32, fp16, bf16) and optional SiLU/Swish activation. Installation requires a working CUDA environment and build tools; ROCm users on version 6.0 must patch their installation first. Use it for: - Accelerating causal convolution layers in transformer-based language models during training and inference. - Implementing efficient streaming time-series models that process sequences incrementally without lookahead. - Reducing latency in real-time audio or signal processing pipelines that depend on causal filtering. - Mixed-precision inference on edge GPUs where fp16 or bf16 precision reduces memory and bandwidth. - Building state-space models (e.g., Mamba, S4) that use causal convolutions as a core operation. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Implements a CUDA-optimized causal depthwise 1D convolution operation with PyTorch bindings, supporting fp32, fp16, and bf16 precision for kernel sizes 2, 3, and 4. Yes, if you are building or fine-tuning models that use causal convolutions and need lower latency than PyTorch's standard conv1d. The high install friction (CUDA, build tools, ROCm patching for some users) is a real cost; install only if you have a GPU environment already set up and the performance gain justifies the build complexity. No known vulnerabilities and active maintenance are positive signals. ## Install pip install causal-conv1d uv add causal-conv1d poetry add causal-conv1d ## Installing causal-conv1d Before you install: High install friction: requires torch, packaging, and ninja as runtime dependencies, plus a C++ compiler and CUDA toolchain. ROCm users on version 6.0 need to apply a patch to avoid compilation errors. Active maintenance with recent commits, but the build-from-source requirement makes installation non-trivial. License in practice: BSD License (permissive) places no restrictions on use, modification, or redistribution in proprietary or open-source projects. Quickstart: pip install causal-conv1d from causal_conv1d import causal_conv1d_fn # x: (batch, dim, seqlen), weight: (dim, width), bias: (dim,) out = causal_conv1d_fn(x, weight, bias=None, activation=None) Requires CUDA toolkit, C++ compiler, and ninja build tool. ROCm 6.0 users must apply the rocm6_0.patch before installation. Requires Python ≥3.9. Verify before relying: - Whether the package supports AMD GPUs via ROCm beyond the documented 6.0 and 6.1 versions. - Performance benchmarks or latency comparisons against torch.nn.functional.conv1d with equivalent padding. - Whether activation parameter accepts custom functions or only the documented 'silu'/'swish' strings. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: high - Maintenance: active - Downloads: 121.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags causal convolution pytorch cuda, depthwise conv1d gpu, fast 1d convolution kernel, causal conv1d cuda, optimized convolution pytorch, depthwise convolution gpu, causal filtering cuda, gpu-acceleration, cuda-kernel, time-series [View on SkillFed](https://skillfed.io/packages/causal-conv1d) · [View on PyPI](https://pypi.org/project/causal-conv1d/)