Jonas Paulsson via llvm-dev
2017-Mar-17 16:11 UTC
[llvm-dev] LoopVectorizer with ifconversion
Hi, it seems to be generally a bad idea to enable vectorization of conditional stores on SystemZ, because it will cost extra instructions both to 1. extract compare result element 2. Do a test-under-mask instruction on that element 3. conditional branch past the store block. Ideally, I would like to adjust the cost for the vector compare. I am not sure if this is feasable since I would need to know that the compare is becoming a vector compare for a block that will not go away after vectorization (which is the case if there is a store in it). The LoopVectorizer seems to have this information available. Is it possible to easily use it in this case somehow? Or is it more convenient to add a tti hook to complement the EnableCondStoresVectorization option, perhaps? /Jonas
On 03/17/2017 11:11 AM, Jonas Paulsson via llvm-dev wrote:> > Hi, > > it seems to be generally a bad idea to enable vectorization of > conditional stores on SystemZ, because it will cost extra instructions > both to 1. extract compare result element 2. Do a test-under-mask > instruction on that element 3. conditional branch past the store block.In general, this is true everywhere. In a large vectorized loop, this cost may well be worthwhile. The idea is that the cost model should account for all of these costs. If it doesn't properly, we should fix that. -Hal> > Ideally, I would like to adjust the cost for the vector compare. I am > not sure if this is feasable since I would need to know that the > compare is becoming a vector compare for a block that will not go away > after vectorization (which is the case if there is a store in it). > > The LoopVectorizer seems to have this information available. Is it > possible to easily use it in this case somehow? > > Or is it more convenient to add a tti hook to complement the > EnableCondStoresVectorization option, perhaps? > > /Jonas > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory
Renato Golin via llvm-dev
2017-Mar-17 21:23 UTC
[llvm-dev] LoopVectorizer with ifconversion
On 17 March 2017 at 16:34, Hal Finkel <hfinkel at anl.gov> wrote:> In general, this is true everywhere. In a large vectorized loop, this cost > may well be worthwhile. The idea is that the cost model should account for > all of these costs. If it doesn't properly, we should fix that.Isn't this only worth when the SIMD instructions can be conditionalised per lane? I believe AVX512 and SVE have such abilities, but not NEON or SSE. Does SystemZ support conditionalisation in SIMD? cheers, --renato