Skip to content

Commit 2feafa2

Browse files
author
Georgios Rokos
committed
[libomptarget][NFC] Add comment explaining why we pass argument bases and
offsets as two separate entities to the plugins.
1 parent d2c1332 commit 2feafa2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

openmp/libomptarget/src/omptarget.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,15 @@ int target(ident_t *loc, DeviceTy &Device, void *HostPtr, int32_t ArgNum,
14241424
}
14251425
assert(TargetTable && "Global data has not been mapped\n");
14261426

1427+
// We need to keep bases and offsets separate. Sometimes (e.g. in OpenCL) we
1428+
// need to manifest base pointers prior to launching a kernel. Even if we have
1429+
// mapped an object only partially, e.g. A[N:M], although the kernel is
1430+
// expected to access elements starting at address &A[N] and beyond, we still
1431+
// need to manifest the base of the array &A[0]. In other cases, e.g. the COI
1432+
// API, we need the begin address itself, i.e. &A[N], as the API operates on
1433+
// begin addresses, not bases. That's why we pass args and offsets as two
1434+
// separate entities so that each plugin can do what it needs. This behavior
1435+
// was introdued via https://reviews.llvm.org/D33028 and commit 1546d319244c.
14271436
std::vector<void *> TgtArgs;
14281437
std::vector<ptrdiff_t> TgtOffsets;
14291438

0 commit comments

Comments
 (0)