[Openmp-commits] [PATCH] D105121: [OpenMP] Avoid checking parent reference count in targetDataBegin
George Rokos via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Fri Jul 9 08:39:35 PDT 2021
grokos added a comment.
Just like in D104924 <https://reviews.llvm.org/D104924>, the code after this patch is equivalent to the original one with one exception. The question was raised at our telecon a couple of weeks ago but no one was sure what the right answer is:
What happens if a struct has a pointer member, we map the whole struct and later on we use the pointer member to map some attached object?
struct S {
int i;
double d;
float *p;
} s1;
...
s1.i = 1;
s1.d = 2.0;
s1.p = new float[10];
#pragma omp enter data map(to:s1) // whole struct is mapped but the object pointed to by s1.p is not
...
#pragma omp target map(s1.p[0:10]) // the attached object here has RefCount=1, but parent struct will have RefCount=2
{...}
How should we handle this case? Does anyone know for sure? Do we copy s1.p to the device as its RefCount=1 or are we ignoring the motion clause because the parent struct's RefCount != 1?
If the answer is "we copy it", then we can commit both this patch and D104924 <https://reviews.llvm.org/D104924>. If the answer is "we need to look at the parent struct's RefCount" then both patches will have to be abandoned.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105121/new/
https://reviews.llvm.org/D105121
More information about the Openmp-commits
mailing list