Change definition of _CCCL_NODISCARD_FRIEND - #4668
Conversation
🟨 CI finished in 1h 41m: Pass: 85%/178 | Total: 3d 21h | Avg: 31m 37s | Max: 1h 33m | Hits: 44%/267677
|
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| +/- | CUDA Experimental |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 178)
| # | Runner |
|---|---|
| 123 | linux-amd64-cpu16 |
| 15 | windows-amd64-cpu16 |
| 14 | linux-amd64-gpu-rtx2080-latest-1 |
| 12 | linux-arm64-cpu16 |
| 6 | linux-amd64-gpu-rtxa6000-latest-1 |
| 5 | linux-amd64-gpu-h100-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
5bd5754 to
fde142f
Compare
🟩 CI finished in 1h 00m: Pass: 100%/178 | Total: 1d 10h | Avg: 11m 44s | Max: 49m 00s | Hits: 81%/282293
|
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| +/- | CUDA Experimental |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 178)
| # | Runner |
|---|---|
| 123 | linux-amd64-cpu16 |
| 15 | windows-amd64-cpu16 |
| 14 | linux-amd64-gpu-rtx2080-latest-1 |
| 12 | linux-arm64-cpu16 |
| 6 | linux-amd64-gpu-rtxa6000-latest-1 |
| 5 | linux-amd64-gpu-h100-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
🟩 CI finished in 57m 20s: Pass: 100%/178 | Total: 1d 10h | Avg: 11m 29s | Max: 52m 49s | Hits: 84%/282293
|
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| +/- | CUDA Experimental |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 178)
| # | Runner |
|---|---|
| 123 | linux-amd64-cpu16 |
| 15 | windows-amd64-cpu16 |
| 14 | linux-amd64-gpu-rtx2080-latest-1 |
| 12 | linux-arm64-cpu16 |
| 6 | linux-amd64-gpu-rtxa6000-latest-1 |
| 5 | linux-amd64-gpu-h100-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
| # define _CCCL_NODISCARD_FRIEND | ||
| #else | ||
| # define _CCCL_NODISCARD_FRIEND [[nodiscard]] friend | ||
| # define _CCCL_NODISCARD_FRIEND [[nodiscard]] |
There was a problem hiding this comment.
This might be confusing without context, possibly misused. Wouldn't it be better to remove it for now and switch usage to _CCCL_NODISCARD friend?
There was a problem hiding this comment.
We dropped _CCCL_NODISCARD because everywhere else we can just use [[nodiscard]]
There was a problem hiding this comment.
I see and we can't use just [[nodiscard]] friend because of the clang issue from the comment? If that's the case then I agree with the approach from this PR
There was a problem hiding this comment.
from godbolt it looks like [[nodiscard]] friend works with the clang versions we support: https://godbolt.org/z/P9hrc6x99. then let's just get rid of the macro and use [[nodiscard]] friend.
There was a problem hiding this comment.
I investigated a bit and it is indeed an issue with clang-cuda that does not accept a [[nodiscard]] attribute after a __host__ or __device__ annotation
There are some occasions, where clang will error out a function that is annotated with `_CCCL_NODISCARD_FRIEND` The reason being that friend appears before the `_CCCL_HIDDEN` attribute which gives errors withcombinations of older CTK and clang We can work around this by not including friend in the macro defintion. That has also the advantage that its still clear that this is a friend function and should simplify updating it someday
b017fd6 to
630841e
Compare
630841e to
64ffef1
Compare
64ffef1 to
d3e6eb8
Compare
🟨 CI finished in 1h 30m: Pass: 98%/178 | Total: 3d 03h | Avg: 25m 24s | Max: 1h 25m | Hits: 68%/275812
|
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| +/- | CUDA Experimental |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 178)
| # | Runner |
|---|---|
| 123 | linux-amd64-cpu16 |
| 15 | windows-amd64-cpu16 |
| 14 | linux-amd64-gpu-rtx2080-latest-1 |
| 12 | linux-arm64-cpu16 |
| 6 | linux-amd64-gpu-rtxa6000-latest-1 |
| 5 | linux-amd64-gpu-h100-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
🟩 CI finished in 57m 24s: Pass: 100%/178 | Total: 1d 08h | Avg: 10m 51s | Max: 46m 09s | Hits: 87%/282319
|
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| +/- | CUDA Experimental |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 178)
| # | Runner |
|---|---|
| 123 | linux-amd64-cpu16 |
| 15 | windows-amd64-cpu16 |
| 14 | linux-amd64-gpu-rtx2080-latest-1 |
| 12 | linux-arm64-cpu16 |
| 6 | linux-amd64-gpu-rtxa6000-latest-1 |
| 5 | linux-amd64-gpu-h100-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
There are some occasions, where clang will error out a function that is annotated with
_CCCL_NODISCARD_FRIENDThe reason being that friend appears before the
_CCCL_HIDDENattribute which gives errors withcombinations of older CTK and clangWe can work around this by not including friend in the macro defintion. That has also the advantage that its still clear that this is a friend function and should simplify updating it someday