-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[BE] Fix CUDA build warnings #117023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] Fix CUDA build warnings #117023
Conversation
After https://github.com/pytorch/pytorch/pull/116595/files compiling every .cu file results in ``` /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning #173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=float, From=int64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=float, From=int64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h Remark: The warnings can be suppressed with "-diag-suppress <warning-number>" /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning #173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=float, From=uint64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=float, From=uint64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning #173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=double, From=int64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=double, From=int64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning #173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=double, From=uint64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=double, From=uint64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning #173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=c10::complex<float>, From=int64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=c10::complex<float>, From=int64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning #173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=c10::complex<float>, From=uint64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=c10::complex<float>, From=uint64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning #173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=c10::complex<double>, From=int64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=c10::complex<double>, From=int64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning #173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=c10::complex<double>, From=uint64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=c10::complex<double>, From=uint64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h ``` Fix it by using using `if constexpr` to avoid calling `static_cast<uint64_t>` for any floating point type
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/117023
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 1fdf900 with merge base 14be2ee ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
After https://github.com/pytorch/pytorch/pull/116595/files compiling every .cu file results in ``` /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning pytorch#173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=float, From=int64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=float, From=int64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h Remark: The warnings can be suppressed with "-diag-suppress <warning-number>" /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning pytorch#173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=float, From=uint64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=float, From=uint64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning pytorch#173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=double, From=int64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=double, From=int64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning pytorch#173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=double, From=uint64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=double, From=uint64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning pytorch#173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=c10::complex<float>, From=int64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=c10::complex<float>, From=int64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning pytorch#173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=c10::complex<float>, From=uint64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=c10::complex<float>, From=uint64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning pytorch#173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=c10::complex<double>, From=int64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=c10::complex<double>, From=int64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h /home/nshulga/git/pytorch/pytorch/c10/util/Half.h(450): warning pytorch#173-D: floating-point value does not fit in required integral type -static_cast<uint64_t>(f) > static_cast<uint64_t>(limit::max())); ^ detected during: instantiation of "std::enable_if_t<<expression>, __nv_bool> c10::overflows<To,From>(From, __nv_bool) [with To=c10::complex<double>, From=uint64_t]" at line 159 of /home/nshulga/git/pytorch/pytorch/c10/util/TypeCast.h instantiation of "To c10::checked_convert<To,From>(From, const char *) [with To=c10::complex<double>, From=uint64_t]" at line 122 of /home/nshulga/git/pytorch/pytorch/c10/core/Scalar.h ``` Fix it by using using `if constexpr` to avoid calling `static_cast<uint64_t>` for any floating point type Pull Request resolved: pytorch#117023 Approved by: https://github.com/albanD
After https://github.com/pytorch/pytorch/pull/116595/files compiling every .cu file results in
Fix it by using using
if constexprto avoid callingstatic_cast<uint64_t>for any floating point type