cuFFT: synchronize the plan stream before cufftXtMemcpy in the multi-GPU samples - #367
Open
kevmo314 wants to merge 1 commit into
Open
cuFFT: synchronize the plan stream before cufftXtMemcpy in the multi-GPU samples#367kevmo314 wants to merge 1 commit into
kevmo314 wants to merge 1 commit into
Conversation
…GPU samples Signed-off-by: Kevin Wang <kevmo314@gmail.com>
kevmo314
force-pushed
the
cufft-mgpu-stream-sync
branch
from
September 10, 2026 07:44
8e0b952 to
d01bba7
Compare
|
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.
The multi-GPU cuFFT samples associate a stream with the plan (cuFFT >= 10.4.0) and then call
cufftXtMemcpy(..., CUFFT_COPY_DEVICE_TO_HOST)right aftercufftXtExecDescriptor. The execution is ordered on that stream, but the readback is not: it runs on the plan's per-GPU streams, which do not wait for the streams that ran the last transform kernels. When the GPU is busy the copy lands before those kernels finish and the sample reports a wrong result.Reproduction on an RTX 4090 (CUDA 13.3, driver 590.48), eight instances of
1d_mgpu_c2c_examplerunning concurrently:FAILED with L2 error = 0.122098(one 16-element chunk of the output still holds its input values)Sequential runs pass either way, which is why it is easy to miss.
The fix synchronizes the plan's stream after each
cufftXtExecDescriptor, inside the sameCUFFT_VERSION >= 10400block that creates the stream, in all three multi-GPU samples (1d_mgpu_c2c,3d_mgpu_c2c,3d_mgpu_r2c_c2r), since they share the pattern.