[Mlir-commits] [mlir] a9a0ea9 - [mlir] Update Erf approximation.

Alexander Belyaev llvmlistbot at llvm.org
Tue Oct 26 12:27:51 PDT 2021


Author: Alexander Belyaev
Date: 2021-10-26T21:27:20+02:00
New Revision: a9a0ea92d13c20227c03b212d2dfa6a41a21ea6f

URL: https://github.com/llvm/llvm-project/commit/a9a0ea92d13c20227c03b212d2dfa6a41a21ea6f
DIFF: https://github.com/llvm/llvm-project/commit/a9a0ea92d13c20227c03b212d2dfa6a41a21ea6f.diff

LOG: [mlir] Update Erf approximation.

Added: 
    

Modified: 
    mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
index dd90dd3461c0..9b49d13546e5 100644
--- a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
+++ b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
@@ -198,9 +198,9 @@ static Value exp2I32(ImplicitLocOpBuilder &builder, Value arg) {
 namespace {
 Value makePolynomialCalculation(ImplicitLocOpBuilder &builder,
                                 llvm::ArrayRef<Value> coeffs, Value x) {
-  auto width = vectorWidth(x.getType(), isF32);
+  auto shape = vectorShape(x.getType(), isF32);
   if (coeffs.size() == 0) {
-    return broadcast(builder, f32Cst(builder, 0.0f), *width);
+    return broadcast(builder, f32Cst(builder, 0.0f), *shape);
   } else if (coeffs.size() == 1) {
     return coeffs[0];
   }
@@ -509,13 +509,13 @@ Log1pApproximation::matchAndRewrite(math::Log1pOp op,
 LogicalResult
 ErfPolynomialApproximation::matchAndRewrite(math::ErfOp op,
                                             PatternRewriter &rewriter) const {
-  auto width = vectorWidth(op.operand().getType(), isF32);
-  if (!width.hasValue())
+  auto shape = vectorShape(op.operand().getType(), isF32);
+  if (!shape.hasValue())
     return rewriter.notifyMatchFailure(op, "unsupported operand type");
 
   ImplicitLocOpBuilder builder(op->getLoc(), rewriter);
   auto bcast = [&](Value value) -> Value {
-    return broadcast(builder, value, *width);
+    return broadcast(builder, value, *shape);
   };
 
   const int intervalsCount = 3;


        


More information about the Mlir-commits mailing list