skillfed

causal-conv1d

Causal depthwise conv1d in CUDA, with a PyTorch interface

causal-conv1d v1.6.2.post1 121.0K downloads/30d#12,000 on PyPI936
Permissive license Active released

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-conv1d

uv

uv add causal-conv1d

poetry

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 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

License :: OSI Approved :: BSD LicenseOperating System :: UnixProgramming Language :: Python :: 3

Tags

causal convolution pytorch cudadepthwise conv1d gpufast 1d convolution kernelcausal conv1d cudaoptimized convolution pytorchdepthwise convolution gpucausal filtering cuda
gpu-accelerationcuda-kerneltime-series

More Artificial Intelligence packages

Further reading