After the Microsoft Visual Studio upgrade from version 17.4 to 17.6.2 I started to get the above error for every .cu file in the project. I end up with two versions of Visual Studio installed on my computer, 17.4 LTS and 17.6.5. 17.4 LTS compiles the code without any issues, but 17.6.5 always returns the following error for every CUDA file in the project:
Hi, it seems to be an issue with how the MSVC implements std::source_location using the new c++20 type of constant evaluation that NVCC doesn’t support yet.
I posted a code snippet in the other thread about how to work around it for anyone that might be having the same issue.
This maps to NVBUG 4666709 4664399
[Public] Hi Mark ,
Thanks for filing this ticket . We were aware of this issue yesterday , VS 2022 v17.10 just released almost on same day to our 12.5 . Our compiler engineering team is eagerly working on this problem . We will keep users informed once it is resolved . Please kindly try an older MSVC version other than the latest 14.40.33807 as a workaround if this is being any real blocker to you . Thanks !
You don’t need to rollback the VS IDE version to 17.9.7.
You can keep 17.10.0, you just need to go to the VS Installer, and under Individual Components, select the MSVC Build Tools x64/x86 14.39 - 17.9. This will give you the new IDE but with the old compiler & build tools.
Still, this issue is a big bummer - it will probably mean that if you need an older CUDA version, you’ll be stuck on the MSVC14.39 build tools version, so we need to wait using the latest MSVC compiler until the very last part of the dependency chain has updated CUDA to 12.5 / 12.6 or whatever version will have this issue fixed.
I hope that perhaps NVIDIA can release maintenance patches for older CUDA versions as a solution to this @Yuki_Ni?
We are glad to let you know the issue is fixed and verified in house . This fix will be part of next Update release of CUDA 12.5 soon . We don’t back port fixes to older CUDA releases and there is no patch version to older CUDA releases . To make previous version work on c++20 (the issue is specific to c++20) , please use MSVC < 14.40.33807 . Thanks again for reporting this .