causal-conv1d
Causal depthwise conv1d in CUDA, with a PyTorch interface
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 on this page — 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
causal-conv1d on PyPI
pip
pip install causal-conv1duv
uv add causal-conv1dpoetry
poetry add causal-conv1dInstalling 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 the current Python release (>=3.9) |
| Install friction | high — source build required |
| Runtime dependencies | 3 — torch, packaging, ninja |
| Maintenance | actively maintained — 97 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 121,015/month — #12,000 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: causal_conv1d-1.6.2.post1.tar.gz
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
cuequivariance-ops-torch-cu12Provides CUDA-accelerated PyTorch kernels and…
unclear · top 15,000 on PyPI
nvidia-cudnn-frontendProvides Python and C++ APIs to NVIDIA's cuDNN…
permissive · top 5,000 on PyPI
nvidia-cusparselt-cu12Provides NVIDIA's cuSPARSELt CUDA library for…
unclear · top 5,000 on PyPI
comfy-kitchenComfy Kitchen provides optimized GPU kernels…
permissive · top 5,000 on PyPI
resize-rightResizes images or tensors in NumPy or PyTorch…
permissive · top 15,000 on PyPI
nvidia-cusparselt-cu13Provides NVIDIA's CUDA library for…
unclear · top 1,000 on PyPI
unfoldNdExtends PyTorch's unfold and fold operations to…
permissive · top 15,000 on PyPI
juliusJulius provides differentiable, GPU-accelerated…
permissive · top 5,000 on PyPI
fa3-fwdProvides a lightweight Flash-Attention-3…
permissive · top 15,000 on PyPI
transformer-engine-cu12Accelerates Transformer model training and…
unclear · top 15,000 on PyPI