[LLVMdev] multi-threading in llvm

Jimborean Alexandra xinfinity_a at yahoo.com
Mon Jan 16 00:40:24 PST 2012


Hi,

I plan to work on parallelizing loops in LLVM in the near future. For the moment, the plan is to transform sequential loops into parallel loops at the IR level, by modifying their structure and inserting gomp calls.  I do not plan to work on all structures available in OpenMP, for now, we focus only on loops. However, 

if our work seems to be similar, we can keep in touch and exchange ideas. I'll be back with more details when I start the implementation.


Alexandra


________________________________
 From: Vlad Krylov <krvladislav at gmail.com>
To: Tobias Grosser <tobias at grosser.es> 
Cc: Jimborean Alexandra <xinfinity_a at yahoo.com>; "polly-dev at googlegroups.com" <polly-dev at googlegroups.com>; Sebastian Pop <sebpop at gmail.com>; "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu> 
Sent: Monday, January 16, 2012 3:04 AM
Subject: Re: [LLVMdev] multi-threading in llvm
 
I am interested. I would be grateful for your hints.

So OpenMP has various constructs such as parallel, barrier, single,
for, etc. And there is at least two libraries to generate OpenMP code:
libgomp and mpc. We want to be independent of specific library.

We should create an interface with methods which present manual
inserting of OpenMP pragmas in C or Fortran code. These sounds like
"this code block should be run with #parallel" or "this for loop
should be run with #parallel for loop". Constructs like barrier,
atomic can be simply presented by methods 'barrier' and 'atomic'. But
parallel or for constructs allows many modifiers (schedule, private,
shared, etc). Сan not devise a good solution for these cases.

Guess this interface is close to IRBuilder. You suggested it will be
OpenMPBuilder. This mean IR will be created from scratch. Other way is
to provide methods to modify existing IR, like user says "I want this
loop to be parallel, do it for me". What you think about this?

Implementation is calls of OpenMP library functions in a way provided
by the library abi. For example, in mpc:

   pragma omp for schedule(runtime)
   for ( i=lb ; i COND b ; i+=incr ) { A ; }
   ->
   if ( __mpcomp_runtime_loop_begin( ... ) ) {
     do {
       for ( ... ) {
         A ;
       }
     } while ( __mpcomp_runtime_loop_next( ... ) ) ;
   }
   __mpcomp_runtime_loop_end() ;


I think this work is not simple for me, so any comments are welcomed.


2012/1/7 Tobias Grosser <tobias at grosser.es>:
> On 01/07/2012 12:38 AM, Vlad Krylov wrote:
>>
>> Hi,
>>
>> It was proposed to implement OpenMP framework.
>> Is there any progress in this area? Was the question raised at the
>> Euro-LLVM? Does anybody work on implementation?
>
>
> I am not aware of any work that was done or is planned to be done in public.
>
> At Euro-LLVM I had a short discussion with Alexandra about targeting the
> OpenMP run time. We would both be interested in code that can translate
> normal LLVM-IR loops in OpenMP parallel loops. I am not sure,
> if Alexandra has some code that she can share. I for myself looked into
> the problem. I believe the loop extractor is a good start to implement such
> functionality. Yet, I do not have any written code ready.
>
> Do you happen to be interested to work on this? ;-) I can definitely give
> you some hints.
>
> Cheers
> Tobi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120116/4c8fbe74/attachment.html>


More information about the llvm-dev mailing list