Matthieu Dubet
2013-Oct-16 15:14 UTC
[LLVMdev] Converting a i32 pointer to a vector of i32 ( C array to LLVM vector)
Hi, Thank you for the information, So I'm now keeping the array as a pointer (i32*) but the vectorizer doesn't vectorize it . I've pasted the function code before and after optimization (and the list of optimization that I have activated) in this Gist : https://gist.github.com/maattd/7008683 Some "weird" fact of my LLVM code : * all variables (even the one used for the loop condition) are pointers to memory allocated from the C world and passed to the LLVM functions as an argument * even with "opt->add(new llvm::DataLayout(*ee->getDataLayout())) ;" in the code, the module->dump() doesn't output neither data layout, nor triple target Both those points might confuse the vectorizer ? On Fri, Oct 11, 2013 at 1:40 PM, Renato Golin <renato.golin at linaro.org>wrote:> On 11 October 2013 18:27, Matthieu Dubet <maattdd at gmail.com> wrote: > >> How can I tell LLVM to consider this i32* as an <10 x i32> (and thus get >> the performance improvements thanks to SIMD ..etc..) ? >> > > Hi Matthieu, > > You shouldn't need to do anything, the vectorizer should spot that for > you, if the machine you're compiling to has support for vector > instructions. Any kind of vector operations that you may want to hard-code > will make it not work on anything other than the intrinsics/inline asm > you're using, which is not a good idea. > > If your code didn't get vectorized, it's possible that it is not clear > enough that that pointer is being iterated in a way that it's easy for the > vectorizer to spot, so maybe you need to make it clearer, and that depends > on the code in question. If you could share the code (or a similar example) > with the list, people could help you spot the pattern and make it vectorize. > > cheers, > --renato >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131016/545d0f5a/attachment.html>
Tom Stellard
2013-Oct-17 00:28 UTC
[LLVMdev] Converting a i32 pointer to a vector of i32 ( C array to LLVM vector)
On Wed, Oct 16, 2013 at 11:14:06AM -0400, Matthieu Dubet wrote:> Hi, > > Thank you for the information, > > So I'm now keeping the array as a pointer (i32*) but the vectorizer doesn't > vectorize it . > > I've pasted the function code before and after optimization (and the list > of optimization that I have activated) in this Gist : > https://gist.github.com/maattd/7008683 > > Some "weird" fact of my LLVM code : > > * all variables (even the one used for the loop condition) are pointers to > memory allocated from the C world and passed to the LLVM functions as an > argument > * even with "opt->add(new llvm::DataLayout(*ee->getDataLayout())) ;" in the > code, the module->dump() doesn't output neither data layout, nor triple > target > > Both those points might confuse the vectorizer ? > > > On Fri, Oct 11, 2013 at 1:40 PM, Renato Golin <renato.golin at linaro.org>wrote: > > > On 11 October 2013 18:27, Matthieu Dubet <maattdd at gmail.com> wrote: > > > >> How can I tell LLVM to consider this i32* as an <10 x i32> (and thus get > >> the performance improvements thanks to SIMD ..etc..) ? > >> > > > > Hi Matthieu, > > > > You shouldn't need to do anything, the vectorizer should spot that for > > you, if the machine you're compiling to has support for vector > > instructions. Any kind of vector operations that you may want to hard-code > > will make it not work on anything other than the intrinsics/inline asm > > you're using, which is not a good idea. > >Which part of the vectorizer is responsible for doing pointer->vector transformations? -Tom> > If your code didn't get vectorized, it's possible that it is not clear > > enough that that pointer is being iterated in a way that it's easy for the > > vectorizer to spot, so maybe you need to make it clearer, and that depends > > on the code in question. If you could share the code (or a similar example) > > with the list, people could help you spot the pattern and make it vectorize. > > > > cheers, > > --renato> >> _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Nadav Rotem
2013-Oct-17 00:59 UTC
[LLVMdev] Converting a i32 pointer to a vector of i32 ( C array to LLVM vector)
Both the SLP vectorizer and the Loop vectorizer support vectorizing pointers. The attached code looks like a candidate for the SLP-vectorizer. Can you run the SLP-vectorizer with the flag -mllvm -debug-only=SLP and attach the log ? I think that we are missing the pattern for the roots of the tree. Thanks, Nadav On Oct 16, 2013, at 5:28 PM, Tom Stellard <tom at stellard.net> wrote:> On Wed, Oct 16, 2013 at 11:14:06AM -0400, Matthieu Dubet wrote: >> Hi, >> >> Thank you for the information, >> >> So I'm now keeping the array as a pointer (i32*) but the vectorizer doesn't >> vectorize it . >> >> I've pasted the function code before and after optimization (and the list >> of optimization that I have activated) in this Gist : >> https://gist.github.com/maattd/7008683 >> >> Some "weird" fact of my LLVM code : >> >> * all variables (even the one used for the loop condition) are pointers to >> memory allocated from the C world and passed to the LLVM functions as an >> argument >> * even with "opt->add(new llvm::DataLayout(*ee->getDataLayout())) ;" in the >> code, the module->dump() doesn't output neither data layout, nor triple >> target >> >> Both those points might confuse the vectorizer ? >> >> >> On Fri, Oct 11, 2013 at 1:40 PM, Renato Golin <renato.golin at linaro.org>wrote: >> >>> On 11 October 2013 18:27, Matthieu Dubet <maattdd at gmail.com> wrote: >>> >>>> How can I tell LLVM to consider this i32* as an <10 x i32> (and thus get >>>> the performance improvements thanks to SIMD ..etc..) ? >>>> >>> >>> Hi Matthieu, >>> >>> You shouldn't need to do anything, the vectorizer should spot that for >>> you, if the machine you're compiling to has support for vector >>> instructions. Any kind of vector operations that you may want to hard-code >>> will make it not work on anything other than the intrinsics/inline asm >>> you're using, which is not a good idea. >>> > > Which part of the vectorizer is responsible for doing pointer->vector transformations? > > -Tom > >>> If your code didn't get vectorized, it's possible that it is not clear >>> enough that that pointer is being iterated in a way that it's easy for the >>> vectorizer to spot, so maybe you need to make it clearer, and that depends >>> on the code in question. If you could share the code (or a similar example) >>> with the list, people could help you spot the pattern and make it vectorize. >>> >>> cheers, >>> --renato > > >>> > >> _______________________________________________ >> LLVM Developers mailing list >> 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 -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131016/95eae986/attachment.html>
Seemingly Similar Threads
- [LLVMdev] adding new instructions to support "swizzle" and "writemask"
- [LLVMdev] Converting a i32 pointer to a vector of i32 ( C array to LLVM vector)
- [LLVMdev] Converting a i32 pointer to a vector of i32 ( C array to LLVM vector)
- [LLVMdev] Converting a i32 pointer to a vector of i32 ( C array to LLVM vector)
- [LLVMdev] Converting a i32 pointer to a vector of i32 ( C array to LLVM vector)