<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 10pt; color: #000000'><br><hr id="zwchr"><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"James H Cownie" <james.h.cownie@intel.com><br><b>To: </b>"Hal Finkel" <hfinkel@anl.gov>, "Richard Smith" <richard@metafoo.co.uk><br><b>Cc: </b>"Andrey Bokhanko" <andreybokhanko@gmail.com>, "cfe-dev" <cfe-dev@cs.uiuc.edu>, "LLVM Developers Mailing List" <llvmdev@cs.uiuc.edu>, "Douglas Gregor" <dgregor@apple.com>, "C Bergström" <cbergstrom@pathscale.com>, "Michael Wong" <fraggamuffin@gmail.com>, "Alexey Bataev" <a.bataev@gmx.com>, "Chandler Carruth" <chandlerc@google.com><br><b>Sent: </b>Wednesday, May 6, 2015 8:39:16 AM<br><b>Subject: </b>RE: [LLVMdev] libiomp, not libgomp as default library linked with -fopenmp<br><br>
<style><!--
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Verdana",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
<div class="WordSection1">
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);">Chandler:</span></a></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);"> 1) I completely agree with the comments some others have made about<br>
us needing to make it clear that this isn't some Intel-only thing,<br>
it’s the LLVM OpenMP runtime. Some suggestions that I think would<br>
make sense to help here:</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);"> </span></p>
<p class="MsoNormal"><i><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);">… code owner discussion elided since Chris has endorsed Andrey…</span></i></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);">- Clearly updating the readme and such would be appropriate.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">Certainly, no problem with that at all. As I ponted out before, people from Intel are not the right ones to be inserting compatiblity tables for the runtime when
it is running on IBM Power or ARM processors. The people who know about that should contribute…</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);"><br>
- I suspect we should change the name of the installed library.<br>
'libiomp' is pretty clearly the Intel library. We could continue in<br>
the grand tradition of LLVM naming conventions and use 'libllomp'?<br>
Of course, we should install symlinks under the name 'libiomp' if<br>
needed for existing users to not be broken.<br>
</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">Changing the file name (at least when targeting X86 processors) is a more interesting issue, and not as trivial as it seems.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">The problem here is related to inter-operation with existing (Intel and gcc) compilers, and backwards binary compatibility.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">As Hal pointed out, if you intend ever to mix code compiled by multiple, different, OpenMP compilers into the same process, even if they all use an ABI to the
runtime that it supports (remember that the LLVM runtime supports both the LLVM and libgomp interfaces), you must ensure that there is only one copy of the runtime (dynamically) linked into the process. This is because (unlike most libraries) the runtime contains
state (for instance, the thread pool), therefore if you have multiple instances even of the identical runtime linked into the process, bad things will happen. (Over-subscription and associated poor performance, critical sections not providing mutual exclusion,
…). This is why we don’t normally provide a static library; it tempts people into building their own dynamic libraries that include a static copy of the OpenMP runtime, then when their DLL is linked into an OpenMP program you instantly have two copies of the
runtime and a hard to diagnose disaster.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">The problem this causes is that unless there is an agreed name for the runtime, the dynamic linker will load it twice if it is demanded under different names.
(On Linux, you can use soname to help here, but doesn’t completely solve the problem).</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">Therefore, if we do not want to make it unnecessarily hard for people who use Clang/OpenMP on X86 to link against libraries (such as Intel MKL) which use OpenMP
and were compiled with a different compiler, it is helpful to use the same file name for the runtime library no matter which compiler generated the code.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">Since there are many libraries and executables which have already been built by the Intel compiler, so already have the library name built into them (in the DT_NEEDED
ELF tag, or equivalent), changing the library name does not come for free.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">I am therefore loath to change the library name simply for political/publicity reasons when that will cause unnecessary additional complexity to the users of
one of our main target platforms. (Before anyone else says it, yes, of course X86 is the platform I care most about, but the issue isn’t about compiler competition, but about making things easy for the users of LLVM/OpenMP so that things they expect will work
do “just work” rather than adding extra complexity and more manuals to explain what has to be done to make them work. Like moving into your partner’s appartment, you’re welll advised not to move all the furniture around immediately
</span><span style="font-size: 10pt; font-family: Wingdings; color: rgb(31, 73, 125);">J</span><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">).</span><span id="DWT5366" style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);"><br></span></p></div></blockquote><br>Okay, but I don't understand any of this.<br><br> 1. We really do need to change the name.<br><br> 2. We really should install a symlink with the libiomp5 name so that existing applications will pick up the same library (or maybe hard links on windows?)<br><br>Having LLVM ship a library called libiomp5 by default would be very misleading on non-X86 platforms, and even on x86 platforms, where it will likely not match the binaries that you're shipping as part of supported products. In addition, as a matter of branding for LLVM, is highly suboptimal. We can, however, change the name without any of the negative side effects mentioned so long as proper symlinks are installed. Am I missing something?<br><br> -Hal<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div class="WordSection1"><p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);">
<br>
Just some bikeshed-painting: if we're expecting each compiler that<br>
uses the library to distribute a separate copy as part of that<br>
compiler's runtime, then I think the best name for clang to use for<br>
the library would probably be libclang_rt.omp-<arch> or<br>
libclang_rt.openmp-<arch> (as we do for all our other runtime<br>
libraries).</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">Aside from the argument above that we shouldn’t change the name (at least on X86), note that if Hal’s efforts on Flang work out, we’ll also have a Fortran/OpenMP
implementation that will use the same runtime library. Therefore putting “clang” into the name seems short-sighted.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);">If we expect this to be installed somewhere central on<br>
the system and shared by different compilers and different versions<br>
of the same compiler, then libllomp or similar seems reasonable to<br>
me. What's the intended distribution model here? </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">Whether OS vendors choose to install the runtime in a standard place (like /usr/lib64) is not something we can control. (Though doing so is a reasonable thing
to do).</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: rgb(132, 60, 12);">How stable is the ABI?<br>
</span><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">Stable; we add new interfaces when required by the evolution of the OpenMP language specification, but maintain backwards compatibility, so code compiled by older compilers
can be run against newer runtime libraries.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">On the benchmarks side of things, since everyone is so keen on this
<b>not </b>only being about Intel, surely it’d be good to have some comparisons of performance vs gcc on Power or Arm as well as on X86.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);"> </span></p>
<div>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">-- Jim<br>
<br>
James Cownie <james.h.cownie@intel.com><br>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);">Tel: +44 117 9071438</span><span style="font-size: 11pt; font-family: "Calibri",sans-serif; color: rgb(31, 73, 125);"></span></p>
</div>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana",sans-serif; color: rgb(31, 73, 125);"> </span></p>
<div>
<div style="border-right: medium none; border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(225, 225, 225) -moz-use-text-color -moz-use-text-color; padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span style="font-size: 11pt; font-family: "Calibri",sans-serif;" lang="EN-US">From:</span></b><span style="font-size: 11pt; font-family: "Calibri",sans-serif;" lang="EN-US"> Hal Finkel [mailto:hfinkel@anl.gov]
<br>
<b>Sent:</b> Tuesday, May 5, 2015 5:39 PM<br>
<b>To:</b> Richard Smith<br>
<b>Cc:</b> Andrey Bokhanko; cfe-dev; LLVM Developers Mailing List; Douglas Gregor; C Bergström; Michael Wong; Alexey Bataev; Chandler Carruth; Cownie, James H<br>
<b>Subject:</b> Re: [LLVMdev] libiomp, not libgomp as default library linked with -fopenmp</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<div class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: black;">
<hr id="zwchr" align="center" size="2" width="100%">
</span></div>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: black;"><br>
<br>
</span></p>
<blockquote style="margin-top: 5pt; margin-bottom: 5pt;">
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: black;">From: "Richard Smith" <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>><br>
To: "Chandler Carruth" <<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>><br>
Cc: "Andrey Bokhanko" <<a href="mailto:andreybokhanko@gmail.com" target="_blank">andreybokhanko@gmail.com</a>>, "cfe-dev" <<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a>>, "LLVM Developers Mailing List"<br>
<<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev@cs.uiuc.edu</a>>, "Douglas Gregor" <<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>>, "Hal Finkel" <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>>, "C Bergström"<br>
<<a href="mailto:cbergstrom@pathscale.com" target="_blank">cbergstrom@pathscale.com</a>>, "Michael Wong" <<a href="mailto:fraggamuffin@gmail.com" target="_blank">fraggamuffin@gmail.com</a>>, "Alexey Bataev" <<a href="mailto:a.bataev@gmx.com" target="_blank">a.bataev@gmx.com</a>><br>
Sent: Friday, May 1, 2015 1:31:06 PM<br>
Subject: Re: [LLVMdev] libiomp, not libgomp as default library linked with -fopenmp<br>
<br>
<br>
<br>
<br>
On Thu, Apr 30, 2015 at 2:51 PM, Chandler Carruth <<br>
<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a> > wrote:<br>
<br>
<br>
<br>
<br>
On Thu, Apr 30, 2015 at 6:52 AM Andrey Bokhanko <<br>
<a href="mailto:andreybokhanko@gmail.com" target="_blank">andreybokhanko@gmail.com</a> > wrote:<br>
<br>
<br>
<br>
All,<br>
<br>
<br>
I'd like to resurrect the discussion on replacing libgomp with<br>
libiomp as the default OpenMP runtime library linked with -fopenmp.<br>
<br>
<br>
Just for the record, I'm really excited to see this. =]<br>
<br>
<br>
<br>
<br>
We are very close to getting *full* OpenMP 3.1 specification<br>
supported in clang (only one (!) clause is not implemented yet, and<br>
the patch is already sent for review today:<br>
<a href="http://reviews.llvm.org/D9370" target="_blank">http://reviews.llvm.org/D9370</a> ). This implementation generates Intel<br>
API library calls; thus, it can't be used with libgomp and it is<br>
simply logical to link a compatible runtime (libiomp) instead.<br>
<br>
<br>
<br>
Is there no way to support libgomp here as well? I don't say this to<br>
hold up changing the defaults in any way, just curious. =]<br>
<br>
<br>
Also, for the record, I'm really excited to see the progress here as<br>
well.<br>
<br>
<br>
<br>
<br>
Chandler?<br>
<br>
<br>
<br>
Hi! ;]<br>
<br>
<br>
I totally agree, I think things are way better now. I generally<br>
support the direction. I think there are a few things I'd suggest we<br>
do as part of the process, but I think these are really small and<br>
just about "how" we switch.<br>
<br>
<br>
1) I completely agree with the comments some others have made about<br>
us needing to make it clear that this isn't some Intel-only thing,<br>
its the LLVM OpenMP runtime. Some suggestions that I think would<br>
make sense to help here:<br>
- I agree with finding some non-Intel folks to add as explicit code<br>
owners. I don't know who has been sufficiently involved, but if Hal<br>
makes sense, awesome.<br>
- Clearly updating the readme and such would be appropriate.<br>
- I suspect we should change the name of the installed library.<br>
'libiomp' is pretty clearly the Intel library. We could continue in<br>
the grand tradition of LLVM naming conventions and use 'libllomp'?<br>
Of course, we should install symlinks under the name 'libiomp' if<br>
needed for existing users to not be broken.<br>
<br>
<br>
Just some bikeshed-painting: if we're expecting each compiler that<br>
uses the library to distribute a separate copy as part of that<br>
compiler's runtime, then I think the best name for clang to use for<br>
the library would probably be libclang_rt.omp-<arch> or<br>
libclang_rt.openmp-<arch> (as we do for all our other runtime<br>
libraries). If we expect this to be installed somewhere central on<br>
the system and shared by different compilers and different versions<br>
of the same compiler, then libllomp or similar seems reasonable to<br>
me. What's the intended distribution model here? How stable is the<br>
ABI?<br>
</span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom: 12pt;"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: black;"><br>
I agree. However, for dynamic executables we need a dynamic OpenMP runtime library (there can be only one in the process because it has to keep process-wide state). The ABI is stable, and has a fairly-extensive history (on x86, specifically). cc'ing Jim so
he can also comment directly.<br>
<br>
-Hal</span></p>
<blockquote style="margin-top: 5pt; margin-bottom: 5pt;">
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: black;"> <br>
<br>
<br>
<br>
<br>
<br>
- Any other changes?<br>
<br>
<br>
2) I think we need to update the instructions for checking out LLVM<br>
and all the tools to include checking out the openmp project. I'm<br>
planning to try it out in a bit.<br>
<br>
<br>
3) It would be nice to get at least one boring benchmark into the<br>
test-suite that uses OpenMP just so there's more coverage that the<br>
basic stuff all works. In particular, if we could get the benchmark<br>
that Phoronix and others keep pointing at, that'd be nice.<br>
<br>
<br>
<br>
<br>
Speaking of which, have you checked the performance of some of the<br>
basic benchmarks using OpenMP with the two runtimes? Or looked at<br>
Clang vs GCC there? I'd be interested to see the numbers.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Yours,<br>
Andrey Bokhanko<br>
==============<br>
Software Engineer<br>
Intel Compiler Team<br>
Intel<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">
http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">
http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
<br>
<br>
<br>
-- </span></p>
</blockquote>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial",sans-serif; color: black;"><br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory</span></p>
</div>
</div>
<p>---------------------------------------------------------------------<br>
Intel Corporation (UK) Limited<br>
Registered No. 1134945 (England)<br>
Registered Office: Pipers Way, Swindon SN3 1RJ<br>
VAT No: 860 2173 47</p>
<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></blockquote><br><br><br>-- <br><div><span name="x"></span>Hal Finkel<br>Assistant Computational Scientist<br>Leadership Computing Facility<br>Argonne National Laboratory<span name="x"></span><br></div></div></body></html>