<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi, Jon,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I think that it's a good idea to enable this use case. It might not be the default, but some CMake flags to enable a static offloading library would see some use.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
 -Hal</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div class="BodyFragment"><font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hal Finkel<br>
Lead, Compiler Technology and Programming Languages<br>
Leadership Computing Facility<br>
Argonne National Laboratory</div>
</span></font></div>
</div>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Openmp-dev <openmp-dev-bounces@lists.llvm.org> on behalf of Jon Chesterfield via Openmp-dev <openmp-dev@lists.llvm.org><br>
<b>Sent:</b> Tuesday, April 28, 2020 6:04 AM<br>
<b>To:</b> Doerfert, Johannes via Openmp-dev <openmp-dev@lists.llvm.org><br>
<b>Subject:</b> [Openmp-dev] Support for static libomptarget</font>
<div> </div>
</div>
<div>
<div dir="auto">OpenMP links a libomptarget.so into the host executable which goes looking for offloading toolchains to dlopen.
<div dir="auto"><br>
</div>
<div dir="auto">This is very flexible, but comes at a price:</div>
<div dir="auto">- PLT call overhead + inlining barrier</div>
<div dir="auto">- Startup overhead looking for the toolchain</div>
<div dir="auto"><span style="font-family:sans-serif">- Failing to dlopen will run the host fallback, which is not necessarily what one wants for debugging</span><br>
</div>
<div dir="auto"><span style="font-family:sans-serif"><br>
</span></div>
<div dir="auto"><font face="sans-serif">For device toolchains that are available as static libraries, and for deployment of the toolchain to a system with known, fixed hardware (e.g. some hpc clusters), I'd like to be able to statically link everything. Faster
 and fewer failure modes.</font></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><font face="sans-serif">Particularly fun for amdgcn, because we'll be able to statically link the userspace graphics driver into the host executable as well. No shared libraries necessary.</font></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><font face="sans-serif">Involves a change to libomptarget (that I haven't written yet) to fill in function pointers without dlopen, and some cmake logic/controls to specify which toolchains are dynamic/static/unavailable. Plus building libomptarget.a
 if that isn't yet implemented.</font></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><font face="sans-serif">Are patches for this nominally welcome?</font></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><font face="sans-serif">Thanks</font></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><font face="sans-serif">Jon</font></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
</div>
</div>
</div>
</body>
</html>