diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2018-11-08 15:47:30 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-11-08 15:47:30 +0000 |
| commit | 15ab891e68a7fb3ff564318b937a49ca93fb82c2 (patch) | |
| tree | 635be9b5f2ac5bdabf43bf10d15b635536dc8aa5 | |
| parent | 1993894c0300c2f900e53d38196b948f36d566ff (diff) | |
| download | bcm5719-llvm-15ab891e68a7fb3ff564318b937a49ca93fb82c2.tar.gz bcm5719-llvm-15ab891e68a7fb3ff564318b937a49ca93fb82c2.zip | |
[OPENMP]Make lambda mapping follow reqs for PTR_AND_OBJ mapping.
Summary:
The base pointer for the lambda mapping must point to the lambda capture
placement and pointer must point to the captured variable itself. Patch
fixes this problem.
Reviewers: gtbercea
Subscribers: guansong, openmp-commits, kkwli0, caomhin
Differential Revision: https://reviews.llvm.org/D54260
llvm-svn: 346407
| -rw-r--r-- | openmp/libomptarget/src/omptarget.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp index a1ffd04f29c..a23d82b7979 100644 --- a/openmp/libomptarget/src/omptarget.cpp +++ b/openmp/libomptarget/src/omptarget.cpp @@ -638,19 +638,20 @@ int target(int64_t device_id, void *host_ptr, int32_t arg_num, assert(tgtIdx != -1 && "Base address must be translated already."); // The parent lambda must be processed already and it must be the last // in tgt_args and tgt_offsets arrays. - void *HstPtrBegin = args[i]; - void *HstPtrBase = args_base[i]; + void *HstPtrVal = args[i]; + void *HstPtrBegin = args_base[i]; + void *HstPtrBase = args[idx]; bool IsLast; // unused. void *TgtPtrBase = (void *)((intptr_t)tgt_args[tgtIdx] + tgt_offsets[tgtIdx]); DP("Parent lambda base " DPxMOD "\n", DPxPTR(TgtPtrBase)); uint64_t Delta = (uint64_t)HstPtrBegin - (uint64_t)HstPtrBase; void *TgtPtrBegin = (void *)((uintptr_t)TgtPtrBase + Delta); - void *Pointer_TgtPtrBegin = Device.getTgtPtrBegin( - *(void **)HstPtrBegin, arg_sizes[i], IsLast, false); + void *Pointer_TgtPtrBegin = + Device.getTgtPtrBegin(HstPtrVal, arg_sizes[i], IsLast, false); if (!Pointer_TgtPtrBegin) { DP("No lambda captured variable mapped (" DPxMOD ") - ignored\n", - DPxPTR(*(void **)HstPtrBegin)); + DPxPTR(HstPtrVal)); continue; } DP("Update lambda reference (" DPxMOD ") -> [" DPxMOD "]\n", |

