[Openmp-commits] [PATCH] D85216: [LIBOMPTARGET]Fix order of mapper data for targetDataEnd function.

Alexey Bataev via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Aug 4 10:43:08 PDT 2020

ABataev added a comment.

In D85216#2193890 <https://reviews.llvm.org/D85216#2193890>, @grokos wrote:

> So does the mapper function emit entries in reverse order upon exiting a target/target data region?

No, it emits the data in the direct order. Currently, it emits in the following order: `allocates, to/from/tofrom, deletes`.
But targetDataEnd processes all records in reverse order and, thus, it results in the order: `deletes, to/from/tofrom, allocs`. So, at first, it deletes the data, and only after that, it tries to perform everything else.

After some thinking, seems to me the problem is much deeper. According to the standard, "For a given construct, the effect of a map clause with the to, from, or tofrom map-type is ordered before the effect of a map clause with the alloc, release, or delete map-type." So, looks to me, the compiler should reorder map info in the order `to/from/tofrom, allocs/releases/deletes`, and `targetDataEnd` function should process the mapping info in the direct order, just like `tagetDataBegin` and `tgt_targe_update`.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list