Polly and OpenMP


I was looking at the Polly project page and it seemed to imply Polly
would be able to generate code for OpenMP. Does this mean, that once
Polly gets of its feet, we will see OpenMP support in Clang/LLVM with
a bit more work (mostly parsing in Clang)?



Generating code for OpenMP really isn't the problem. The parser changes
are quite a bit more work and are unlikely to happen unless someone
does the work. There are currently no volunteers to do any of this work.


Hi Ruben,

OpenMP support in Polly means basically that we can transform loops, for which we can prove that there are no problematic dependences, into loops that are executed in parallel. This parallel execution takes advantage of the GNU OpenMP run time library. Polly itself uses just a small part of the GNU OpenMP run time library.

Getting OpenMP support into Clang/LLVM is not very closely related to the OpenMP code generation support in Polly. For OpenMP support in clang we need OpenMP parsing in clang as Eric pointed out. This parsing needs to support the whole OpenMP standard and not only the very limited subset Polly is using. Beyond parsing we need efficient code generation support for OpenMP and furthermore we need a run time library. Polly uses currently libgomp from the GNU project, however for official integration into LLVM, we most probably want to have a different license. mpc [1] may be an option.

If you are interested into OpenMP support in clang, the first step would probably be to extend clang to parse OpenMP directives. I know that there are several implementations available, however unfortunately none of them was every contributed back to clang.


[1] http://mpc.sf.net

Sorry MPC is not a very good recommendation for runtime because
1) It's basically still LGPL
2) It's only OMP-2.5
3) Can it actually demonstrate scalable performance and production quality?

OMP 3.x as a whole is a pretty big chunk of work and parsing is the smallest part of it imho. It would take months and months of work for someone to get it all together to what effect? How many people would use it? Is there also Fortran support?

/* Disclaimer - I'm biased - The company I work for has clang parsing OpenMP and an OMP/HMPP compiler */