Repository navigation
Threads for single real lines and real-to-real lines - #27
Merged
Merged
Conversation
A single long line of a real transform ran on one thread: the real transforms of a non-smooth length, and all real-to-real transforms of one line. Two causes: - line_tasks gives one task for line kernels with buffers of their own (Bluestein, composite). Every task now gets its own copy of such a kernel (task_lines, task_reallines, rline_task), so the lines of a non-smooth dimension run on several tasks. - A single line had no parallel loop for the real-to-real kinds. An even line from 2^17 points on uses a half-length complex DFT with pre- and post-processing on several tasks (DCT-II, DST-II, DHT, DCT-III, DST-III, DCT-IV, DST-IV); an odd line uses one complex DFT of length 2n (n for the DHT). DCT-I and DST-I use the even and odd extension of length 2(n-1) and 2(n+1). Checked against FFTW: relative error 1e-15 for all kinds, odd and even lengths and 1 to 3 dimensions with 8 threads. The test suite passes except for a test that needs KernelAbstractions in the test environment. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
A single real line of a non-smooth length ran on one thread: the half-length DFT (the full length for odd n) has buffers of its own, and only four-step (smooth lengths) was threaded. The line now uses the composite or Bluestein kernel on several threads, like the complex transform of the same length. Non-smooth lines start at real_bluestein_bytes = 2^17 (Float32 gains from about 130 KB, Float64 from about 240 KB on the measured machine); smooth lines keep real_fourstep_bytes = 2^18. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…nel type task_reallines built the copies of a line with buffers of their own (a non-smooth length on several tasks) with the default kernel type, but RRFFTPlan stores lines of RChain kernels. Non-smooth lengths on more than one thread then failed: the r2c and c2r plans of length 101 with 4 threads gave wrong results in libfftl (FFTW3 interface test). The copies now take the kernel type of the plan. A test covers run-time plans of non-smooth lengths on 4 threads. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
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.
Summary
A single long real line ran on one thread in several places:
task_reallines,rline_task), so lines of a non-smooth dimension run on several tasks.Thresholds
real_fourstep_bytes = 2^18(unchanged) for smooth lines.real_bluestein_bytes = 2^17for non-smooth lines. Measured on an Apple M1 Max with 8 threads: Float32 non-smooth lines gain from about 130 KB, Float64 non-smooth from about 240 KB. Smooth Float32 lines between 2^17 and 2^18 bytes did not show a clear gain, so their threshold is unchanged.Accuracy
Relative error against FFTW about 1e-15 (Float64) and 3e-7 (Float32) for all kinds, even and odd lengths, 1 to 3 dimensions, 8 threads.
Tests
Limits
Lines below the thresholds still run on one thread, by design. The gain is measured on one machine (M1 Max, 8 threads); the 16-thread EPYC panel has not been re-measured.
🤖 Generated with Claude Code