Hi All, Thank you for your suggestions. @Michael: I tried your suggestion. I could run "Loop Vectorizer" successfully. But my problem is not solved. @Renato: I want to do the 1st type operation: 1) Use all cores, dividing the loop into multiple cores, one block at a time. But I don't want to use "OpenMP" for this. I don't want the user to mention OpenMP command in the program but I want to implement OpenMP logic by writing a new pass along with loop unrolling. Could you please suggest how can I proceed with this? Is this possible to do so ? Regards, Yaduveer On Wed, May 6, 2015 at 12:02 AM, Renato Golin <renato.golin at linaro.org> wrote:> On 4 May 2015 at 18:55, suyog sarda <sardask01 at gmail.com> wrote: > > Not sure, why are you using the array there. > > Smells like a reduced-too-far example. :) > > cheers, > --renato > _______________________________________________ > 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/20150508/980b2143/attachment.html>
On 8 May 2015 at 19:12, yaduveer singh <yaduveer99 at gmail.com> wrote:> 1) Use all cores, dividing the loop into multiple cores, one block at > a time. But I don't want to use "OpenMP" for this.Right, that is *exactly* what OpenMP does, I'm not sure why you don't want to use it. Just unrolling the loops will not get you multi-threaded behaviour, nor will vectorizing the loops. You need a thread library and OpenMP provides you one. You could also use pthreads or MPI, but not without changing the source code a lot more than OpenMP, and with the same amount work to get the libraries working.> I don't want the user to mention OpenMP command in the program but I want to > implement OpenMP logic by writing a new pass along with loop unrolling.This doesn't make sense. Implementing OpenMP logic in the loop unroller to avoid users knowing about OpenMP will never be accepted upstream, and honestly, it's the wrong place for doing this, as you *will* need run-time libraries as well as heavy IR transformations that are already implemented.> Could you please suggest how can I proceed with this? Is this possible to do > so ?Why not hide OpenMP command line options and pragmas from the user by doing source-to-source transformation in Clang? First, get Clang's AST for a loop with and without OpenMP information, then detect the loops you want to split and add the metadata to the AST before lowering to IR. This way, the whole work will be done by the already existing OpenMP implementation and run-time libraries, and the validation will be done by the compiler in the same way, so unless you don't use SIMD pragmas in the wrong way, you should be ok. No user will need to define OpenMP when they use your front-end wrapper. cheers, --renato
Hi Renato, Thanks for the help. I am trying to follow the AST way. I tried seeing the AST contents by using following command: *clang -Xclang -ast-dump -fsyntax-only loop.c* This is giving me some AST output( I believe so) but I am having two issue: 1. I am not able to put this output in a file as Its showing following error: *yaduveer at yaduveer-Inspiron-3542:~/RP$ clang -Xclang -ast-dump -fsyntax-only loop1d.c | llvm-dis -o ast.txt* *llvm-dis: Invalid bitcode signature* *clang: error: unable to execute command: Broken pipe* *clang: error: clang frontend command failed due to signal (use -v to see invocation)* *clang version 3.6.0 (trunk 225627) (llvm/trunk 225626)* *Target: x86_64-unknown-linux-gnu* *Thread model: posix* *clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ <http://llvm.org/bugs/> and include the crash backtrace, preprocessed source, and associated run script.* *clang: note: diagnostic msg: * ********************** *PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:* *Preprocessed source(s) and associated run script(s) are located at:* *clang: note: diagnostic msg: /tmp/loop1d-71cd19.c* *clang: note: diagnostic msg: /tmp/loop1d-71cd19.sh* *clang: note: diagnostic msg: * ********************** 2. I don't know whether this AST output is correct or not as I am seeing very large output compared to my small input program( file loop1d.c). Could you please advise me on following queries: a) Is there some way so that I can get dependency analysis of AST and Basic Blocks. b) How can I modify an existing pass by writing a new Pass just like "Hello" pass but the dependencies involved in that pass must not show error like "reclaration" ( As I tried with "LoopUnrollPass" in beginning.) Regards, Yaduveer -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150513/129df94c/attachment.html>