<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hi, Jon,</p>
<p>This is a great question. <br>
</p>
<p>With reverse-offload support, and unified memory, we can support
a model where memory allocation triggers reverse offload to the
memory allocator on the host. In this mode, everything works as
expected. We can, of course, do some static analysis and move
allocations that don't escape to use some local allocation scheme,
such as what we use without unified memory + reverse offload.<br>
</p>
<p>Without such support, I think that "One heap per device + one for
host. Each independent, pointers only valid on the thing that
called malloc." makes the most sense. This also, as far as I know,
matches what's available in CUDA today.<br>
</p>
<p>"One heap per target offload region" doesn't make sense to me.
One might clearly want to allocate in one target region, store the
pointers in some data structure, and then access them in some
other target region on the same device.</p>
<p>Thanks again,</p>
<p>Hal<br>
</p>
<div class="moz-cite-prefix">On 6/24/20 6:40 AM, Jon Chesterfield
via Openmp-dev wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAOUYtQD9n+xoSGo7md4n9x8pCpqGqQ-0zG7iHm=9ezZU-=R6WQ@mail.gmail.com">
<div dir="auto">Hello OpenMP,
<div dir="auto"><br>
</div>
<div dir="auto">Our language spec seems fairly light on what it
means to call malloc from a target region.</div>
<div dir="auto"><br>
</div>
<div dir="auto">I can think of a few interpretations:</div>
<div dir="auto">- One heap per process. Malloc on target or
host, free from either. Writable from either, or some other
device. Might mean intercepting host libc. Convenient, slow.</div>
<div dir="auto">- One heap per device + one for host. Each
independent, pointers only valid on the thing that called
malloc.</div>
<div dir="auto">- One heap per target offload region,
inaccessible from host.</div>
<div dir="auto">- Some other granularity.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Generally gets faster as the restrictions
increase.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Anyone willing to state / guess what they or
their users would expect? Bearing in mind that new is likely
to call malloc and will gain the same properties.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Thanks,</div>
<div dir="auto"><br>
</div>
<div dir="auto">Jon</div>
<div dir="auto"><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Openmp-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Openmp-dev@lists.llvm.org">Openmp-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>