NVIDIA / NVIDIA/cccl

[BUG]: CUB "eats" inline qualifier ignored for "__global__" function warning

Open
#319 1 comment 0 reactions 1 assignee Claimed by @wmaxey View on GitHub
needs triage
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

Silent Failure

### Component

CUB

### Describe the bug

Compiling the following code with nvcc normally emits a warning:
``` cuda
__global__ inline void kernel_inline() {}
```
```
test.cu(31): warning #20050-D: inline qualifier ignored for "__global__" function
__attribute__((global))
```

CUB sometimes "eats" the warning:

``` bash
# Emits warning
nvcc -x cu <(echo "__global__ inline void kernel() {}")
/dev/fd/63(1): warning #20050-D: inline qualifier ignored for "__global__" function
__attribute__((global))

# Emits warning (CTK 12.2)
nvcc -c -x cu <(echo "#include
> __global__ inline void kernel() {}")
/dev/fd/63(2): warning #20050-D: inline qualifier ignored for "__global__" function
__attribute__((global))

# Does not emit warning (eaten by CUB): Versions 1.7 - 2.0X
nvcc -DTHRUST_IGNORE_CUB_VERSION_CHECK -I~/projects/cccl/cub -c -x cu <(echo "#include
__global__ inline void kernel() {}")

```

### How to Reproduce

With latest main branch in `~/projects/cccl`, this does not emit a warning:

```
nvcc -DTHRUST_IGNORE_CUB_VERSION_CHECK -I~/projects/cccl/cub -c -x cu <(echo "#include
__global__ inline void kernel() {}")
```

**NOTE**: this somehow does not reproduce on godbolt. I guess because it uses the CTK version of CUB.

### Expected behavior

I expect this warning to occur:

```
warning #20050-D: inline qualifier ignored for "__global__" function
__attribute__((global))
```

### Reproduction link

_No response_

### Operating System

Linux

### nvidia-smi output

NA. this is about compilation, not running code.

### NVCC version

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Jun_13_19:16:58_PDT_2023
Cuda compilation tools, release 12.2, V12.2.91
Build cuda_12.2.r12.2/compiler.32965470_0

Earlier 12.X versions as well.

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.