Skip to content
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

[BUG]: Including cuda/std/atomic disables deprecation warnings in MSVC 2019 #3019

Open
1 task done
bsadri opened this issue Dec 3, 2024 · 6 comments
Open
1 task done
Assignees
Labels
bug Something isn't working right.

Comments

@bsadri
Copy link

bsadri commented Dec 3, 2024

Is this a duplicate?

Type of Bug

Something else

Component

libcu++

Describe the bug

If I compile the following simple program using MSVC 2019 (latest)

#include <iostream>

struct Foo
{
    [[deprecated]] void bar()
    {
        std::cout << "Bar!" << std::endl;
    }
};

int main()
{
    Foo foo;
    foo.bar();
}

I get the following (expected) error: error C4996: 'Foo::bar': was declared deprecated. That this is an error and not a warning may have to do with my other compiler flags and is not the issue here. However, if I add the following include to the top of the code:

#include <cuda/std/atomic>

Then I get no warnings or errors at all and everything goes through.

For comparison, this is not the case if I included <cuda/std/tuple> instead. It also doesn't happen when compiling with either gcc or clang in WSL.

How to Reproduce

Put the code mentioned above in a cpp source file and compile it with typical flags using MSVC. In case I'm wrong about typical flags, I'm using the following relevant flags: -std:c++17 -MD -W4 -WX -wd4505 -bigobj -permissive- -wd4003 -wd4127 -wd4324.

Expected behavior

I think the problem is self-evident. I would never expect the inclusion of a header from CCCL to have a side effect as big as suppression of deprecation warnings. It took me a fair amount of time to trace this back to CCCL, going through a fair bit of trouble to check the compiler flags and even update the compiler itself.

Reproduction link

No response

Operating System

Windows 11

nvidia-smi output

No response

NVCC version

No response

@bsadri bsadri added the bug Something isn't working right. label Dec 3, 2024
@github-project-automation github-project-automation bot moved this to Todo in CCCL Dec 3, 2024
@jrhemstad
Copy link
Collaborator

@miscco can you take a look at this?

@miscco
Copy link
Collaborator

miscco commented Dec 4, 2024

I was not able to reproduce this locally with VS2022, passing to @wmaxey to check with 2019 because it is a pain to install

@wmaxey
Copy link
Member

wmaxey commented Dec 4, 2024

@bsadri What exact version of MSVC and NVCC are you working with? I need the version dumps for both to have a shot at reproducing.

With CUDA 12.6 + 14.16 (2017 latest) and 14.29 (2019 latest), both compilers fail in the expected way.

@bsadri
Copy link
Author

bsadri commented Dec 6, 2024

I'm using the latest Visual Studio 2019 (16.11.42) and running the compiler from the command line:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30157 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

I'm not using nvcc to build the example, but I have 12.6 installed on the system.

@miscco
Copy link
Collaborator

miscco commented Dec 6, 2024

I'm not using nvcc to build the example, but I have 12.6 installed on the system.

Can you still provide the exact version of cccl you are using? I cannot reproduce this with VS2022 or VS2017:

C:\src\cccl>cl -Ilibcudacxx/include main.cpp -MD -W4 -WX -wd4505 -bigobj -permissive- -wd4003 -wd4127 -wd4324
Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34604 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

main.cpp
main.cpp(16): error C2220: the following warning is treated as an error
main.cpp(16): warning C4996: 'Foo::bar': was declared deprecated
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.43.34604\include\__msvc_ostream.hpp(781): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.43.34604\include\__msvc_ostream.hpp(781): note: the template instantiation context (the oldest one first) is
main.cpp(9): note: see reference to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const char *)' being compiled

C:\src\cccl>

@bsadri
Copy link
Author

bsadri commented Dec 9, 2024

Sorry, for the delayed response. I'm on cccl 2.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right.
Projects
Status: Todo
Development

No branches or pull requests

4 participants