Role of the LLVM autovectorizer in TVM

Hi all,

I am trying to understand the role of the LLVM auto-vectorizer in TVM. Indeed, in llvm_codegen.cc we explicitly set:

  builder.LoopVectorize = true;
  builder.SLPVectorize = true;

And I am trying to determine to what level TVM is relying on LLVM auto-vectorization.

What is my understanding

As far as I understood, TVM implements its own vectorizer in vectorize_loop.cc (which is a TIR pass). So if a loop is vectorized in TVM, the LLVM autovectorization won’t be used.

If instead a loop is not vectorized in TVM, the LLVM autovectorizer will kick in and try to vectorize the loop.

Is my understanding correct? Does this mean that, for most operators like conv2d or gemm the LLVM autovectorizer would be mostly ineffective?

cc @ramana-arm, @mbaret, @manupa-arm

@kevinthesun Pinging in case you have wondered about this before

Yeah. In most cases we can do vectorize in TIR instead of relying on llvm.