Skip to content

Reintroduce FFT causal conv1d frontend bindings - #542

Merged
yeliu-oss merged 3 commits into
NVIDIA:developfrom
yeliu-oss:yeliu/reland-fft-causal-conv1d
Aug 19, 2026
Merged

Reintroduce FFT causal conv1d frontend bindings#542
yeliu-oss merged 3 commits into
NVIDIA:developfrom
yeliu-oss:yeliu/reland-fft-causal-conv1d

Conversation

@yeliu-oss

@yeliu-oss yeliu-oss commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Before submitting

  • I agree to license this contribution under the terms of LICENSE.txt.
  • I ran pre-commit run and committed any formatting changes.

Affected area

  • Python API or bindings

Summary

Reintroduces the FFT causal conv1d frontend support originally merged in #437 and reverted in #479:

  • Add dynamically loaded pybind shims for the medium and long FFT causal conv1d backend APIs, including the long-path workspace/reserve-space size query.
  • Add cudnn.ops.fft_causal_conv1d(x, weight), following cuhyena's medium/long selection, padding, trimming, dtype support, and autograd behavior.
  • Preserve long-forward reserve space for the matching backward call.
  • Add C++ medium/long samples, forward/backward Python notebooks, operation documentation, and focused Python tests.

Why

The cuDNN 9.26 release branch now contains the backend declarations and implementations required by this frontend API. That resolves the compatibility issue that motivated #479, so the original feature can again be built and run with its documented cuDNN 9.26 minimum version.

Related issues

Related to #437 and #479.

API and compatibility impact

Adds the public Python API:

y = cudnn.ops.fft_causal_conv1d(x, weight)

It also exposes the low-level long-path buffer query:

workspace_size, reserve_size = cudnn.long_fft_causal_conv1d_get_buffer_sizes(
    batch, dim, seq_len, kernel_size, data_type
)
  • Requires cuDNN 9.26.0 or newer at compile time and runtime.
  • Supports FP16, BF16, FP32, and FP64 CUDA tensors.
  • Supports PyTorch autograd and torch.compile.
  • Uses cuhyena's FIR weight convention, where weight[0] multiplies the current sample. This is reversed relative to the existing direct causal conv1d wrapper.
  • Builds against older cuDNN headers remain supported because all new bindings and samples are compile-time guarded; older runtimes return CUDNN_STATUS_NOT_SUPPORTED.

Testing

Validated locally on a compute-capability 10.0 GPU with CUDA 13.4.25 and cuDNN 9.26.0.27 from the merged 9.26 backend pipeline. The rebuilt Python module reported backend version 92600 and loaded libcudnn.so.9.26.0 from that artifact.

  • /path/to/python -m pre_commit run --from-ref origin/develop --to-ref HEAD: passed (clang-format, black, and black-jupyter).
  • cmake -S . -B /tmp/cudnn-frontend-437-cpp -DCUDNN_INCLUDE_PATH=/tmp/cudnn-mr4168-9.26.0.27/cudnn/include -DCUDNN_LIBRARY_PATH=/tmp/cudnn-mr4168-9.26.0.27/cudnn/lib -DCUDAToolkit_ROOT=/path/to/cuda-13.4: passed.
  • cmake --build /tmp/cudnn-frontend-437-cpp --parallel 32 --target samples: passed; the complete C++ samples target compiled.
  • LD_LIBRARY_PATH=<cuDNN-9.26-and-CUDA-libs> /tmp/cudnn-frontend-437-cpp/bin/samples '[fft_causal_conv1d]': 2 passed (medium and long forward/backward).
  • cmake -S . -B /tmp/cudnn-frontend-437-pybind -DCUDNN_FRONTEND_BUILD_PYTHON_BINDINGS=ON -DCUDNN_FRONTEND_BUILD_SAMPLES=OFF -DCUDNN_FRONTEND_BUILD_TESTS=OFF -DCUDAToolkit_ROOT=/path/to/cuda-13.4 -DCUDNN_PATH=/tmp/cudnn-mr4168-9.26.0.27/cudnn -DCUDNN_LIBRARY_PATH=/tmp/cudnn-mr4168-9.26.0.27/cudnn/lib: passed.
  • cmake --build /tmp/cudnn-frontend-437-pybind --parallel 32: passed.
  • PYTHONPATH=/tmp/cudnn-frontend-437-pybind python -m pytest -q -ra test/python/test_fft_causal_conv1d.py: 7 passed in 110.93s.
  • python -m jupyter nbconvert --to notebook --execute samples/python/66_fft_causal_conv1d_forward.ipynb --ExecutePreprocessor.kernel_name=cudnn-fe-437 --ExecutePreprocessor.timeout=1200: passed with zero cell errors; medium FP32, long FP64, and torch.compile checks passed.
  • python -m jupyter nbconvert --to notebook --execute samples/python/67_fft_causal_conv1d_backward.ipynb --ExecutePreprocessor.kernel_name=cudnn-fe-437 --ExecutePreprocessor.timeout=1200: passed with zero cell errors; medium and long backward/reference checks passed.

