[Openmp-commits] [PATCH] D51107: [LIBOMPTARGET] Add support for mapping of lambda captures.

George Rokos via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Aug 23 05:53:02 PDT 2018


grokos added a comment.

In https://reviews.llvm.org/D51107#1209670, @ABataev wrote:

> In https://reviews.llvm.org/D51107#1209660, @grokos wrote:
>
> > Is this patch about lambdas inside target regions or about lambdas containing a target region? From the description I assume it's the former. In that case, what happens if there are more than 1 lambdas in the target region?
>
>
>
>
> 1. This is for lambdas inside target region.
> 2. For each lambda we generate this sequence: <lambda1>, <capture1_1>, .., <capture1_n>, <lambda2>, <capture2_1>, ..., <capture2_m>, ...


OK, I understand.

As far as I know, lambdas are internally represented as structs, right? In that case, wouldn't it make sense to treat captured references as struct members? Then we would just use the `MEMBER_OF` field to find the base address of a lambda instead of relying on the last element in `tgt_args` (`omptarget.cpp:619`). Also, the reference would be marked with the `PTR_AND_OBJ` flag and there is already code to handle such entries, so there is no need to duplicate it (lines 612-640 of this patch basically replicate what is already implemented in `target_data_begin` in lines 254-270 and 316-332).


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D51107





More information about the Openmp-commits mailing list