[all-commits] [llvm/llvm-project] 88b9e4: [SLP] Steer for the best chance in tryToVectorize(...

Valery Dmitriev via All-commits all-commits at lists.llvm.org
Mon Apr 25 12:26:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 88b9e46fb54c5321742d16016be5b2920facc018
      https://github.com/llvm/llvm-project/commit/88b9e46fb54c5321742d16016be5b2920facc018
  Author: Valery N Dmitriev <valery.n.dmitriev at intel.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    M llvm/test/Transforms/SLPVectorizer/AArch64/invalid_type.ll
    M llvm/test/Transforms/SLPVectorizer/X86/insert-element-build-vector-inseltpoison.ll
    M llvm/test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll
    M llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll

  Log Message:
  -----------
  [SLP] Steer for the best chance in tryToVectorize() when rooting with binary ops.

tryToVectorize() method implements one of searching paths for vectorizable tree roots in SLP vectorizer,
specifically for binary and comparison operations. Order of making probes for various scalar pairs
was defined by its implementation: the instruction operands, then climb over one operand if
the instruction is its sole user and then perform same actions for another operand if previous
attempts failed. Problem with this approach is that among these options we can have more than a
single vectorizable tree candidate and it is not necessarily the one that encountered first.
Trying to build vectorizable tree for each possible combination for just evaluation is expensive.
But we already have lookahead heuristics mechanism which we use for finding best pick among
operands of commutative instructions. It calculates cumulative score for candidates in two
consecutive lanes. This patch introduces use of the heuristics for choosing the best pair among
several combinations. We only try one that looks as most promising for vectorization.
Additional benefit is that we reduce total number of vectorization trees built for probes
because we skip those looking non-profitable early.

Reviewed By: Alexey Bataev (ABataev), Vasileios Porpodas (vporpo)
Differential Revision: https://reviews.llvm.org/D124309




More information about the All-commits mailing list