Template Metal C2C FFT scalar lanes - #3969
Open
PhysicistJohn wants to merge 1 commit into
Open
Conversation
PhysicistJohn
marked this pull request as draft
August 1, 2026 19:27
PhysicistJohn
force-pushed
the
codex/generic-metal-fft
branch
from
August 1, 2026 19:39
4b0e3b7 to
90b7f12
Compare
PhysicistJohn
marked this pull request as ready for review
August 1, 2026 19:40
PhysicistJohn
marked this pull request as draft
August 1, 2026 19:43
Template C2C FFT arithmetic and I/O over their scalar lane while retaining the existing static entry points and packed real paths. Make the C2C four-step second pass use the same generic storage path so future scalar lanes preserve the existing indexing and scaling behavior.
PhysicistJohn
force-pushed
the
codex/generic-metal-fft
branch
from
August 1, 2026 20:03
90b7f12 to
3bac56f
Compare
PhysicistJohn
marked this pull request as ready for review
August 1, 2026 20:15
This was referenced Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
MLX's Metal C2C FFT core hard-codes
float2. This PR is the narrow Metal-kernel foundation for #2112: it removes that source-level coupling so a later, end-to-end reduced-precision complex proposal can be evaluated without rewriting the FFT implementation first.The target use case is complex I/Q and signal-processing workloads, where storing real and imaginary lanes in FP16 or BF16 halves storage and bytes transferred relative to two FP32 lanes. This PR does not claim that lower precision is appropriate for every workload; public dtype semantics, host dispatch, operation coverage, accuracy policy, and new static instantiations remain separate work.
Existing accelerator-library precedent
This is not a novel representation:
CUDA_C_16Fand bfloat16-complexCUDA_C_16BFtransforms through its type-generic planning API.rocfft_precision_halftogether with complex interleaved and planar array layouts.Those are direct GPU-vendor FFT libraries. This patch only prepares MLX's C2C Metal implementation for equivalent storage lanes; it does not add a public reduced-precision complex type.
Scope
Binary-size impact
No new static kernels or public exports are instantiated.
mlx.metallib: 130,977,720 B → 130,994,264 Bmetal-nm -gexported-symbol output: exact match to the base buildValidation
xcrun metalcompile andmetalliblink of the changedfft.metalusing MLX's build flags.ctest261/261 passed, including all FFT cases.python -m unittest test_fft -v— 16 passed, 2 expected skips.half2andbfloat2across Stockham, Rader, Bluestein, and four-step planners.pre-commit(clang-format) andgit diff --checkpassed.Focused float32 regression checks
The second measurement is a focused dispatch-scale check, not a claim of a material performance change. There is no end-to-end reduced-precision performance claim until a future public dtype and dispatch path exists.