Skip to content

Name the method that keeps an FFTMethod convolution off the device rule - #1050

Merged
seabbs merged 3 commits into
mainfrom
fix/fft-device-named
Dec 4, 2026
Merged

seabbs merged 3 commits into
mainfrom
fix/fft-device-named

Conversation

@seabbs-bot

@seabbs-bot seabbs-bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1031.
An FFTMethod() convolution on device arrays still takes plain AD, but the notice now names the method and says to pass Direct().
The three "by the transform" registry scenarios are listed as plain AD on a device, so the CUDA registry expects what they do.

Needs your decision: keep this, or let the device rule take FFTMethod() too (gate on Convolution{<:_DeviceKernel}, since a device call runs the direct method anyway), or refuse FFT on a device with a message.

Claude Opus 5.5 [medium]

What happened before

A device call runs the direct method whatever was asked: the FFTW extension sends any non-host array to it.
The device gate only takes Convolution{<:_DeviceKernel, Direct} (and Direct for computed kernels), so an FFTMethod() convolution on a device took plain AD.
It was not fully silent: the generic _device_whys logged "Convolution has no rule on device arrays".
That names neither the field nor the fix, unlike the #955 notices.

Change

  • _device_whys(::Convolution) in src/operators/convolution.jl names what keeps a convolution off the device rule:
    • its method, when it is not Direct(): the method, FFTMethod(), has no rule on device arrays: pass Direct(), the method a device call runs;
    • its kernel, when that has no device rule (a change-point kernel, say): the kernel, a TimeVarying, has no rule on device arrays.
      The kernel check reuses _device_ready on Convolution(c.kernel), so it covers fixed, dense time-varying, ragged and computed kernels without a second list. It only runs once per signature, on the notice path.
  • test/unit/device_rules.jl checks, on JLArrays, that an FFTMethod() convolution routes to :plain, that _stopped_whys gives the method message, that _note_stopped logs it once and then nothing, and that a change-point kernel is named by its kernel.
  • test/registry/tests.jl adds the three "by the transform" scenarios to DEVICE_PLAIN. This is what the CUDA run in An FFTMethod() convolution on device arrays takes plain AD, not the rule #1031 failed on.

The device rule itself is unchanged.
Making the gate ignore the method (Convolution{<:_DeviceKernel}) looks close to trivial, since both passes call _fft_path, which is false for device arrays with FFTW loaded.
It is left out as #1031 frames it as a design decision on #1027.

Checks

On Julia 1.13.4, locally:

  • "JLArrays: calls whose reverse pass runs on a device take the rule": 45 pass.
  • "JLArrays: the rule passes of a fixed convolution and of a recurrence match the CPU": 80 pass.
  • "Registry: the lists name scenarios the registry holds": 9 pass.

The CUDA registry is not run in CI, and I have no GPU here, so the DEVICE_PLAIN entries are not checked on a device.

This was opened by a bot. Please ping @seabbs for any questions.

A device call runs the direct method, so an FFTMethod() convolution there
keeps plain AD. The notice should name the method rather than the
operator. Fails until the convolution names what keeps it from the rule.

Refs #1031.
An FFTMethod() convolution on device arrays took plain AD with only the
generic 'Convolution has no rule on device arrays'. _device_whys for a
convolution now names its method, saying to pass Direct(), and its
kernel when that has no device rule.

Closes #1031.
The CUDA registry expected the rule for the three 'by the transform'
scenarios. A device call runs the direct method, so they keep plain AD
there and name their method.

Refs #1031.
@seabbs-bot
seabbs-bot requested a review from seabbs as a code owner December 4, 2026 10:26
@seabbs
seabbs merged commit f28f5ec into main Dec 4, 2026
6 of 26 checks passed
@seabbs-bot seabbs-bot mentioned this pull request Dec 4, 2026
15 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An FFTMethod() convolution on device arrays takes plain AD, not the rule

2 participants