alpaka-group / alpaka

Abstraction Library for Parallel Kernel Acceleration :llama:
https://alpaka.readthedocs.io
Mozilla Public License 2.0
337 stars 69 forks source link

compile error at global mem alloc when RDC is false #2259

Open mehmetyusufoglu opened 2 months ago

mehmetyusufoglu commented 2 months ago

I faced a compile error at Develop branch:

 alpaka/test/unit/mem/view/src/ViewStaticAccMem.cpp(19): error: An inline __device__/__constant__/__managed__ variable must have internal linkage when the program is compiled in whole program mode (-rdc=false)
                              alpaka::DevGlobal<TAcc, Elem[3][2]> g_globalMemory2DUninitialized;
SimeonEhrig commented 2 months ago

I checked the CI jobs again. There is a hand written job, which test RDC:

It tests nvcc 12.0 with gcc 12. Maybe your problem is a version specific bug. Which nvcc and host compiler version do you use?

mehmetyusufoglu commented 2 months ago

I checked the CI jobs again. There is a hand written job, which test RDC:

* https://github.com/alpaka-group/alpaka/blob/develop/script/gitlabci/job_cuda.yml

* current dev: https://gitlab.com/hzdr/crp/alpaka/-/jobs/6648385841

It tests nvcc 12.0 with gcc 12. Maybe your problem is a version specific bug. Which nvcc and host compiler version do you use?

Error disapperars when the flag is ON. The CI checks the ON version not when the flag is OFF ? My config is nvcc 12.4 , gcc 12.3

psychocoderHPC commented 2 months ago

Maybe the problem is introduced in #2242 Before the change, we always declared the variable extern too see: https://github.com/alpaka-group/alpaka/pull/2242/files#diff-2eddedd7c8abe84214af714d0e61060a85e1ef924b16bad0e7bb6fff54b250b8L25

@AuroraPerego Do you know why you removed the additional extern declaration of the variable?

AuroraPerego commented 2 months ago

Do you know why you removed the additional extern declaration of the variable?

With the new implementation the extern declaration was not working, I used the inline attribute instead

psychocoderHPC commented 2 months ago

Do you know why you removed the additional extern declaration of the variable?

With the new implementation the extern declaration was not working, I used the inline attribute instead

Thanks for the fast response.

psychocoderHPC commented 2 months ago

https://reviews.llvm.org/D88786?id=295997 looks like a discussion about this topic for llvm behaviours

AuroraPerego commented 2 months ago

yes, we finished on the same page :) I'll look into it tomorrow with Mehmet

AuroraPerego commented 2 months ago

I confirm that this is version-specific, I can reproduce it with CUDA 12.4 and the flag -rdc=false but not with CUDA 12.{0,1,2}. It compiles with static instead of inline (see PR #2242-comment).