[Mlir-commits] [mlir] e4e4da8 - [MLIR] Prevent creation of buggy affine map after linearizing collapsed dimensions of source map

Uday Bondhugula llvmlistbot at llvm.org
Fri Nov 26 11:03:18 PST 2021


Author: Arnab Dutta
Date: 2021-11-27T00:32:58+05:30
New Revision: e4e4da86aff5606ef792d987a3ec85639219228c

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

LOG: [MLIR] Prevent creation of buggy affine map after linearizing collapsed dimensions of source map

Initially we were passing wrong numSymbols argument while calling
AffineMap::get() for creaating affine map with linearized result
expressions. The main problems was the number of symbols of the newly
to be created map may be different from that of the source map, as
new symbolic identifiers may be introduced while creating strided layout
linearized expressions.

Reviewed By: nicolasvasilache, bondhugula

Differential Revision: https://reviews.llvm.org/D114240

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
index 783e1be849205..6faf6857c2aaa 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
@@ -385,8 +385,7 @@ static AffineMap linearizeCollapsedDims(AffineMap sourceMap,
         makeCanonicalStridedLayoutExpr(sizes, dimExprs, context);
     resultExprs.push_back(linearizedExpr);
   }
-  return AffineMap::get(sourceMap.getNumDims(), sourceMap.getNumSymbols(),
-                        resultExprs, context);
+  return AffineMap::inferFromExprList({resultExprs}).front();
 }
 
 // TensorExpandShapeOp is fusable with its consumer (i.e. reshape as a


        


More information about the Mlir-commits mailing list