This commit implements the existing void buffer used to share
arguments between threads in a team with a byte-wise buffer. For now,
the void buffer is kept for compatibility.
The byte-wise buffer, if used directly, allows to save memory when small
arguments are shared between team threads. It does also allow to track
an additional offset that differentiates two distinct back-to-back
memory regions, e.g., for shared (copy in & out) and firstprivate (copy
in only) variables.
This is a preparation patch for https://reviews.llvm.org/D59319
[Quote by ABataev copied from https://reviews.llvm.org/D59319?id=190767#inline-525900 after the patch was split.]
This buffer is supposed to be used to communicate variables in shared and firstprivate clauses between threads in a team. In this patch it is simply used to implement the old void** buffer. How, when, if we use it is part of the interface implementation. For now, this buffer simply serves the users of the omptarget_nvptx_globalArgs global.
If you want to provide compiler allocated memory to avoid the buffer use, no problem,
the __kmpc_target_region_kernel_parallel function allows to do so, see the SharedMemPointers flag. I wouldn't want to put the logic to generate these buffers in the front-end though.