[LLVMdev] LLVM loop vectorizer

RCU alex.e.susu at gmail.com
Wed Jul 8 10:01:31 PDT 2015


   Hello.
     I am trying to vectorize a CSR SpMV (sparse matrix vector multiplication) procedure 
but the LLVM loop vectorizer is not able to handle such code.
     I am using cland and llvm version 3.4 (on Ubuntu 12.10). I use the -fvectorize option 
with clang and -loop-vectorize with opt-3.4 .
     The CSR SpMV function is inspired from 
http://stackoverflow.com/questions/13636464/slow-sparse-matrix-vector-product-csr-using-open-mp 
(I can provide the exact code samples used).

     Basically the problem is the loop vectorizer does NOT work with if inside loop (be it 
2 nested loops or a modification of SpMV I did with just 1 loop - I can provide the exact 
code) changing the value of the accumulator z. I can sort of understand why LLVM isn't 
able to vectorize the code.
     However, at http://llvm.org/docs/Vectorizers.html#if-conversion it is written:
             <<The Loop Vectorizer is able to "flatten" the IF statement in the code and 
generate a single stream of instructions.
               The Loop Vectorizer supports any control flow in the innermost loop.
               The innermost loop may contain complex nesting of IFs, ELSEs and even GOTOs.>>
      Could you please tell me what are these lines exactly trying to say.

     Could you please tell me what algorithm is the LLVM loop vectorizer using (maybe the 
algorithm is described in a paper) - I currently found only 2 presentations on this topic: 
http://llvm.org/devmtg/2013-11/slides/Rotem-Vectorization.pdf and 
https://archive.fosdem.org/2014/schedule/event/llvmautovec/attachments/audio/321/export/events/attachments/llvmautovec/audio/321/AutoVectorizationLLVM.pdf 
.

   Thank you very much,
       Alex



More information about the llvm-dev mailing list