Open dkolsen-pgi opened 3 months ago
The #define __ELF__
seemed to have been introduced in 2939fce44a4f22a81c976f88734c9115c5cedb64, maybe @griwes can help here.
That was work to make libunwind and libcxxabi compile with nvc++, so the define should be safe to drop entirely if it is now causing trouble; we'll see if anything unexpected depends on it in CI.
Older versions of NVC++ don't define __ELF__
, and we want to give users the freedom to mix and match NVCC and NVC++ versions (within reason). Unless the reason for needing __ELF__
to be defined no longer applies, the define shouldn't be dropped entirely.
I believe we should keep the definition in place when necessary.
I have opened #2018 to only define the macro when it is not present.
That retains the current behavior and lets us play nice with all nvc++ versions
Is this a duplicate?
Type of Bug
Something else
Component
libcu++
Describe the bug
When NVC++ 24.7 (soon to be released) or dev is the host compiler for NVCC and a CCCL header is included (probably not every header, but a good number of them), then NVC++ will issue a warning about the macro
__ELF__
being redefined while it is doing its preprocessing.In HPC SDK 24.7, we fixed an NVC++ bug where
__ELF__
is not defined. Now__ELF__
is always predefined by the compiler as1
on all Linux targets. The CCCL header<cuda/std/detail/libcxx/include/__config>
defines__ELF__
as empty when the compiler is NVC++ or NVRTC.I am guessing, but haven't confirmed, that the system header pragmas are ignored when NVC++ is doing preprocessing only. That's why we see this preprocessor-related warning when NVC++ is the host compiler for NVCC, but not with
nvc++ -stdpar
.This problems starts with NVC++ 24.7. It doesn't show up with older versions of NVC++. It shows up with all versions of NVCC, back to at least CUDA 11.0.
How to Reproduce
Compile a file that includes some CCCL headers with NVCC with NVC++ 24.7 as the host compiler.
Expected behavior
CCCL should be fixed to avoid the warning. (Even though a change to NVC++ triggered the warning, NVC++ isn't doing anything wrong. The incorrect code is in CCCL.)
This block of code in
cuda/std/detail/libcxx/include/__config
:can be changed to any of these:
I believe that any of those changes should work. I think combining 1 and 3 works best:
because it is the safest change (checking that
__ELF__
is not defined before defining it) and it defines__ELF__
correctly (1
instead of empty).Reproduction link
No response
Operating System
Linux
nvidia-smi output
No response
NVCC version
Any NVCC version. It is the NVC++ version that makes a difference.