FFT: fix grid and mini-batch#87
Open
AntonOresten wants to merge 1 commit into
Open
Conversation
Signed-off-by: AntonOresten <antonoresten@proton.me>
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.
Description
The FFT sample currently passes the full batch as the kernel's
BSconstant while also launching a grid of(BS, 1, 1)blocks. Each block then loads a(BS, …)tile, so every block redundantly processes the whole batch. The cost scales with batch and spills hard at modest sizes.This PR re-interprets the kernel's
BSconstant as a per-block minibatch size and sizes the grid asBatch // BSaccordingly. The wrapper exposes it as aminibatch: int = 1parameter; the kernel and its internal tile shapes are unchanged.Measured on a DGX Spark, N=512, batch=64, factors=(8,8,8), minibatch=1: kernel launch time goes from 2376 μs -> 12 μs (~200x), with twiddle factors precomputed (as they would be in any real use).
Sweep of minibatch ∈ {1, 2, 4} are all correct against
torch.fft.fft, with no consistent win forminibatch > 1at these problem sizes (registers/shared mem fill quickly). Thus,BS/minibatchcould, and maybe should be dropped entirely.x-ref JuliaGPU/cuTile.jl#232
Checklist