.github / workflows / build-kernel-wheel.yml
name: build-kernel-wheel
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build-causal-conv1d:
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: pip
- name: Install CUDA 13 compiler
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ca-certificates curl gnupg2
curl -fsSL \
https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb \
-o /tmp/cuda-keyring.deb
sudo dpkg -i /tmp/cuda-keyring.deb
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cuda-nvcc-13-0 cuda-cudart-dev-13-0
echo "/usr/local/cuda-13.0/bin" >> "$GITHUB_PATH"
- name: Install exact torch
run: |
python -m pip install --upgrade pip setuptools wheel ninja packaging
python -m pip install --no-cache-dir \
torch==2.11.0 \
--index-url https://download.pytorch.org/whl/cu130
python - <<'PY'
import sys
import torch
print("python", sys.version)
print("torch", torch.__version__)
print("cuda", torch.version.cuda)
print("cxx11_abi", torch._C._GLIBCXX_USE_CXX11_ABI)
assert sys.version_info[:2] == (3, 13)
assert torch.__version__.startswith("2.11.0+cu130")
assert torch.version.cuda.startswith("13.0")
assert torch._C._GLIBCXX_USE_CXX11_ABI is True
PY
- name: Build wheel with 32 jobs
env:
CUDA_HOME: /usr/local/cuda-13.0
MAX_JOBS: "32"
CMAKE_BUILD_PARALLEL_LEVEL: "32"
TORCH_CUDA_ARCH_LIST: "8.0+PTX"
CAUSAL_CONV1D_FORCE_BUILD: "TRUE"
CAUSAL_CONV1D_FORCE_CXX11_ABI: "TRUE"
CAUSAL_CONV1D_LOCAL_VERSION: "cu13torch2.11cxx11abiTRUE"
run: |
git clone --depth 1 --branch v1.7.0 \
https://github.com/Dao-AILab/causal-conv1d.git /tmp/causal-conv1d
mkdir -p wheelhouse
cd /tmp/causal-conv1d
python - <<'PY'
from pathlib import Path
path = Path("setup.py")
source = path.read_text()
start = source.index(' cc_flag.append("-gencode")')
end = source.index(" # HACK:", start)
replacement = ''' cc_flag.extend([
"-gencode", "arch=compute_80,code=sm_80",
"-gencode", "arch=compute_80,code=compute_80",
])
'''
path.write_text(source[:start] + replacement + source[end:])
PY
python -m pip wheel . --no-deps --no-build-isolation \
-w "$GITHUB_WORKSPACE/wheelhouse"
cd "$GITHUB_WORKSPACE"
ls -lh wheelhouse
test "$(find wheelhouse -name '*.whl' | wc -l)" -eq 1
WHEEL="$(find wheelhouse -name '*.whl' -print -quit)"
echo "$WHEEL" | grep -q 'cp313-cp313-linux_x86_64'
echo "$WHEEL" | grep -qi 'torch2.11cxx11abitrue'
echo "$WHEEL" | grep -qi 'cu13'
sha256sum "$WHEEL" | tee wheelhouse/SHA256SUMS.txt
- name: Verify wheel import
run: |
WHEEL="$(find wheelhouse -name '*.whl' -print -quit)"
python -m pip install --no-deps "$WHEEL"
python - <<'PY'
import causal_conv1d
import causal_conv1d_cuda
print("causal_conv1d", causal_conv1d.__version__)
print("causal_conv1d_cuda", causal_conv1d_cuda.__file__)
PY
- uses: actions/upload-artifact@v4
with:
name: causal-conv1d-cp313-torch211-cu130
path: |
wheelhouse/*.whl
wheelhouse/SHA256SUMS.txt
- name: Publish wheel release
uses: softprops/action-gh-release@v2
with:
tag_name: kernel-wheels-v1
name: RNAQwen kernel wheels
body: |
Prebuilt causal-conv1d 1.7.0 for Colab:
Python 3.13, torch 2.11.0+cu130, CUDA 13, CXX11 ABI=true,
Linux x86_64, A100 sm80 + PTX.
files: |
wheelhouse/*.whl
wheelhouse/SHA256SUMS.txt