Pablo Barrio López-Cortijo
2011-Nov-24 14:09 UTC
[LLVMdev] Turning on/off instruction extensions
Hi everybody, I'm trying to run some examples with different backend options (turning on/off SSE, 3dnow, or MMX instructions). However, I don't see any difference in terms of execution time. Does anybody know which language constructs (in C/C++ preferably) should I try to make these instructions generated (and thus make a difference between a backend that enables them or not) ? I tried generating vector instructions with loops but it's not happening. Perhaps Polly can generate vector instructions? Thanks ahead, Pablo DIE-UPM Madrid
On Thu, 2011-11-24 at 15:09 +0100, Pablo Barrio López-Cortijo wrote:> Hi everybody, > > I'm trying to run some examples with different backend options (turning > on/off SSE, 3dnow, or MMX instructions). However, I don't see any > difference in terms of execution time. Does anybody know which language > constructs (in C/C++ preferably) should I try to make these instructions > generated (and thus make a difference between a backend that enables > them or not) ? > > I tried generating vector instructions with loops but it's not > happening. Perhaps Polly can generate vector instructions?You can also try my basic-block autovectorization patch. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20111121/132206.html After applying the patch (I recommend applying it to the current trunk), then run clang with the flags: -mllvm -vectorize -mllvm -unroll-allow-partial (the -unroll-allow-partial is not necessary for the vectorization, but tends to expose additional vectorization opportunities). The basic-block vectorizer has a number of flags that can be used to customize its behavior, so if it is not vectorizing something that you think it should be (or is doing something performance detrimental), please let me know and I'll be happy to help. -Hal> > Thanks ahead, > > Pablo > DIE-UPM > Madrid > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- Hal Finkel Postdoctoral Appointee Leadership Computing Facility Argonne National Laboratory
Hi Pablo, if you use the dragonegg front-end and compile at -O3 with the option -fplugin-arg-dragonegg-enable-gcc-optzns then you should get vectorized code passed to the LLVM backend (that option turns on the gcc optimizers, in particular its auto-vectorizer). If you want to produce vector code by hand, check out the gcc docs where they explain about their vector extensions to the C language. These also work with clang. Ciao, Duncan.> I'm trying to run some examples with different backend options (turning > on/off SSE, 3dnow, or MMX instructions). However, I don't see any > difference in terms of execution time. Does anybody know which language > constructs (in C/C++ preferably) should I try to make these instructions > generated (and thus make a difference between a backend that enables > them or not) ? > > I tried generating vector instructions with loops but it's not > happening. Perhaps Polly can generate vector instructions? > > Thanks ahead, > > Pablo > DIE-UPM > Madrid > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
How can I install the patch? Any step-by-step guide? Thanks, Pablo On 24/11/2011, at 15:33, Hal Finkel wrote:> On Thu, 2011-11-24 at 15:09 +0100, Pablo Barrio López-Cortijo wrote: >> Hi everybody, >> >> I'm trying to run some examples with different backend options (turning >> on/off SSE, 3dnow, or MMX instructions). However, I don't see any >> difference in terms of execution time. Does anybody know which language >> constructs (in C/C++ preferably) should I try to make these instructions >> generated (and thus make a difference between a backend that enables >> them or not) ? >> >> I tried generating vector instructions with loops but it's not >> happening. Perhaps Polly can generate vector instructions? > > You can also try my basic-block autovectorization patch. > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20111121/132206.html > > After applying the patch (I recommend applying it to the current trunk), > then run clang with the flags: > -mllvm -vectorize -mllvm -unroll-allow-partial > (the -unroll-allow-partial is not necessary for the vectorization, but > tends to expose additional vectorization opportunities). The basic-block > vectorizer has a number of flags that can be used to customize its > behavior, so if it is not vectorizing something that you think it should > be (or is doing something performance detrimental), please let me know > and I'll be happy to help. > > -Hal > >> >> Thanks ahead, >> >> Pablo >> DIE-UPM >> Madrid >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > -- > Hal Finkel > Postdoctoral Appointee > Leadership Computing Facility > Argonne National Laboratory >