Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions docs/operations/CausalConv1d.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Supports forward and backward passes with `torch.autograd` and `torch.compile`.

## Support

- **Architectures**: Turing (SM75) and newer, subject to available dynamic shared memory
- **Data types**: FP64, FP32, FP16, BF16
- **Architectures**: Turing (SM75) or later
- **Data types**: FP32, FP16, BF16
- **Activations**: `identity` and `silu` for NHW and NWH; B2B uses fixed gating

### Kernel sizes
Expand Down Expand Up @@ -171,7 +171,3 @@ B2B, requiring cuDNN 9.24.0 or later, with projection kernel size 2–32 and mix
The low-level B2B forward binding writes both the mixer-plus-skip intermediate `y` and the final post-gated `y_gated`; the high-level API returns only `y_gated`.

In most cases, use the corresponding `cudnn.ops` API, which handles autograd, `torch.compile`, and tensor management automatically.

The backend accumulation buffers for `dweight` and `dbias` are FP32 for
FP16, BF16, and FP32 inputs, and FP64 for FP64 inputs. The Python autograd
results are returned in the corresponding input tensor dtype.
71 changes: 0 additions & 71 deletions docs/operations/FFTCausalConv1d.md

This file was deleted.

153 changes: 0 additions & 153 deletions include/cudnn_frontend_shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -764,159 +764,6 @@ b2b_causal_conv1d_backward(cudaStream_t stream,
}
#endif

#if CUDNN_VERSION >= 92600
inline cudnnStatus_t
fft_causal_conv1d_forward(cudaStream_t stream,
const void *x,
const void *weight,
void *y,
int batch,
int dim,
int seq_len,
int kernel_size,
cudnnDataType_t data_type) {
auto effective_cudnn_ver = std::min(detail::get_compiled_version(), detail::get_backend_version());
if (effective_cudnn_ver < 92600) {
return CUDNN_STATUS_NOT_SUPPORTED;
}
NV_FE_CALL_TO_BACKEND(fft_causal_conv1d_forward,
cudnnFFTCausalConv1dForward,
stream,
x,
weight,
y,
batch,
dim,
seq_len,
kernel_size,
data_type);
}

inline cudnnStatus_t
fft_causal_conv1d_backward(cudaStream_t stream,
const void *x,
const void *weight,
const void *dy,
void *dx,
void *dweight,
int batch,
int dim,
int seq_len,
int kernel_size,
cudnnDataType_t data_type) {
auto effective_cudnn_ver = std::min(detail::get_compiled_version(), detail::get_backend_version());
if (effective_cudnn_ver < 92600) {
return CUDNN_STATUS_NOT_SUPPORTED;
}
NV_FE_CALL_TO_BACKEND(fft_causal_conv1d_backward,
cudnnFFTCausalConv1dBackward,
stream,
x,
weight,
dy,
dx,
dweight,
batch,
dim,
seq_len,
kernel_size,
data_type);
}

inline cudnnStatus_t
long_fft_causal_conv1d_get_buffer_sizes(int batch,
int dim,
int seq_len,
int kernel_size,
cudnnDataType_t data_type,
size_t *workspace_size_in_bytes,
size_t *reserve_space_size_in_bytes) {
auto effective_cudnn_ver = std::min(detail::get_compiled_version(), detail::get_backend_version());
if (effective_cudnn_ver < 92600) {
return CUDNN_STATUS_NOT_SUPPORTED;
}
NV_FE_CALL_TO_BACKEND(long_fft_causal_conv1d_get_buffer_sizes,
cudnnLongFFTCausalConv1dGetBufferSizes,
batch,
dim,
seq_len,
kernel_size,
data_type,
workspace_size_in_bytes,
reserve_space_size_in_bytes);
}

inline cudnnStatus_t
long_fft_causal_conv1d_forward(cudaStream_t stream,
const void *x,
const void *weight,
void *y,
int batch,
int dim,
int seq_len,
int kernel_size,
cudnnDataType_t data_type,
void *workspace,
size_t workspace_size_in_bytes,
void *reserve_space,
size_t reserve_space_size_in_bytes) {
auto effective_cudnn_ver = std::min(detail::get_compiled_version(), detail::get_backend_version());
if (effective_cudnn_ver < 92600) {
return CUDNN_STATUS_NOT_SUPPORTED;
}
NV_FE_CALL_TO_BACKEND(long_fft_causal_conv1d_forward,
cudnnLongFFTCausalConv1dForward,
stream,
x,
weight,
y,
batch,
dim,
seq_len,
kernel_size,
data_type,
workspace,
workspace_size_in_bytes,
reserve_space,
reserve_space_size_in_bytes);
}

