<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi, Alexey, Lingda,</p>
<p>I haven't been following this closely, so a few questions/comments:</p>
<p> 1. Recursive mappers are not supported in OpenMP 5, but do we expect that to change in the future?</p>
<p> 2. Our experience so far suggests that the most important optimization in this space is to limit the number of distinct host-to-device transfers (or data copies) on systems where data needs to be copied. In these schemes, where does that coalescing occur?</p>
<p> 3. So long as the mappers aren't recursive, I agree with Alexey that the total number of to-be-mapped components should be efficient to calculate. The counting function should simplify to a trivial expression in nearly all cases. The only case where it
 might not is where the type contains an array section with dynamic bounds, and the element type also has a mapper with an array section with dynamic bounds. In this case (similar to the unsupported recursive cases, which as an aside, we should probably support
 it as an extension) we could need to walk the data structure twice to precalculate the number of total components to map. However, this case is certainly detectable by static analysis of the declared mappers, and so I think that we can get the best of both
 worlds: we could use Alexey's proposed scheme except in cases where we truly need to walk the data-structure twice, in which case we could use Lingda's combined walk/push_back scheme. Is there any reason why that wouldn't work?</p>
<p>Thanks again,</p>
<p>Hal<br>
</p>
<div class="moz-cite-prefix">On 6/28/19 9:00 AM, Alexey Bataev wrote:<br>
</div>
<blockquote type="cite" cite="mid:OF18B82C5D.ED7CA244-ON00258427.004C9654-85258427.004CF568@notes.na.collabserv.com">
<p><font size="2">Hi Lingda, thanks for your comments.</font><br>
<font size="2">We can allocate the buffer either by allocating it on the stack or calling OpenMP allocate function.</font><br>
<font size="2">With this solution, we allocate memory only once (no need to resize buffer after push_backs) and we do not need to call the runtime function to put map data to the buffer, compiler generated code can do it.</font><br>
<font size="2">But anyway, I agree, it would be good to hear some other opinions.</font><br>
<font size="2">--------------</font><br>
<font size="2">Best regards,</font><br>
<font size="2">Alexey Bataev</font></p>
</blockquote>
<br>
<blockquote type="cite" cite="mid:OF18B82C5D.ED7CA244-ON00258427.004C9654-85258427.004CF568@notes.na.collabserv.com">
<p><font size="2">...</font></p>
</blockquote>
<pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>