Use cublasHgemm "back" for fp16 computation with Volta GPU#3765
Merged
Use cublasHgemm "back" for fp16 computation with Volta GPU#3765
Conversation
Contributor
Author
|
@SherlockNoMad feel free to take over this PR if we want it asap in latest benchmarking. |
SherlockNoMad
approved these changes
Apr 30, 2020
Tixxx
approved these changes
Apr 30, 2020
Contributor
There was a problem hiding this comment.
Can you verify convergence? previously, the accumulation is done in FP32. But with this change, the accumulation will be done in FP16. For training, probably it is not a good idea to use hgemm, even it is OK for bert-l, but may not be OK for other big models.
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: Use cublasHgemm for fp16 computation with Volta GPU
cublasHgemm is used for fp16 computation with Volta GPU before training code is merged into master. For historical reasons when we did master->old training branch internally merge, we commented out that path. So I used "back" in PR title to indicate this change is just re-enable existing path.
This change should do no harm for inference because it is the case already in master before training is merged.
This change bring perf improvement on training, tested on 32GV100.
The reasons exists here https://docs.nvidia.com/cuda/cublas/index.html#cublassetmathmode.
cublasGemmEx's computation type is CUDA_R_32F, though its main data inputs.outputs are CUDA_R_16F. cublasHgemm did CUDA_R_16F computation.
Motivation and Context