[flang-commits] [flang] [openmp] [mlir] [Flang][OpenMP] Initial mapping of Fortran pointers and allocatables for target devices (PR #71766)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Wed Nov 15 18:57:25 PST 2023


vzakhari wrote:

Please note that, moving forward, we will have to "attach" more pointers into the device descriptor, e.g. the `addendum` pointer may point to the type description data.  To preserve the correctness of a descriptor on the device something like `map(to: descriptor->addendum)` will have to be used. It might as well be `map(present: descriptor->addendum)`, if the type description data is implicitly made `declare target` (i.e. it is always resident in the device memory as global data).

So I think we have to plan for a representation that will be able to handle the `addendum` and maybe other auxiliary pointers inside the descriptor.

I suppose the MapInfo can be extended to represent the parent-memberptr relationship, so that a "root" MapInfo for the descriptor reference refers to a chain of MapInfo's for the descriptor member pointers.  It should be pretty straightforward to convert this to the corresponding `MEMBER_OF|PTR_AND_OBJ` mappings for libomptarget.  The same representation can be used then for C/C++ like `map(to:s.p1[:10],s.p2[:20],s.p3[:30])` (whenever omp dialect is used for C/C++).

Side note:
I am having problems finding commonalities between OpenMP and OpenACC with regards to the pointer attachments, because OpenACC spec explicitly describes a complex logic for updating the pointer attachment counters (which, for example, involves comparing the current value of the descriptor with the value that has been used for attachment the last time).  So I am not sure if we can come up with a representation that will be close for OpenMP and OpenACC.

https://github.com/llvm/llvm-project/pull/71766


More information about the flang-commits mailing list