Summary by CodeRabbit

  • New Features

    • Added FFT-based depthwise causal Conv1d with forward, backward, autograd, and compilation support.
    • Supports medium and long FFT paths, automatic padding, and long-sequence buffering.
    • Added FP64 support and improved gradient precision for lower-precision inputs.
    • Added dependency-aware lazy operation loading with clearer installation guidance.
  • Documentation

    • Added API documentation, usage examples, supported dtype details, and operation references.
  • Tests

    • Expanded coverage for FFT paths, FP64, compiled autograd, layouts, and long-sequence convolution.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dfa6a68e-05d2-43b3-8149-5d9457d58993

📥 Commits

Reviewing files that changed from the base of the PR and between 926794c and 73b6beb.

📒 Files selected for processing (1)
  • test/python/test_causal_conv1d.py

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds medium- and long-FFT causal Conv1d support. It adds backend shims, Python bindings, validation, autograd integration, tests, samples, and documentation. Existing causal Conv1d variants gain FP64 and dtype-specific gradient accumulation.

Changes

Causal Conv1d Features

Layer / File(s) Summary
Causal Conv1d dtype and gradient handling
python/cudnn/ops/causal_conv1d.py, test/python/test_causal_conv1d.py, docs/operations/CausalConv1d.md
Existing causal Conv1d variants support FP64. FP16 and BF16 gradients accumulate in FP32. FP32 and FP64 gradients use the input dtype. Tests cover outputs, gradients, layouts, activations, and compiled autograd.
FFT backend shims and Python bindings
include/cudnn_frontend_shim.h, python/pycudnn.cpp, python/cudnn/__init__.py
cuDNN 9.26-gated shims and Python bindings expose medium- and long-FFT forward and backward operations, including long-path buffer-size queries.
Python FFT causal Conv1d operation
python/cudnn/ops/fft_causal_conv1d.py, python/cudnn/ops/__init__.py, test/python/test_fft_causal_conv1d.py, test/python/test_import_boundaries.py
The wrapper validates inputs, selects the FFT path, manages padding and long-path buffers, integrates autograd, and exposes lazy imports. Tests cover supported dtypes, paths, gradients, buffer sizing, and import boundaries.
FFT operation documentation and samples
docs/operations/FFTCausalConv1d.md, llms.txt, samples/cpp/..., samples/python/*.ipynb
Documentation, C++ samples, and Python notebooks describe and exercise FFT causal Conv1d forward, backward, FP64, long-path buffers, and torch.compile behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: ⚪ Minimal · up to 73b6b

The PR adds the FFT causal convolution frontend and documents the supported cuDNN requirements and validation; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant PythonAPI
  participant FFTCausalConv1d
  participant cuDNNBindings
  participant cuDNNBackend
  PythonAPI->>FFTCausalConv1d: Validate tensors and select medium or long path
  FFTCausalConv1d->>cuDNNBindings: Invoke forward or backward operation
  cuDNNBindings->>cuDNNBackend: Dispatch cuDNN 9.26+ operation
  cuDNNBackend-->>cuDNNBindings: Return output, gradients, or buffer sizes
  cuDNNBindings-->>FFTCausalConv1d: Return backend result
  FFTCausalConv1d-->>PythonAPI: Trim padding and return result
Loading

Suggested labels: cat-feature, mod-backend, orig-nv-eng

Suggested reviewers: anerudhan

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.41% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: reintroducing FFT causal convolution frontend bindings.
Description check ✅ Passed The description covers the required sections and provides detailed scope, compatibility impact, related issues, and testing results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (9)
test/python/test_fft_causal_conv1d.py (3)

11-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Gate the tests on CUDA availability and on device capability.

_require_fft_causal_conv1d checks the backend version and the binding symbols. It does not check torch.cuda.is_available(). _make_inputs then creates tensors with device="cuda" at Line 29, so a CPU-only runner raises a RuntimeError instead of skipping.

The FFT path selection in python/cudnn/ops/fft_causal_conv1d.py also depends on the architecture through _cuda_arch. Add a capability gate so unsupported architectures skip instead of failing.

As per coding guidelines: "Gate tests on supported capabilities and skip unsupported architecture, dtype, or backend-version combinations using support checks, cudnn.backend_version(), and torch.cuda.get_device_capability()."

♻️ Proposed change
 def _require_fft_causal_conv1d():
+    if not torch.cuda.is_available():
+        pytest.skip("FFT causal conv1d requires a CUDA device")
     required_symbols = (
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/python/test_fft_causal_conv1d.py` around lines 11 - 20, Update
_require_fft_causal_conv1d to skip unless CUDA is available, the existing cuDNN
version and symbol checks pass, and torch.cuda.get_device_capability() is
supported by the FFT path’s _cuda_arch requirements. Keep the existing skip
behavior and use the capability check before _make_inputs creates CUDA tensors.

Source: Coding guidelines


94-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extend coverage for the long path, the buffer formula, and torch.compile.

Three gaps remain in this file:

  • The long FFT path runs for FP64 only, at Line 40. FP16, BF16, and FP32 never reach _long_fwd_primitive or _long_bwd_primitive. This gap hides the grad_weight initialization question raised on python/cudnn/ops/fft_causal_conv1d.py Line 268.
  • This test compares the mirrored buffer formula for CUDNN_DATA_FLOAT only. Parameterize it over every supported dtype, so a wrong scratch-element assumption at python/cudnn/ops/fft_causal_conv1d.py Line 117 fails loudly.
  • No test compiles the operation. The PR claims torch.compile support, and register_fake plus @torch.compiler.allow_in_graph exist for that purpose. Add one test that wraps fft_causal_conv1d with torch.compile and compares against the eager result.

Place the dtype sweeps at a level above L0 to keep L0 fast.

As per coding guidelines: "Mark every new Python test with a level from L0 through L4; keep L0 tests fast and place large parameter sweeps at higher levels."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/python/test_fft_causal_conv1d.py` around lines 94 - 99, Extend test
coverage in test_long_fft_fake_buffer_formula_matches_backend_query and the
existing long-path tests: parameterize supported FP16, BF16, FP32, and FP64
dtypes so both long forward/backward primitives and grad_weight initialization
are exercised, and move these broad sweeps above L0. Parameterize the
buffer-size assertion across every supported dtype while retaining the matching
dtype-to-backend mapping. Add a higher-level marked test that wraps
fft_causal_conv1d with torch.compile and compares its output with eager
execution.

Source: Coding guidelines


28-31: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the numerical checks reproducible and use gradient-specific tolerances.

test/python/conftest.py does not seed the RNG. Seed a CUDA generator before creating x, weight, and grad_out, or use torch_fork_set_rng.

Use a separate tolerance for weight.grad. Its convolution gradient reduces over batch and sequence dimensions and can have a different error scale from the output and x.grad.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/python/test_fft_causal_conv1d.py` around lines 28 - 31, Update
_make_inputs and the test’s grad_out setup to use a reproducible CUDA RNG,
either by seeding a CUDA generator before creating x, weight, and grad_out or by
wrapping generation with torch_fork_set_rng. Add a separate tolerance for
weight.grad comparisons, reflecting its distinct reduction error scale, while
retaining the existing tolerance for the output and x.grad checks.
python/cudnn/ops/fft_causal_conv1d.py (4)

7-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

_dtype_to_int duplicates the helper in causal_conv1d.py.

python/cudnn/ops/causal_conv1d.py Line 22 defines a function with the same name and purpose. Move the dtype map and the conversion into a shared private module under python/cudnn/ops/, and let each operation declare its own supported subset. This keeps one source for the cuDNN enum values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudnn/ops/fft_causal_conv1d.py` around lines 7 - 24, Move the shared
cuDNN dtype-to-enum map and conversion logic from _dtype_to_int in
fft_causal_conv1d.py and its duplicate in causal_conv1d.py into a private module
under python/cudnn/ops/. Update both operations to reuse that shared helper
while retaining each operation’s own supported-dtype subset and validation
behavior.

165-167: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Confirm that the backend fully overwrites dx.

Line 167 uses zeros_like for grad_weight because the kernel accumulates. Line 165 uses empty_like for grad_x, which assumes the kernel writes every element of dx. Confirm that assumption for both the medium and long kernels. If either kernel accumulates into dx, the gradient contains uninitialized memory.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudnn/ops/fft_causal_conv1d.py` around lines 165 - 167, Inspect the
medium and long cuhyena kernel implementations invoked by the surrounding
backward path and verify whether each fully overwrites every element of grad_x.
If either kernel accumulates into dx or leaves any elements untouched,
initialize grad_x with zeros_like(x) before dispatch; otherwise retain
empty_like only when both kernels guarantee complete writes.

109-120: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

The mirrored buffer formula is verified for one dtype only.

_long_buffer_size_bytes reimplements a cuDNN internal layout. Line 117 assumes a 4-byte scratch element for FP16 and BF16, and an 8-byte element for FP64. The only test that compares this formula against the backend query is test/python/test_fft_causal_conv1d.py Line 98, which passes 0 (CUDNN_DATA_FLOAT).

If the assumption is wrong for FP16, BF16, or FP64, _long_fwd_fake reports a wrong reserve size. Under torch.compile, downstream shape reasoning then uses that wrong size. Extend the comparison test to every supported dtype.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudnn/ops/fft_causal_conv1d.py` around lines 109 - 120, Extend the
backend-versus-formula buffer-size comparison in test_fft_causal_conv1d.py
around the existing test to run for every supported dtype, including FP16, BF16,
FP32, and FP64, rather than only CUDNN_DATA_FLOAT. Reuse the existing test
structure and dtype-to-backend mapping while validating _long_buffer_size_bytes
for each case.

99-102: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The == _LONG_FFT_MAX_LENGTH bounds depend on the power-of-two precondition.

Both checks compare kernel_size against _LONG_FFT_MAX_LENGTH with ==. They are correct only because Line 95 forces a power of two and Line 97 caps the value at _LONG_FFT_MAX_LENGTH, which makes 16777216 the single value above 8388608. If _LONG_FFT_MAX_LENGTH changes, the FP64 check silently stops rejecting 8388608 < kernel_size < _LONG_FFT_MAX_LENGTH.

Also, the FP64 message states the supported bound but omits the rejected value.

♻️ Proposed change
-    if dtype == torch.float64 and kernel_size == _LONG_FFT_MAX_LENGTH:
-        raise ValueError("Long FFT FP64 supports kernel_size through 8388608.")
+    if dtype == torch.float64 and kernel_size > _LONG_FFT_FP64_MAX_LENGTH:
+        raise ValueError(f"Long FFT FP64 supports kernel_size through {_LONG_FFT_FP64_MAX_LENGTH}; got {kernel_size}.")
-    if kernel_size == _LONG_FFT_MAX_LENGTH and _cuda_arch(device) < 900:
-        raise ValueError("Long FFT kernel_size 16777216 requires compute capability 9.0 or newer.")
+    if kernel_size >= _LONG_FFT_MAX_LENGTH and _cuda_arch(device) < 900:
+        raise ValueError(f"Long FFT kernel_size {_LONG_FFT_MAX_LENGTH} requires compute capability 9.0 or newer.")

Add the new constant next to the existing bounds:

_LONG_FFT_FP64_MAX_LENGTH = 1 << 23
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudnn/ops/fft_causal_conv1d.py` around lines 99 - 102, Replace the
FP64 equality check in the FFT validation flow with an explicit upper-bound
check using a new _LONG_FFT_FP64_MAX_LENGTH constant set to 1 << 23, while
retaining the existing overall _LONG_FFT_MAX_LENGTH and CUDA-architecture
checks. Update the FP64 error message to state the supported maximum and the
rejected kernel size range/value clearly.
python/cudnn/ops/__init__.py (1)

4-5: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add __all__ to declare the exported wrappers.

The coding guidelines require that frontend kernel packages export their API class and wrapper through __all__. This file re-exports four wrappers with no __all__. The gap predates this change, and the new fft_causal_conv1d export extends it.

As per coding guidelines: "Frontend kernel packages must export their API class and wrapper through __all__."

♻️ Proposed change
 from .causal_conv1d import causal_conv1d, causal_conv1d_nwh, b2b_causal_conv1d
 from .fft_causal_conv1d import fft_causal_conv1d
+
+__all__ = [
+    "causal_conv1d",
+    "causal_conv1d_nwh",
+    "b2b_causal_conv1d",
+    "fft_causal_conv1d",
+]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudnn/ops/__init__.py` around lines 4 - 5, Define an __all__
declaration in the package initializer listing the four re-exported wrappers:
causal_conv1d, causal_conv1d_nwh, b2b_causal_conv1d, and fft_causal_conv1d,
matching the existing public imports.

Source: Coding guidelines

python/pycudnn.cpp (1)

414-415: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Compare the status against CUDNN_STATUS_SUCCESS.

The five new bindings use status != 0. The existing helper at Line 62 compares against CUDNN_STATUS_SUCCESS. Use the enum constant so the new code matches the established pattern in this file.

♻️ Proposed change, shown for the forward binding
-              if (status != 0)
+              if (status != CUDNN_STATUS_SUCCESS)
                   throw std::runtime_error("cudnnFFTCausalConv1dForward failed with status " + std::to_string(status));

Also applies to: 441-442, 456-458, 489-491, 521-523

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/pycudnn.cpp` around lines 414 - 415, Update the status checks in all
five new cuDNN bindings, including the forward binding and the locations
corresponding to the other reported ranges, to compare against
CUDNN_STATUS_SUCCESS instead of the literal 0. Preserve the existing
runtime_error messages and failure handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/cudnn/__init__.py`:
- Around line 59-63: Update python/cudnn/ops/__init__.py to register both
Torch-dependent convolution modules or APIs in _LAZY_OPTIONAL_IMPORTS and define
the module’s __all__ entries for the exposed convolution symbols. Ensure
importing cudnn.ops stays Torch-free and missing Torch raises the established
install-hint ImportError when those APIs are accessed.

In `@python/cudnn/ops/fft_causal_conv1d.py`:
- Around line 265-268: Confirm the gradient-buffer contract for
cudnnLongFFTCausalConv1dBackward at
python/cudnn/ops/fft_causal_conv1d.py:265-268 and update grad_weight to
zeros_like(weight) if the kernel accumulates, adding the explanatory comment
used at the medium path; also confirm whether both backward kernels fully write
dx, and change grad_x to zeros_like(x) wherever accumulation occurs. Record the
confirmed contract beside each allocation, including the sibling site at
python/cudnn/ops/fft_causal_conv1d.py:165-167, so both paths remain consistent.

In `@samples/cpp/causal_conv1d/fft_causal_conv1d.cpp`:
- Around line 53-99: Update the FFT causal convolution test cases, including
“FFT causal conv1d medium forward and backward,” to initialize deterministic
inputs and verify y_tensor, dx_tensor, and dweight_tensor against a reference
calculation or expected values after execution. Follow the required sample
sequence by validating and building the operation graph, creating plans,
checking support with a graceful skip when unsupported, then executing and
asserting results for both forward and backward paths.

---

Nitpick comments:
In `@python/cudnn/ops/__init__.py`:
- Around line 4-5: Define an __all__ declaration in the package initializer
listing the four re-exported wrappers: causal_conv1d, causal_conv1d_nwh,
b2b_causal_conv1d, and fft_causal_conv1d, matching the existing public imports.

In `@python/cudnn/ops/fft_causal_conv1d.py`:
- Around line 7-24: Move the shared cuDNN dtype-to-enum map and conversion logic
from _dtype_to_int in fft_causal_conv1d.py and its duplicate in causal_conv1d.py
into a private module under python/cudnn/ops/. Update both operations to reuse
that shared helper while retaining each operation’s own supported-dtype subset
and validation behavior.
- Around line 165-167: Inspect the medium and long cuhyena kernel
implementations invoked by the surrounding backward path and verify whether each
fully overwrites every element of grad_x. If either kernel accumulates into dx
or leaves any elements untouched, initialize grad_x with zeros_like(x) before
dispatch; otherwise retain empty_like only when both kernels guarantee complete
writes.
- Around line 109-120: Extend the backend-versus-formula buffer-size comparison
in test_fft_causal_conv1d.py around the existing test to run for every supported
dtype, including FP16, BF16, FP32, and FP64, rather than only CUDNN_DATA_FLOAT.
Reuse the existing test structure and dtype-to-backend mapping while validating
_long_buffer_size_bytes for each case.
- Around line 99-102: Replace the FP64 equality check in the FFT validation flow
with an explicit upper-bound check using a new _LONG_FFT_FP64_MAX_LENGTH
constant set to 1 << 23, while retaining the existing overall
_LONG_FFT_MAX_LENGTH and CUDA-architecture checks. Update the FP64 error message
to state the supported maximum and the rejected kernel size range/value clearly.

In `@python/pycudnn.cpp`:
- Around line 414-415: Update the status checks in all five new cuDNN bindings,
including the forward binding and the locations corresponding to the other
reported ranges, to compare against CUDNN_STATUS_SUCCESS instead of the literal
0. Preserve the existing runtime_error messages and failure handling.

In `@test/python/test_fft_causal_conv1d.py`:
- Around line 11-20: Update _require_fft_causal_conv1d to skip unless CUDA is
available, the existing cuDNN version and symbol checks pass, and
torch.cuda.get_device_capability() is supported by the FFT path’s _cuda_arch
requirements. Keep the existing skip behavior and use the capability check
before _make_inputs creates CUDA tensors.
- Around line 94-99: Extend test coverage in
test_long_fft_fake_buffer_formula_matches_backend_query and the existing
long-path tests: parameterize supported FP16, BF16, FP32, and FP64 dtypes so
both long forward/backward primitives and grad_weight initialization are
exercised, and move these broad sweeps above L0. Parameterize the buffer-size
assertion across every supported dtype while retaining the matching
dtype-to-backend mapping. Add a higher-level marked test that wraps
fft_causal_conv1d with torch.compile and compares its output with eager
execution.
- Around line 28-31: Update _make_inputs and the test’s grad_out setup to use a
reproducible CUDA RNG, either by seeding a CUDA generator before creating x,
weight, and grad_out or by wrapping generation with torch_fork_set_rng. Add a
separate tolerance for weight.grad comparisons, reflecting its distinct
reduction error scale, while retaining the existing tolerance for the output and
x.grad checks.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9774b3f2-db7d-4143-ada9-9b2c528c296e

📥 Commits

Reviewing files that changed from the base of the PR and between 11c16ff and d8234df.

📒 Files selected for processing (15)
  • docs/operations/CausalConv1d.md
  • docs/operations/FFTCausalConv1d.md
  • include/cudnn_frontend_shim.h
  • llms.txt
  • python/cudnn/__init__.py
  • python/cudnn/ops/__init__.py
  • python/cudnn/ops/causal_conv1d.py
  • python/cudnn/ops/fft_causal_conv1d.py
  • python/pycudnn.cpp
  • samples/cpp/CMakeLists.txt
  • samples/cpp/causal_conv1d/fft_causal_conv1d.cpp
  • samples/python/66_fft_causal_conv1d_forward.ipynb
  • samples/python/67_fft_causal_conv1d_backward.ipynb
  • test/python/test_causal_conv1d.py
  • test/python/test_fft_causal_conv1d.py

Comment thread python/cudnn/__init__.py
Comment thread python/cudnn/ops/fft_causal_conv1d.py
Comment thread samples/cpp/causal_conv1d/fft_causal_conv1d.cpp
@yeliu-oss
yeliu-oss requested a review from Anerudhan August 11, 2026 22:26
@yeliu-oss
yeliu-oss force-pushed the yeliu/reland-fft-causal-conv1d branch from 15daaaa to 926794c Compare August 12, 2026 14:06
@Anerudhan

Copy link
Copy Markdown
Collaborator

@cudnn-ci-bot run python_tests

@Anerudhan Anerudhan added mod-backend cuDNN backend API, graph execution, descriptors, engines, or backend integration. orig-nv-eng Reported or requested by NVIDIA engineering. cat-enhancements labels Aug 19, 2026
@Anerudhan Anerudhan added this to the Frontend 1.28.0 milestone Aug 19, 2026
@cudnn-ci-bot

Copy link
Copy Markdown

🚀 Running mirror pipeline

Branch: cudnn-gh/pr-542-73b6beb
Pipeline: 63559827
Targets: python_tests

@yeliu-oss
yeliu-oss merged commit f92674e into NVIDIA:develop Aug 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat-enhancements mod-backend cuDNN backend API, graph execution, descriptors, engines, or backend integration. orig-nv-eng Reported or requested by NVIDIA engineering.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants