Open jhuber6 opened 3 months ago
@alexey-bataev Any clue where this logic lives?
The variable C::x is just declared, not defined, see https://godbolt.org/z/Mo3aK578h for example. So, it is correct that it is just marked extern.
The variable C::x is just declared, not defined, see https://godbolt.org/z/Mo3aK578h for example. So, it is correct that it is just marked extern.
Whoops, forgot to copy that bit when I reduced this. I've updated the issue. If you explicitly declare it for the device it works, see https://godbolt.org/z/bPMx3h3o8. My guess is that it doesn't automatically add variables outside of the class definition.
Turns out you don't even need the inheritance https://godbolt.org/z/3ErrG1YPf.
You need explicitly mark definition as declare target
You need explicitly mark definition as declare target
Okay, so this is a wontfix
? I don't know the expected OpenMP standards behavior for this.
Need to check the standard, previously it was a feature, not a bug :)
Need to check the standard, previously it was a feature, not a bug :)
Alright, this is related to a V&V failure I reduced https://github.com/OpenMP-Validation-and-Verification/OpenMP_VV/blob/master/tests/5.2/unified_shared_mem/test_target_VirDestr.cpp.
@llvm/issue-subscribers-openmp
Author: Joseph Huber (jhuber6)
This is for unified shared memory, I suppose definition on the host must be visible from the device in this case.
When a derived class is present in a target region it will try to automatically declare members on the device. This is not correctly handled when done through a derived class that references the parent. See the example on godbolt https://godbolt.org/z/zvG5nr6KW and below.
Here, the variable
x
is not captured on the device and thus shows up as anextern
variable. This is then never resolved and fails at link time.