Hi yes, I'm asking for any advice, I want to implement multithreaded code generator in LLVM. tnx --- On Tue, 10/5/10, Duncan Sands <baldrick at free.fr> wrote: From: Duncan Sands <baldrick at free.fr> Subject: Re: [LLVMdev] Multithreaded code generation To: llvmdev at cs.uiuc.edu Date: Tuesday, October 5, 2010, 10:50 AM Hi Hamed,> I want to use LLVM to automatically translate sequential codes to multithreaded > codes for execution on multicore processors. > How should I start?currently LLVM does not have support for anything like this as far as I know. But perhaps you meant that you want to implement it, and are asking for advice? Ciao, Duncan. _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101005/83d7f323/attachment.html>
On 5 October 2010 08:42, hamed hamzehi <mohammadhamzehi at yahoo.com> wrote:> Hi > yes, I'm asking for any advice, I want to implement multithreaded code > generator in LLVM. >Hi Hamed, Do you propose to change codegen for specific IR constructions or generic ones? How would you recognize multi-threaded execution in a code? There was a thread earlier about OpenMP support in Clang, that would be a good start, and even a good use-case for metadata. -- cheers, --renato http://systemcall.org/ Reclaim your digital rights, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101005/b46a354d/attachment.html>
On 10/05/2010 09:42 AM, hamed hamzehi wrote:> Hi > yes, I'm asking for any advice, I want to implement multithreaded code > generator in LLVM. > tnxHi, this generally depends which kind of code you want to multithread, because generally this is a difficult problem. However, if you limit yourself for the moment to loops that fit into the polyhedral model, you can take advantage of the existing research in this area, which already produced some nice solutions. If you are interested in this area I think this is the way to go: 1. Have a look at pluto[1] Pluto is a source to source compiler that can auto parallelize hand selected code. To check how it works I attached you an example, where it translates normal C code to OpenMP parallelized code. Compile it like this: gcc -O3 seidel.c -o seidel_sequential gcc -O3 -fopenmp -lm seidel.par.c -o seidel_parallel I tried this on a 2 Core / 4 Thread Intel processor $ time ./seidel_sequential real 0m6.923s user 0m6.890s sys 0m0.010s $ time ./seidel_parallel real 0m2.710s user 0m10.730s sys 0m0.010s One way to get this feature automatically into LLVM is by using polly [2]. Polly can detect and code generate all loops, that can be parallelized by pluto. So there are only two things missing. 1. Connect pluto somehow to polly to automatically parallelize any code that can be compiled by LLVM. I am planning to work on this during the next six month. The first test cases will probably work a lot faster. 2. Create OpenMP parallel code. This is not too difficult. We need an OpenMP library http://mpc.sourceforge.net/ has e.g. an acceptable license (LGPL) and generate the relevant library calls. As a first step this can be done without pluto support in Polly. We just limit ourselves to parallelize only loops, that do not carry dependences. If you want to work on this I propose to start with step "2.". Ping me for further information. Cheers Tobi [1] http://pluto-compiler.sourceforge.net/ [2] http://wiki.llvm.org/Polyhedral_optimization_framework> > --- On *Tue, 10/5/10, Duncan Sands /<baldrick at free.fr>/* wrote: > > > From: Duncan Sands <baldrick at free.fr> > Subject: Re: [LLVMdev] Multithreaded code generation > To: llvmdev at cs.uiuc.edu > Date: Tuesday, October 5, 2010, 10:50 AM > > Hi Hamed, > > > I want to use LLVM to automatically translate sequential codes to > multithreaded > > codes for execution on multicore processors. > > How should I start? > > currently LLVM does not have support for anything like this as far > as I know. > But perhaps you meant that you want to implement it, and are asking > for advice? > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu </mc/compose?to=LLVMdev at cs.uiuc.edu> > http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- A non-text attachment was scrubbed... Name: seidel.c Type: text/x-csrc Size: 1575 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101005/8660bde5/attachment.c> -------------- next part -------------- A non-text attachment was scrubbed... Name: seidel.par.c Type: text/x-csrc Size: 2863 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101005/8660bde5/attachment-0001.c>
Hi, In fact I have some theory on instruction level parallelism( i have a partitioning algorithm), then first of all, i want to generate a multithreaded code from LLVM IR (in assembly level) with a given partitioning. My problem is how can i use a thread library(like Pthread) or OS system calls in LLVM IR to create and manage threads? --- On Tue, 10/5/10, Tobias Grosser <grosser at fim.uni-passau.de> wrote: From: Tobias Grosser <grosser at fim.uni-passau.de> Subject: Re: [LLVMdev] Multithreaded code generation To: llvmdev at cs.uiuc.edu Date: Tuesday, October 5, 2010, 12:08 PM On 10/05/2010 09:42 AM, hamed hamzehi wrote:> Hi > yes, I'm asking for any advice, I want to implement multithreaded code > generator in LLVM. > tnxHi, this generally depends which kind of code you want to multithread, because generally this is a difficult problem. However, if you limit yourself for the moment to loops that fit into the polyhedral model, you can take advantage of the existing research in this area, which already produced some nice solutions. If you are interested in this area I think this is the way to go: 1. Have a look at pluto[1] Pluto is a source to source compiler that can auto parallelize hand selected code. To check how it works I attached you an example, where it translates normal C code to OpenMP parallelized code. Compile it like this: gcc -O3 seidel.c -o seidel_sequential gcc -O3 -fopenmp -lm seidel.par.c -o seidel_parallel I tried this on a 2 Core / 4 Thread Intel processor $ time ./seidel_sequential real 0m6.923s user 0m6.890s sys 0m0.010s $ time ./seidel_parallel real 0m2.710s user 0m10.730s sys 0m0.010s One way to get this feature automatically into LLVM is by using polly [2]. Polly can detect and code generate all loops, that can be parallelized by pluto. So there are only two things missing. 1. Connect pluto somehow to polly to automatically parallelize any code that can be compiled by LLVM. I am planning to work on this during the next six month. The first test cases will probably work a lot faster. 2. Create OpenMP parallel code. This is not too difficult. We need an OpenMP library http://mpc.sourceforge.net/ has e.g. an acceptable license (LGPL) and generate the relevant library calls. As a first step this can be done without pluto support in Polly. We just limit ourselves to parallelize only loops, that do not carry dependences. If you want to work on this I propose to start with step "2.". Ping me for further information. Cheers Tobi [1] http://pluto-compiler.sourceforge.net/ [2] http://wiki.llvm.org/Polyhedral_optimization_framework> > --- On *Tue, 10/5/10, Duncan Sands /<baldrick at free.fr>/* wrote: > > > From: Duncan Sands <baldrick at free.fr> > Subject: Re: [LLVMdev] Multithreaded code generation > To: llvmdev at cs.uiuc.edu > Date: Tuesday, October 5, 2010, 10:50 AM > > Hi Hamed, > > > I want to use LLVM to automatically translate sequential codes to > multithreaded > > codes for execution on multicore processors. > > How should I start? > > currently LLVM does not have support for anything like this as far > as I know. > But perhaps you meant that you want to implement it, and are asking > for advice? > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu </mc/compose?to=LLVMdev at cs.uiuc.edu> > http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-----Inline Attachment Follows----- _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101005/d0f30c85/attachment.html>