<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 2, 2015 at 4:27 PM, Andrey Bokhanko <span dir="ltr"><<a href="mailto:andreybokhanko@gmail.com" target="_blank">andreybokhanko@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Jack,<br>
<br>
Could you, please, submit a bug report? -- including steps to<br>
reproduce (where you got imageMagick sources, how exactly you compiled<br>
them, etc)<br>
<span class=""><font color="#888888"><br></font></span></blockquote><div><br></div>Andrey,<br> I opened...<br><br><a href="https://llvm.org/bugs/show_bug.cgi?id=23387">https://llvm.org/bugs/show_bug.cgi?id=23387</a><br><br>This issue appears many times during the imagemagick build where the register type being used in declaring loop iteration variables. The preprocessed source attached to the bug report can be used to reproduce the compiler error with the command...<br><br># clang-3.7 -DHAVE_CONFIG_H -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -O3 -g -fopenmp=libiomp5 -Xclang -fopenmp=libiomp5 -Wall -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -c attribute.i<br><br>where 'clang-3.7' is whatever you call your local clang 3.7svn compiler.<br> Hopefully that should suffice to debug this (unless you are missing some more entries in the openmp headers and the preprocessed source needs to be regenerated).<br> Jack<br>ps This issue can be hacked around for now by removing usage the 'register' type on the offending local iteration variable declarations which exposed a second blocker in the imagemagick build...<br><br><a href="https://llvm.org/bugs/show_bug.cgi?id=23392">https://llvm.org/bugs/show_bug.cgi?id=23392</a><br><br>due to a compiler ICE. The problem can be reproduced with the preprocessed source attached to that report and the command...<br><br>clang-3.7 -DHAVE_CONFIG_H -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -fopenmp=libiomp5 -O2 -g -Xclang -fopenmp=libiomp5 -L/sw/opt/llvm-3.7.0/lib -Wall -march=penryn -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -c feature.i -fno-common -DPIC</div><div class="gmail_quote"><br></div><div class="gmail_quote">The ICE smells like a similar issue with static support since the compilation warnings include...</div><div class="gmail_quote"><br></div><div class="gmail_quote">magick/feature.c:317:60: warning: extra tokens at the end of '#pragma omp parallel for' are ignored [-Wextra-tokens] #pragma omp parallel for schedule(static,4) shared(status) magick_threads(edge_image,edge_image,edge_image->rows,1)</div><div class="gmail_quote">magick/feature.c:429:60: warning: extra tokens at the end of '#pragma omp parallel for' are ignored [-Wextra-tokens] #pragma omp parallel for schedule(static,4) shared(status) magick_threads(edge_image,edge_image,edge_image->rows,1)<pre class="" id="comment_text_0" style="font-size:medium;white-space:pre-wrap;width:50em;color:rgb(0,0,0)"><br></pre><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">Andrey,<br> I opened...<br><br><a href="https://llvm.org/bugs/show_bug.cgi?id=23387">https://llvm.org/bugs/show_bug.cgi?id=23387</a><br><br>for this issue (which appears many in the imagemagick build where the register type being used<br>in declaring loop iteration variables. I also uploaded the preprocessed source so the issue can be<br>reproduced with a command...<br><br># clang-3.7 -DHAVE_CONFIG_H -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -O3 -g -fopenmp=libiomp5 -Xclang -fopenmp=libiomp5 -Wall -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -c attribute.i<br><br>where 'clang-3.7' is whatever you call your local clang 3.7svn compiler.<br> Hopefully that should suffice to debug this (unless you are missing some more entries in the openmp headers).<br> Jack<br>ps This issue can be hacked around for now by removing usage the 'register' type on the offending local iteration variable declarations. This exposed a second blocker in the imagemagick build...<br><br><a href="https://llvm.org/bugs/show_bug.cgi?id=23392">https://llvm.org/bugs/show_bug.cgi?id=23392</a><br><br>due to a compiler ICE. The problem can be reproduced with the preprocessed source attached to that report and the command...<br><br># clang-3.7 -DHAVE_CONFIG_H -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -fopenmp=libiomp5 -O2 -g -Xclang -fopenmp=libiomp5 -L/sw/opt/llvm-3.7.0/lib -Wall -march=penryn -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -c feature.i -fno-common -DPIC<font color="#888888">Andrey<br>
</font></span><div class=""><div class="h5"><br>
<br>
On Fri, May 1, 2015 at 3:56 PM, Jack Howarth<br>
<<a href="mailto:howarth.mailing.lists@gmail.com">howarth.mailing.lists@gmail.com</a>> wrote:<br>
><br>
><br>
> On Fri, May 1, 2015 at 4:45 AM, Andrey Bokhanko <<a href="mailto:andreybokhanko@gmail.com">andreybokhanko@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Chandler,<br>
>><br>
>> Thanks for the reply -- I always included you in libiomp supporters camp;<br>
>> it is good to see I wasn't mistaken! ;-)<br>
>><br>
>> On Fri, May 1, 2015 at 12:51 AM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>><br>
>> wrote:<br>
>>><br>
>>> Is there no way to support libgomp here as well? I don't say this to hold<br>
>>> up changing the defaults in any way, just curious. =]<br>
>><br>
>><br>
>> No, sorry. libgomp doesn't support Intel API and clang generates Intel API<br>
>> calls only -- as simple as that. Someday someone may implement generation of<br>
>> GNU API calls as well, but this is a separate big task that, IMHO, doesn't<br>
>> serve any real purpose -- and potentially introduces nasty GPL-related legal<br>
>> issues.<br>
>><br>
>> There is an option to choose what library clang links<br>
>> (-fopenmp={libiomp|libgomp}), though.<br>
>><br>
>>><br>
>>> I totally agree, I think things are way better now. I generally support<br>
>>> the direction. I think there are a few things I'd suggest we do as part of<br>
>>> the process, but I think these are really small and just about "how" we<br>
>>> switch.<br>
>>><br>
>>> 1) I completely agree with the comments some others have made about us<br>
>>> needing to make it clear that this isn't some Intel-only thing, its the LLVM<br>
>>> OpenMP runtime. Some suggestions that I think would 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 makes<br>
>>> sense, awesome.<br>
>><br>
>><br>
>> This really belongs to a separate thread<br>
>> (<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/085037.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/085037.html</a>); see my<br>
>> answer there in a couple of minutes.<br>
>><br>
>>><br>
>>> - Clearly updating the readme and such would be appropriate.<br>
>>> - I suspect we should change the name of the installed library. 'libiomp'<br>
>>> is pretty clearly the Intel library. We could continue in the grand<br>
>>> tradition of LLVM naming conventions and use 'libllomp'? Of course, we<br>
>>> should install symlinks under the name 'libiomp' if needed for existing<br>
>>> users to not be broken.<br>
>>> - Any other changes?<br>
>><br>
>><br>
>> Adding openmp-dev list (in retrospect, should have been done at the very<br>
>> start...), Jim Cownie and Andrey Churbanov.<br>
>><br>
>>><br>
>>> 2) I think we need to update the instructions for checking out LLVM and<br>
>>> all the tools to include checking out the openmp project. I'm planning to<br>
>>> try it out in a bit.<br>
>><br>
>><br>
>> Cool! Thank you!<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 basic<br>
>>> stuff all works. In particular, if we could get the benchmark that Phoronix<br>
>>> and others keep pointing at, that'd be nice.<br>
>><br>
>><br>
>>> Speaking of which, have you checked the performance of some of the basic<br>
>>> benchmarks using OpenMP with the two runtimes? Or looked at Clang vs GCC<br>
>>> there? I'd be interested to see the numbers.<br>
>><br>
>><br>
>> This is very tricky for me -- I'm employed by a CPU vendor (Intel), and we<br>
>> have very strict rules and long processes for publishing benchmark results.<br>
>> I simply can't run a benchmark and say: "hey! clang has this number and gcc<br>
>> has that number".<br>
>><br>
>> The only thing I can share is that we do tested SPEC OMP2012<br>
>> (<a href="https://www.spec.org/omp2012/" target="_blank">https://www.spec.org/omp2012/</a>), which is the industry standard for OMP<br>
>> benchmarks, on a non-server class Darwin machine, and the results are quite<br>
>> good and comparable with other compilers.<br>
>><br>
>> Speaking on Phoronix, two benchmarks where clang always lose due to lack<br>
>> of OpenMP are "John the Ripper"<br>
>> (<a href="http://www.phoronix.com/scan.php?page=article&item=clang-gcc-broadwell&num=3" target="_blank">http://www.phoronix.com/scan.php?page=article&item=clang-gcc-broadwell&num=3</a>)<br>
>> and ImageMagick -- though latter is not included in most recent "clang vs<br>
>> gcc" comparison.<br>
><br>
><br>
> Unfortunately, the current llvm 3.7svn and available OPENMP patches don't<br>
> allow for imageMagick-6.8.2 to compile. The build fails on the compiler<br>
> error...<br>
><br>
> magick/attribute.c:331:12: error: loop iteration variable in the associated<br>
> loop of 'omp parallel for' directive may not be threadprivate or thread<br>
> local, predetermined as<br>
> private<br>
> for (i=0; i < (ssize_t) image->colors; i++)<br>
> ^<br>
> magick/attribute.c:325:9: note: loop iteration variable is predetermined as<br>
> linear<br>
> i;<br>
> ^<br>
> magick/attribute.c:978:12: error: loop iteration variable in the associated<br>
> loop of 'omp parallel for' directive may not be threadprivate or thread<br>
> local, predetermined as<br>
> private<br>
> for (i=0; i < (ssize_t) image->colors; i++)<br>
> ^<br>
> magick/attribute.c:972:9: note: loop iteration variable is predetermined as<br>
> linear<br>
> i;<br>
> ^<br>
> 2 errors generated.<br>
><br>
> I get the same error when I try to build the latest ImageMagick 6.9.1-2<br>
> sources with clang 3.7svn using -fopenmp=libiomp5 -Xclang -fopenmp=libiomp5.<br>
><br>
>><br>
>> Is there a generous soul (not employed by a CPU vendor :-)) willing to run<br>
>> "John the Ripper" with "clang -fopenmp=libiomp5 -Xclang -fopenmp=libiomp5<br>
>> -lm -O3" and compare results with "clang -O3"?<br>
>><br>
>> Also, Jack Howarth did testing with some other benchmarks, and it is nice<br>
>> to see that clang + libiomp compare quite well (to say it mildly ;-)) with<br>
>> gcc + libgomp!<br>
>><br>
>> Andrey<br>
>><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">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>
</div></div></blockquote></div><br></div></div>