[Mlir-commits] [mlir] 7d8b478 - [mlir][Linalg] Drop spurious error message
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Mar 29 09:17:40 PDT 2021
Author: MaheshRavishankar
Date: 2021-03-29T09:17:25-07:00
New Revision: 7d8b478ce13c1320c91c9c8dccc798d2019cd8db
URL: https://github.com/llvm/llvm-project/commit/7d8b478ce13c1320c91c9c8dccc798d2019cd8db
DIFF: https://github.com/llvm/llvm-project/commit/7d8b478ce13c1320c91c9c8dccc798d2019cd8db.diff
LOG: [mlir][Linalg] Drop spurious error message
Drop usage of `emitRemark` and use `notifyMatchFailure` instead to
avoid unnecessary spew during compilation.
Differential Revision: https://reviews.llvm.org/D99485
Added:
Modified:
mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
mlir/test/Dialect/Linalg/reshape_linearization_fusion.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp b/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
index 7e89a0887d0df..71f3bef56969e 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
@@ -880,8 +880,10 @@ struct FoldProducerReshapeOpByLinearization
// Further check that the resulting index maps can be fused and
// inverted. Without this the resultant op is not legal.
- if (!inversePermutation(concatAffineMaps(fusedIndexMaps)))
- return op.emitRemark("fused op loop bound computation failed");
+ if (!inversePermutation(concatAffineMaps(fusedIndexMaps))) {
+ return rewriter.notifyMatchFailure(
+ op, "fused op loop bound computation failed");
+ }
rewriter.startRootUpdate(op);
op->setOperands(fusedOperands);
@@ -973,15 +975,19 @@ struct FoldConsumerReshapeOpByLinearization
linearizeCollapsedDims(invMap, reshapeOp.getSrcType().getShape(),
reshapeOp.getReassociationMaps());
for (AffineExpr expr : modifiedMap.getResults()) {
- if (!expr.isPureAffine())
- return producer.emitRemark("fused op indexing map is not affine");
+ if (!expr.isPureAffine()) {
+ return rewriter.notifyMatchFailure(
+ producer, "fused op indexing map is not affine");
+ }
}
fusedIndexMaps.back() = modifiedMap;
// Further check that the resulting index maps can be fused and
// inverted. Without this the resultant op is not legal.
- if (!inversePermutation(concatAffineMaps(fusedIndexMaps)))
- return reshapeOp.emitRemark("fused op loop bound computation failed");
+ if (!inversePermutation(concatAffineMaps(fusedIndexMaps))) {
+ return rewriter.notifyMatchFailure(
+ producer, "fused op loop bound computation failed");
+ }
Location loc = producer.getLoc();
Value output = rewriter.create<TensorReshapeOp>(
diff --git a/mlir/test/Dialect/Linalg/reshape_linearization_fusion.mlir b/mlir/test/Dialect/Linalg/reshape_linearization_fusion.mlir
index cb57f00372c79..382f6016ee2df 100644
--- a/mlir/test/Dialect/Linalg/reshape_linearization_fusion.mlir
+++ b/mlir/test/Dialect/Linalg/reshape_linearization_fusion.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt -split-input-file -linalg-fold-reshape-ops-by-linearization -verify-diagnostics %s | FileCheck %s
+// RUN: mlir-opt -split-input-file -linalg-fold-reshape-ops-by-linearization %s | FileCheck %s
#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
func @generic_op_reshape_producer_fusion(%arg0 : tensor<?x?x?xf32>,
@@ -257,7 +257,6 @@ func @generic_op_reshape_consumer_nofusion(%arg0 : tensor<?x?x?x5xf32>,
%arg1 : tensor<?x?x?x5xf32>) ->
tensor<?x?xf32>
{
- // expected-remark @+1 {{fused op indexing map is not affine}}
%0 = linalg.generic {
indexing_maps = [#map0, #map0, #map0],
iterator_types = ["parallel", "parallel", "parallel", "parallel"]}
@@ -272,3 +271,10 @@ func @generic_op_reshape_consumer_nofusion(%arg0 : tensor<?x?x?x5xf32>,
tensor<?x?x?x5xf32> into tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
+// CHECK-LABEL: func @generic_op_reshape_consumer_nofusion
+// CHECK-SAME: %[[ARG0:[a-zA-Z0-9_]+]]: tensor<?x?x?x5xf32>
+// CHECK-SAME: %[[ARG1:[a-zA-Z0-9_]+]]: tensor<?x?x?x5xf32>
+// CHECK: %[[NOFUSE:.+]] = linalg.generic
+// CHECK-SAME: ins(%[[ARG0]], %[[ARG1]]
+// CHECK: %[[RESULT:.+]] = linalg.tensor_reshape %[[NOFUSE]]
+// CHECK: return %[[RESULT]]
More information about the Mlir-commits
mailing list