inline cudnnStatus_t
long_fft_causal_conv1d_backward(cudaStream_t stream,
const void *dy,
void *dx,
void *dweight,
int batch,
int dim,
int seq_len,
int kernel_size,
cudnnDataType_t data_type,
void *workspace,
size_t workspace_size_in_bytes,
void *reserve_space,
size_t reserve_space_size_in_bytes) {
auto effective_cudnn_ver = std::min(detail::get_compiled_version(), detail::get_backend_version());
if (effective_cudnn_ver < 92600) {
return CUDNN_STATUS_NOT_SUPPORTED;
}
NV_FE_CALL_TO_BACKEND(long_fft_causal_conv1d_backward,
cudnnLongFFTCausalConv1dBackward,
stream,
dy,
dx,
dweight,
batch,
dim,
seq_len,
kernel_size,
data_type,
workspace,
workspace_size_in_bytes,
reserve_space,
reserve_space_size_in_bytes);
}
#endif

inline std::string
convert_version_to_str(size_t const version) {
// The multiplier for major version pre-v9 and post-v9 are different.
Expand Down
1 change: 0 additions & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Published documentation: https://docs.nvidia.com/deeplearning/cudnn/latest/devel
- [Block Scaling (MXFP8/NVFP4 quantization)](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/BlockScaling.md)
- [RoPE](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/RoPE.md)
- [Causal Conv1d](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/CausalConv1d.md)
- [FFT Causal Conv1d](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/FFTCausalConv1d.md)
- [Concatenate](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/Concatenate.md), [Reshape](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/Reshape.md), [Slice](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/Slice.md), [Transpose](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/Transpose.md), [Resampling](https://github.com/NVIDIA/cudnn-frontend/blob/main/docs/operations/Resampling.md)

## Open-source (frontend-only) kernel APIs
Expand Down
5 changes: 0 additions & 5 deletions python/cudnn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ def is_windows():
"causal_conv1d_nwh_backward",
"b2b_causal_conv1d_forward",
"b2b_causal_conv1d_backward",
"fft_causal_conv1d_forward",
"fft_causal_conv1d_backward",
"long_fft_causal_conv1d_get_buffer_sizes",
"long_fft_causal_conv1d_forward",
"long_fft_causal_conv1d_backward",
]:
if hasattr(_pybind_module, _optional_symbol):
globals()[_optional_symbol] = getattr(_pybind_module, _optional_symbol)
Expand Down
1 change: 0 additions & 1 deletion python/cudnn/ops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
# SPDX-License-Identifier: Apache-2.0

from .causal_conv1d import causal_conv1d, causal_conv1d_nwh, b2b_causal_conv1d
from .fft_causal_conv1d import fft_causal_conv1d
36 changes: 12 additions & 24 deletions python/cudnn/ops/causal_conv1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

_TORCH_DTYPE_TO_CUDNN = {
torch.float32: 0, # CUDNN_DATA_FLOAT
torch.float64: 1, # CUDNN_DATA_DOUBLE
torch.float16: 2, # CUDNN_DATA_HALF
torch.bfloat16: 9, # CUDNN_DATA_BFLOAT16
}
Expand All @@ -21,16 +20,10 @@

def _dtype_to_int(dtype: torch.dtype) -> int:
if dtype not in _TORCH_DTYPE_TO_CUDNN:
raise ValueError(f"Unsupported dtype {dtype}. Supported: float64, float32, float16, bfloat16.")
raise ValueError(f"Unsupported dtype {dtype}. Supported: float32, float16, bfloat16.")
return _TORCH_DTYPE_TO_CUDNN[dtype]


def _gradient_dtype(dtype: torch.dtype) -> torch.dtype:
# Match cuhyena: FP16/BF16 parameter gradients accumulate in FP32,
# while FP32 and FP64 parameter gradients accumulate in their input type.
return torch.float32 if dtype in (torch.float16, torch.bfloat16) else dtype


def _activation_to_int(activation: str) -> int:
if activation not in _ACTIVATION_TO_INT:
raise ValueError(f"Unsupported activation '{activation}'. Supported: 'identity', 'silu'.")
Expand Down Expand Up @@ -143,9 +136,8 @@ def _bwd_primitive(grad_out: Tensor, x: Tensor, weight: Tensor, bias: Tensor, ac
kernel_size = weight.shape[1]

dx = torch.empty_like(x)
grad_dtype = _gradient_dtype(x.dtype)
dweight = torch.zeros(weight.shape, device=x.device, dtype=grad_dtype)
dbias = torch.zeros(bias.shape, device=x.device, dtype=grad_dtype)
dweight = torch.zeros(weight.shape, device=x.device, dtype=torch.float32)
dbias = torch.zeros(bias.shape, device=x.device, dtype=torch.float32)

import cudnn

Expand All @@ -163,7 +155,7 @@ def _bwd_primitive(grad_out: Tensor, x: Tensor, weight: Tensor, bias: Tensor, ac
seq_len,
kernel_size,
_dtype_to_int(x.dtype),
_dtype_to_int(grad_dtype),
_dtype_to_int(torch.float32),
_activation_to_int(activation),
)
return [dx, dweight.to(x.dtype), dbias.to(x.dtype)]
Expand Down Expand Up @@ -225,7 +217,7 @@ def causal_conv1d(

Args:
x (torch.Tensor): Input tensor of shape ``(batch, dim, seq_len)``.
Must be BF16, FP16, FP32, or FP64. Must be contiguous and on CUDA.
Must be BF16, FP16, or FP32 and on CUDA.
weight (torch.Tensor): Filter tensor of shape ``(dim, kernel_size)``.
Same dtype as *x*. ``kernel_size`` must be between 2 and 256,
inclusive.
Expand Down Expand Up @@ -354,9 +346,8 @@ def _nwh_bwd_primitive(grad_out: Tensor, x: Tensor, weight: Tensor, bias: Tensor
kernel_size = weight.shape[0]

dx = torch.empty_like(x)
grad_dtype = _gradient_dtype(x.dtype)
dweight = torch.zeros(weight.shape, device=x.device, dtype=grad_dtype)
dbias = torch.zeros(bias.shape, device=x.device, dtype=grad_dtype)
dweight = torch.zeros(weight.shape, device=x.device, dtype=torch.float32)
dbias = torch.zeros(bias.shape, device=x.device, dtype=torch.float32)

import cudnn

Expand All @@ -374,7 +365,7 @@ def _nwh_bwd_primitive(grad_out: Tensor, x: Tensor, weight: Tensor, bias: Tensor
seq_len,
kernel_size,
_dtype_to_int(x.dtype),
_dtype_to_int(grad_dtype),
_dtype_to_int(torch.float32),
_activation_to_int(activation),
)
return [dx, dweight.to(x.dtype), dbias.to(x.dtype)]
Expand Down Expand Up @@ -432,7 +423,6 @@ def causal_conv1d_nwh(

Args:
x (torch.Tensor): Input tensor of shape ``(batch, seq_len, dim)``.
Must be BF16, FP16, FP32, or FP64.
weight (torch.Tensor): Filter tensor of shape ``(kernel_size, dim)``.
``kernel_size`` must be between 2 and 128, inclusive.
bias (torch.Tensor | None): Optional bias of shape ``(dim,)``.
Expand Down Expand Up @@ -602,10 +592,9 @@ def _b2b_bwd_primitive(
kernel_size_mixer = weights_mixer.shape[1]

dx = torch.empty_like(x)
grad_dtype = _gradient_dtype(x.dtype)
dweights_proj = torch.zeros(weights_proj.shape, device=x.device, dtype=grad_dtype)
dweights_mixer = torch.zeros(weights_mixer.shape, device=x.device, dtype=grad_dtype)
dskip_bias = torch.zeros(skip_bias.shape, device=x.device, dtype=grad_dtype)
dweights_proj = torch.zeros(weights_proj.shape, device=x.device, dtype=torch.float32)
dweights_mixer = torch.zeros(weights_mixer.shape, device=x.device, dtype=torch.float32)
dskip_bias = torch.zeros(skip_bias.shape, device=x.device, dtype=torch.float32)

import cudnn

Expand All @@ -627,7 +616,7 @@ def _b2b_bwd_primitive(
kernel_size_proj,
kernel_size_mixer,
_dtype_to_int(x.dtype),
_dtype_to_int(grad_dtype),
_dtype_to_int(torch.float32),
)
return [
dx,
Expand Down Expand Up @@ -707,7 +696,6 @@ def b2b_causal_conv1d(

Args:
x (torch.Tensor): Input tensor of shape ``(batch, 3*dim, seq_len)``.
Must be BF16, FP16, FP32, or FP64.
weights_proj (torch.Tensor): Projection filter ``(3*dim, kernel_size_proj)``.
``kernel_size_proj`` must be between 2 and 32, inclusive.
weights_mixer (torch.Tensor): Mixer filter ``(dim, kernel_size_mixer)``.
Expand Down
Loading