generator: loop if necessary for each FFT dim in 2D_SINGLE #606
+150
−113
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.
Previously, workgroup size for 2D_SINGLE kernels was chosen such that all FFTs in each dimension could be done with a single workgroup. But this becomes infeasible as dimensions get larger.
So instead, loop in the generator to perform enough FFTs for each dimension using the available threads. As a side effect this means the extra FFT for even-length real-complex can be done by existing threads rather than making the first N threads do it while the rest wait.
This PR shouldn't materially affect generated code, since all existing 2D_SINGLE configs use
max(length0*tpt1,length1*tpt0)
for workgroup size. So complex-complex kernels don't need to loop.Real-complex kernels are different though - they'll need an extra transform to be done in one direction or the other. Prior to this PR, we'd just make the first tpt0 or tpt1 threads do that extra transform while the rest waited. Now, it's possible in some cases for us to have enough extra threads to not have to do an extra iteration. That should be a small improvement but I haven't been able to observe it in our benchmark suite.