NVIDIA / NVIDIA/cccl

[BUG]: The CUDA SDK defines the reserved identifier __noinline__, breaking Clang and GCC interoperation

Open
#1,235 9 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Type of Bug

Compile-time Error

### Component

Not sure

### Describe the bug

I maintain libc++, the C++ Standard Library shipped with LLVM / Clang. We recently received [a bug report](https://github.com/llvm/llvm-project/pull/73838) explaining that using Clang (and libc++ in particular) with the CUDA SDK didn't work anymore, because the CUDA SDK is defining `__noinline__` to `__attribute__((__noinline__))` for convenience and that conflicts with libc++'s usage of `__attribute__((__noinline__))`.

This is both non-standard and poor practice on the CUDA SDK's side -- underscore names are reserved for the *programming language implementation*. It seems like this was reported in the past as https://github.com/NVIDIA/thrust/issues/1703 but I'm not certain the problem was taken seriously.

I would like to gauge whether there is interest for migrating away from that macro and restoring proper interoperability between the CUDA SDK and Clang, GCC and their standard library implementations. If you can establish a migration path away from the macro, libc++ can work around the issue in the meantime to avoid leaving users stranded. However, we would like to have a commitment from CUDA that a migration path will be created to fix the problem in the long term -- otherwise libc++ would just be bending backwards to work around arbitrary vendor's decisions forever, and that is not workable for us.

Note that while this problem is not widespread yet, it will start hitting anyone who updates to LLVM 18 because libc++ introduced new uses of `__attribute__((__noinline__))`. We expect this is going to become a fairly widespread problem if nothing is done.

Note: If this is not the right place to file a bug against the CUDA SDK, please let me know where I can do so. I am not a CUDA SDK user myself, but I am reaching out because I believe our two implementations working together well is important for the ecosystem.

### How to Reproduce

```
#include
#include
```

### Expected behavior

It compiles

### Reproduction link

_No response_

### Operating System

_No response_

### nvidia-smi output

_No response_

### NVCC version

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.