Fix cuDNN convolution precision on Ampere+ GPUs#3127
Merged
davisking merged 1 commit intodavisking:masterfrom Dec 28, 2025
Merged
Fix cuDNN convolution precision on Ampere+ GPUs#3127davisking merged 1 commit intodavisking:masterfrom
davisking merged 1 commit intodavisking:masterfrom
Conversation
On Ampere and later GPUs (SM 8.0+), cuDNN's default math mode permits TF32 Tensor Core operations which use reduced mantissa precision. This causes numerical differences when comparing CUDA vs CPU convolution results, particularly in cudnnConvolutionBackwardFilter(). Explicitly set CUDNN_FMA_MATH to force true FP32 computation for consistent numerical results across all GPU architectures.
Owner
|
Sweet, thanks for another PR :D |
Contributor
|
@joelnn, Would it be worth considering CUDNN_TENSOR_OP_MATH_ALLOW_CONVERSION instead of CUDNN_FMA_MATH to maintain Tensor Core performance on Ampere+ GPUs? This would only require relaxing one or two test tolerances from 1e-3 to 2e-3 in test_conv(), which seems acceptable given the significant performance benefit... |
Contributor
Author
|
@Cydral thats alright with me, I mainly wanted tests to pass. I would've thought that reducing precision should be opt-in, but following the default policy of cuDNN would also be a reasonable policy. |
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.
On Ampere and later GPUs (SM 8.0+), cuDNN's default math mode permits TF32 Tensor Core operations which use reduced mantissa precision. This causes numerical differences when comparing CUDA vs CPU convolution results, particularly in cudnnConvolutionBackwardFilter().
Explicitly set CUDNN_FMA_MATH to force true FP32 computation for consistent numerical results across all GPU architectures.