[Mlir-commits] [mlir] e49c0e4 - [MLIR] Fix confusing diagnostic during dialect conversion
Uday Bondhugula
llvmlistbot at llvm.org
Mon Jan 3 07:06:56 PST 2022
Author: Uday Bondhugula
Date: 2022-01-03T20:13:23+05:30
New Revision: e49c0e483fd751aa60c943eb9f573e4bd28d2a47
URL: https://github.com/llvm/llvm-project/commit/e49c0e483fd751aa60c943eb9f573e4bd28d2a47
DIFF: https://github.com/llvm/llvm-project/commit/e49c0e483fd751aa60c943eb9f573e4bd28d2a47.diff
LOG: [MLIR] Fix confusing diagnostic during dialect conversion
Fix confusing diagnostic during partial dialect conversion. A failure to
legalize is not the same as an operation being illegal: for eg. an
operation neither explicity marked legal nor explicitly marked illegal
could have been generated and may have failed to legalize further. The
op isn't an illegal one per
https://mlir.llvm.org/docs/DialectConversion/#conversion-target
which is an op that is explicitly marked illegal.
Differential Revision: https://reviews.llvm.org/D116152
Added:
Modified:
mlir/docs/DialectConversion.md
mlir/lib/Transforms/Utils/DialectConversion.cpp
Removed:
################################################################################
diff --git a/mlir/docs/DialectConversion.md b/mlir/docs/DialectConversion.md
index 394b15cda362b..39cee4b822b5f 100644
--- a/mlir/docs/DialectConversion.md
+++ b/mlir/docs/DialectConversion.md
@@ -75,6 +75,10 @@ legality actions below:
conversion to be successful. This action also allows for selectively
marking specific operations as illegal in an otherwise legal dialect.
+Operations and dialects that are neither explicitly marked legal nor illegal are
+separate from the above ("unknown" operations) and are treated
diff erently, for
+example, for the purposes of partial conversion as mentioned above.
+
An example conversion target is shown below:
```c++
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 24711b0de1322..657b0eb834e6b 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -1931,7 +1931,7 @@ OperationLegalizer::legalizeWithFold(Operation *op,
Operation *cstOp = rewriterImpl.createdOps[i];
if (failed(legalize(cstOp, rewriter))) {
LLVM_DEBUG(logFailure(rewriterImpl.logger,
- "generated constant '{0}' was illegal",
+ "failed to legalize generated constant '{0}'",
cstOp->getName()));
rewriterImpl.resetState(curState);
return failure();
@@ -2106,7 +2106,7 @@ LogicalResult OperationLegalizer::legalizePatternCreatedOperations(
Operation *op = impl.createdOps[i];
if (failed(legalize(op, rewriter))) {
LLVM_DEBUG(logFailure(impl.logger,
- "generated operation '{0}'({1}) was illegal",
+ "failed to legalize generated operation '{0}'({1})",
op->getName(), op));
return failure();
}
@@ -2120,9 +2120,9 @@ LogicalResult OperationLegalizer::legalizePatternRootUpdates(
for (int i = state.numRootUpdates, e = newState.numRootUpdates; i != e; ++i) {
Operation *op = impl.rootUpdates[i].getOperation();
if (failed(legalize(op, rewriter))) {
- LLVM_DEBUG(logFailure(impl.logger,
- "operation updated in-place '{0}' was illegal",
- op->getName()));
+ LLVM_DEBUG(logFailure(
+ impl.logger, "failed to legalize operation updated in-place '{0}'",
+ op->getName()));
return failure();
}
}
More information about the Mlir-commits
mailing list