[flang-commits] [flang] [Flang][Lower][OpenMP] Add initial lowering of pointers/allocatables/target in map clauses to map_info and entries (PR #68600)

via flang-commits flang-commits at lists.llvm.org
Mon Oct 9 15:04:22 PDT 2023


agozillon wrote:

> Other than the comments I have on the various piece of code, I also am not sure about adding this code directly to lowering. Descriptors are an implementation detail. From a user's perspective, the clauses they use specifically refer to the data.
> 
> Thus the mapping is also an implementation detail - and one that the compiler can exploit. The descriptor can be mapped with a "to" clause or even firstprivatized. So I think the better place to put this code is a pass after lowering. 

Perhaps it is better to do this after the lowering in a pass, I'd be interested in other reviewers opinions on this as well! I don't mind where it's done, in this case the PFT lowering made the most sense to me initially, just maintaining as much of the map generation in the same location as possible and it being rather simple to do (and perhaps easier with the future IsolatedFromAbove changes).

Although, I do think there is some merit to descriptors being assigned the same mapping as it's associated pointer/allocatable, primarily with the example specified in another comment as the main motivator. 

> Straightforward to do:
> 
> 1. Walk through each construct that consumes the map info operations.
> 2. Collect the set of box references and box's data references in data clauses.
> 3. Initial candidate set is all of the boxes whose base_addr is used in map info
> 4. Subtract the set of boxes already in data clauses
> 5. Generate the appropriate map info entry for the box and insert it right before the mapping operation for its data.

Thank you very much for the pseudo code algorithm, I can take a look into this direction if this is the route we all wish to go down? When using data clauses in the above set of bullet points, do you mean map_entries in current OpenMP dialect parlance  (list of map_info kept by various operations that consume them, e.g. TargetOp) or something else, sorry for the stupid question!

Thank you for the review comments and I welcome more! My apologies if the reply comments are a little out of synch, I've been replying to them as I go, and this is the last one I've replied to (although, I did skim all before replying some details may have been forgotten in the grand scheme and some duplicate statements might be there!).  

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


More information about the flang-commits mailing list