[PATCH] D60897: [SLP] Look-ahead operand reordering heuristic.

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 16:02:03 PDT 2019


Carrot added a comment.

Following is a simplified test case that shows the performance regression of eigen.  The number of instructions in inner loop is increased from 85 to 93. Hope it can be helpful.

#include "third_party/eigen3/Eigen/Core"

template <typename ValueType>
inline void CheckNonnegative(ValueType value) {

  if (!(value >= 0)) {
    fprintf(stderr, "Check failed.\n");
  }

}

template <typename ValueType>
inline decltype(std::norm(ValueType(0))) SquaredMagnitude(ValueType value) {

  typedef decltype(std::norm(ValueType(0))) ComponentType;
  ComponentType r = std::real(value);
  ComponentType i = std::imag(value);
  return r * r + i * i;

}

template <typename VectorType2>
class DotEigen {
public:

  DotEigen(): first_vector_(16), second_vector_(16) {
  }
  
  inline void Execute() {
    result_ = first_vector_.dot(second_vector_);
    CheckNonnegative(SquaredMagnitude(result_));
  }

public:

  Eigen::Matrix<float, 16, 1> first_vector_;
  VectorType2 second_vector_;
  std::complex<float> result_;

};

typedef DotEigen<Eigen::Matrix<std::complex<float>, 16, 1>> MOperation;
MOperation* operation;

void BM_Dot_RealComplex_EigenDotFixed(int num_iterations) {

  for (int iter = 0; iter < num_iterations; ++iter) {
    operation->Execute();
  }

}


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60897/new/

https://reviews.llvm.org/D60897





More information about the llvm-commits mailing list