Shahid, Asghar-ahmad
2014-Dec-13 15:43 UTC
[LLVMdev] Vectorization factor limitation in Loop Vectorizer
So IMO, if we modify the VF calculation for targets/subtargets using TTI where higher VF is supported The vectorizer’s scope will become wider. Did/do you foresee any issue with this? Thanks, Shahid From: Nadav Rotem [mailto:nrotem at apple.com] Sent: Saturday, December 13, 2014 2:47 AM To: Shahid, Asghar-ahmad Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Vectorization factor limitation in Loop Vectorizer Hi Shahid, On Dec 10, 2014, at 10:48 PM, Shahid, Asghar-ahmad <Asghar-ahmad.Shahid at amd.com<mailto:Asghar-ahmad.Shahid at amd.com>> wrote: Hi Nadav/Devs I am exploring Loop Vectorizer to vectorize i8 scalar operations into 8xi8 vector operation. I was expecting the Loop Vectorizer to analyze the profitability for vectorization factor(VF) of 8, However it is not doing so due to the widest type calculation done for the blocks inside the loop. May be I am missing something, however, I am curious to know why Loop Vectorizer limits the profitability check to widest type and not allowing for other narrower type? The vectorizer stops the search of profitable vectorization factors at the widest type because higher vectorization factors would require the compiler to split the vectorized value into multiple registers. The vectorizer’s cost model first tries to optimize for SIMD instruction utilization. Later, we optimize for ILP by doubling the vectorization factor (we call it “interleave”) and exposing ILP. Thanks, Nadav Regards, Shahid _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.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/20141213/b489de93/attachment.html>
James Molloy
2014-Dec-13 22:18 UTC
[LLVMdev] Vectorization factor limitation in Loop Vectorizer
Hi shahid, Having looked into this in the past, we're not taking into account the fact that integer promotions and truncations will disappear during code generation. The canonicalisation phase likes to create i32 and greater type arithmetic, which creates extensions and promotions . However of course the vectoriser can use i8 arithmetic I vectors, so those should go away. Often this is the cause of insufficient vectorisation factors being picked, and we should fix it. James On Sat, 13 Dec 2014 at 16:09, Shahid, Asghar-ahmad < Asghar-ahmad.Shahid at amd.com> wrote:> So IMO, if we modify the VF calculation for targets/subtargets using TTI > where higher VF is supported > > The vectorizer’s scope will become wider. > > > > Did/do you foresee any issue with this? > > > > Thanks, > > Shahid > > > > *From:* Nadav Rotem [mailto:nrotem at apple.com] > *Sent:* Saturday, December 13, 2014 2:47 AM > *To:* Shahid, Asghar-ahmad > *Cc:* llvmdev at cs.uiuc.edu > *Subject:* Re: [LLVMdev] Vectorization factor limitation in Loop > Vectorizer > > > > Hi Shahid, > > > > On Dec 10, 2014, at 10:48 PM, Shahid, Asghar-ahmad < > Asghar-ahmad.Shahid at amd.com> wrote: > > > > Hi Nadav/Devs > > > > I am exploring Loop Vectorizer to vectorize i8 scalar operations into 8xi8 > vector operation. > > > > I was expecting the Loop Vectorizer to analyze the profitability for > vectorization factor(VF) of 8, > > However it is not doing so due to the widest type calculation done for the > blocks inside the loop. > > > > May be I am missing something, however, I am curious to know why Loop > Vectorizer limits the > > profitability check to widest type and not allowing for other narrower > type? > > > > The vectorizer stops the search of profitable vectorization factors at the > widest type because higher vectorization factors would require the compiler > to split the vectorized value into multiple registers. The vectorizer’s > cost model first tries to optimize for SIMD instruction utilization. Later, > we optimize for ILP by doubling the vectorization factor (we call it > “interleave”) and exposing ILP. > > > > Thanks, > > Nadav > > > > > > Regards, > > Shahid > > _______________________________________________ > 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/20141213/bbac98f2/attachment.html>
Shahid, Asghar-ahmad
2014-Dec-15 15:25 UTC
[LLVMdev] Vectorization factor limitation in Loop Vectorizer
Hi James, Thanks for the clarification. I hope to come back once I have a fix. Pls let me know if you have any suggestion. Thanks, Shahid From: James Molloy [mailto:james at jamesmolloy.co.uk] Sent: Sunday, December 14, 2014 3:48 AM To: Shahid, Asghar-ahmad; Nadav Rotem Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Vectorization factor limitation in Loop Vectorizer Hi shahid, Having looked into this in the past, we're not taking into account the fact that integer promotions and truncations will disappear during code generation. The canonicalisation phase likes to create i32 and greater type arithmetic, which creates extensions and promotions . However of course the vectoriser can use i8 arithmetic I vectors, so those should go away. Often this is the cause of insufficient vectorisation factors being picked, and we should fix it. James On Sat, 13 Dec 2014 at 16:09, Shahid, Asghar-ahmad <Asghar-ahmad.Shahid at amd.com<mailto:Asghar-ahmad.Shahid at amd.com>> wrote: So IMO, if we modify the VF calculation for targets/subtargets using TTI where higher VF is supported The vectorizer’s scope will become wider. Did/do you foresee any issue with this? Thanks, Shahid From: Nadav Rotem [mailto:nrotem at apple.com<mailto:nrotem at apple.com>] Sent: Saturday, December 13, 2014 2:47 AM To: Shahid, Asghar-ahmad Cc: llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu> Subject: Re: [LLVMdev] Vectorization factor limitation in Loop Vectorizer Hi Shahid, On Dec 10, 2014, at 10:48 PM, Shahid, Asghar-ahmad <Asghar-ahmad.Shahid at amd.com<mailto:Asghar-ahmad.Shahid at amd.com>> wrote: Hi Nadav/Devs I am exploring Loop Vectorizer to vectorize i8 scalar operations into 8xi8 vector operation. I was expecting the Loop Vectorizer to analyze the profitability for vectorization factor(VF) of 8, However it is not doing so due to the widest type calculation done for the blocks inside the loop. May be I am missing something, however, I am curious to know why Loop Vectorizer limits the profitability check to widest type and not allowing for other narrower type? The vectorizer stops the search of profitable vectorization factors at the widest type because higher vectorization factors would require the compiler to split the vectorized value into multiple registers. The vectorizer’s cost model first tries to optimize for SIMD instruction utilization. Later, we optimize for ILP by doubling the vectorization factor (we call it “interleave”) and exposing ILP. Thanks, Nadav Regards, Shahid _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.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<mailto: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/20141215/b140d83b/attachment.html>