-
Couldn't load subscription status.
- Fork 25.7k
[c++] use constexpr instead of const #93267
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/93267
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 06cadeb: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Thanks for reviewing, @Skylion007! @pytorchbot label ciflow/trunk |
|
@pytorchmergebot 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 |
|
Hmm, this will break some ancient Windows builds(internally people report ICEs with old CUDA/VC++), but also, I remember there was a warning not to use |
|
Can we replace those with |
|
@malfet Seems reasonable to me, the constexpr is just a general C++ safety recomendation (making it constexpr allows for more compile time checks etc). Does CONSTEXPR_EXCEPT_WIN_CUDA make it as const on win CUDA? If so, that looks like a good candidate. |
|
Sorry, don't remember, I see that constexpr is used in the jiterator templates, so should be fine. |
I think this is what we want |
Summary: Followup after pytorch#93267 Generated by running: ``` for i in *.cu; do sed -i -e "s/constexpr char/CONSTEXPR_EXCEPT_WIN_CUDA char/" $i; done ``` Otherwise, attempts to compile using VS-15.9 results in: ``` D:\pytorch\aten\src\aten\native\cuda\laguerre_polynomial_l.cu(17): fatal error C1001: An internal error has occurred in the compiler. (compiler file 'msc1.cpp', line 1518) To work around this problem, try simplifying or changing the program near the locations listed above. Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Internal Compiler Error in D:\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe. You will be prompted to send an error report to Microsoft later. INTERNAL COMPILER ERROR in 'D:\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe' Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information ``` Test Plan: CI Differential Revision: D43011140 fbshipit-source-id: 77df036cd2838ac2d205e5bd1587982cfd730602
|
Here is the fix for VS2017 compiler exception: #94091 |
Summary: Followup after #93267 Generated by running: ``` for i in *.cu; do sed -i -e "s/constexpr char/CONSTEXPR_EXCEPT_WIN_CUDA char/" $i; done ``` Otherwise, attempts to compile using VS-15.9 results in: ``` D:\pytorch\aten\src\aten\native\cuda\laguerre_polynomial_l.cu(17): fatal error C1001: An internal error has occurred in the compiler. (compiler file 'msc1.cpp', line 1518) To work around this problem, try simplifying or changing the program near the locations listed above. Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Internal Compiler Error in D:\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe. You will be prompted to send an error report to Microsoft later. INTERNAL COMPILER ERROR in 'D:\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe' Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information ``` Test Plan: CI Differential Revision: D43011140 Pull Request resolved: #94091 Approved by: https://github.com/seemethere
As discussed in #93199 (comment).
cc: @Skylion007!