[Openmp-commits] [PATCH] D86781: [LIBOMPTARGET]Do not try to optimize bases for the next parameters.

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Aug 29 18:24:07 PDT 2020

tianshilei1992 added inline comments.

Comment at: openmp/libomptarget/src/omptarget.cpp:1068
+      const bool IsFirstPrivate =
+          (I >= ArgNum - 1 || !(ArgTypes[I + 1] & OMP_TGT_MAPTYPE_MEMBER_OF));
       Ret = PrivateArgumentManager.addArg(HstPtrBegin, ArgSizes[I],
ABataev wrote:
> tianshilei1992 wrote:
> > I have a quick question: Does front end order all arguments? For example, let's say a user write the following code:
> > ```
> > #pragma omp target first private(a.p1[0:N], b, a.p2[0:N], c, a.p3[0:N])
> > ```
> > where `p1`, `p2` and `p3` are members of a struct `a`. Then when passing to the runtime library, `Args[I]`, `Args[I+1]` and `Args[I+2]` should be corresponding to `a.p1[0:N]`, `a.p2[0:N]`, `a.p3[0:N]`, right? They'll not be interleaved by `b` and `c`.
> The order is important for correct passing of captured variables to the target regions (order of the arguments for the outlined target functions). For target regions it is not always defined by the order in the mappping/data-sharing clauses, but the order of captured variables, which can be different.
> Yes, frontend already reorders maps to gather elements with the same bases. It is required for correct memory allocation of the partially copied structures.
I see. Thanks for the explanation.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list