https://bugs.llvm.org/show_bug.cgi?id=51976
Bug ID: 51976
Summary: static constexpr symbol removed in offload when using
-O1
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: OpenMP
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Hi,
We use llvm13-rc3 with cuda10.1.243 for OMP offloading on x86 and power9.
We noticed that when turning on optimisation (-O1 and higher), symbols are
lost, leading to program errors of the kind
Target CUDA RTL --> Loading global /bar/ failed"
Our code looks like this:
class foo
{
public:
#pragma omp declare target
static constexpr int bar = 42;
#pragma omp end declare target
};
Johannes Doerfert pointed out that we can do
class foo
{
public:
#pragma omp declare target
static constexpr int bar = 42;
static const int * _keepalive_bar;
#pragma omp end declare target
};
and use this in the implementation:
const int *foo::_keepalive_bar = &foo::bar;
While I can confirm that this indeed works, it would be nice not having to do
that.
Thanks a lot,
Holger
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs