-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[OpenMP] Unmapping of 'middle' structures leaks mappings (at runtime) #141046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-openmp Author: Julian Brown (jtb20)
Consider this testcase:
```
#include <cstdlib>
#include <cstdio>
struct S { struct T { int main() { fprintf(stderr, "about to call target region:\n"); #pragma omp target map(tofrom: v->s1->p1[:1]) fprintf(stderr, "v->s1->p0[0]=%d, v->s1->p1[0]=%d, v->s1->p2[0]=%d\n", free(v->s1->p0); return 0;
...
|
Consider this testcase:
Compiled with offloading to AMDGCN, this appears to work, but there is a problem: three blocks are created by the
omp target
directive, but only two are destroyed. Setting LIBOMPTARGET_DEBUG=5, we can see:(Excerpt, parenthesized lines edited in.)
The map entry for the pointer
v->s1->p1
is created, but never destroyed.Without delving too deep into this in this initial bug report, I'm not sure the current arrangement of type bits/flags is sufficient to describe this case well. I think the lowering code in
CGOpenMPRuntime.cpp:generateInfoForComponentList
is operating according to the description in the comments, but the runtime can't see that entry 1 is both aMEMBER_OF
mapping and a containing structure itself, so as to distinguish this case from other cases that it does handle correctly at present.The 'entry 1' is not deleted because its refcount does not reach zero in
omptarget.cpp:postProcessingTargetDataEnd
:So this is either a Clang bug, or a runtime bug, but I'm not sure exactly which. I think probably some new flag bit needs adding and the runtime adjusted to process it properly. But then what about backwards-compatibility concerns?
This is related to, but slightly different from, #141042.
The text was updated successfully, but these errors were encountered: