From 76e6ecfb4c49484f5b4ecde80546bde2a0025536 Mon Sep 17 00:00:00 2001 From: Harrison Hao Date: Tue, 15 Oct 2024 11:28:42 +0800 Subject: [PATCH 1/2] [MLIR][BUILD] Fix Unicode build issue on Windows. --- mlir/tools/mlir-rewrite/mlir-rewrite.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp index 308e6490726c8..5e3044aa40569 100644 --- a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp +++ b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp @@ -320,25 +320,25 @@ LogicalResult markRanges(RewritePad &rewriteState, raw_ostream &os) { for (auto it : rewriteState.getOpDefs()) { auto [startOp, endOp] = getOpRange(it); - rewriteState.insertText(startOp, "《"); - rewriteState.insertText(endOp, "》"); + rewriteState.insertText(startOp, " <"); + rewriteState.insertText(endOp, "> "); auto nameRange = getOpNameRange(it); if (isGeneric(it)) { - rewriteState.insertText(nameRange.Start, "〖"); - rewriteState.insertText(nameRange.End, "〗"); + rewriteState.insertText(nameRange.Start, " ["); + rewriteState.insertText(nameRange.End, "] "); } else { - rewriteState.insertText(nameRange.Start, "〔"); - rewriteState.insertText(nameRange.End, "〕"); + rewriteState.insertText(nameRange.Start, " ["); + rewriteState.insertText(nameRange.End, "] "); } } // Highlight all comment lines. // TODO: Could be replaced if this is kept in memory. for (auto commentLine : rewriteState.getSingleLineComments()) { - rewriteState.insertText(commentLine.Start, "❰"); - rewriteState.insertText(commentLine.End, "❱"); + rewriteState.insertText(commentLine.Start, "{"); + rewriteState.insertText(commentLine.End, "}"); } return success(); From cde0eba6e066429738ecf5226db54fbda5182939 Mon Sep 17 00:00:00 2001 From: Harrison Hao Date: Wed, 16 Oct 2024 01:19:43 +0000 Subject: [PATCH 2/2] [MLIR][BUILD] Update code for comments. --- mlir/test/mlir-rewrite/simple.mlir | 3 +-- mlir/tools/mlir-rewrite/mlir-rewrite.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mlir/test/mlir-rewrite/simple.mlir b/mlir/test/mlir-rewrite/simple.mlir index ab6bfe24fccf0..66f17f093f509 100644 --- a/mlir/test/mlir-rewrite/simple.mlir +++ b/mlir/test/mlir-rewrite/simple.mlir @@ -4,8 +4,7 @@ func.func @two_dynamic_one_direct_shape(%arg0: tensor, %arg1: tensor<2x4x?xf32>) -> tensor { // RENAME: "test.concat"({{.*}}) {bxis = 0 : i64} - // RANGE: 《%{{.*}} = 〖"test.concat"〗({{.*}}) {axis = 0 : i64} : (tensor, tensor<2x4x?xf32>) -> tensor》 + // RANGE: <%{{.*}} = ["test.concat"]({{.*}}) {axis = 0 : i64} : (tensor, tensor<2x4x?xf32>) -> tensor> %5 = "test.concat"(%arg0, %arg1) {axis = 0 : i64} : (tensor, tensor<2x4x?xf32>) -> tensor return %5 : tensor } - diff --git a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp index 5e3044aa40569..e70aa5d41aa04 100644 --- a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp +++ b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp @@ -320,17 +320,17 @@ LogicalResult markRanges(RewritePad &rewriteState, raw_ostream &os) { for (auto it : rewriteState.getOpDefs()) { auto [startOp, endOp] = getOpRange(it); - rewriteState.insertText(startOp, " <"); - rewriteState.insertText(endOp, "> "); + rewriteState.insertText(startOp, "<"); + rewriteState.insertText(endOp, ">"); auto nameRange = getOpNameRange(it); if (isGeneric(it)) { - rewriteState.insertText(nameRange.Start, " ["); - rewriteState.insertText(nameRange.End, "] "); + rewriteState.insertText(nameRange.Start, "["); + rewriteState.insertText(nameRange.End, "]"); } else { - rewriteState.insertText(nameRange.Start, " ["); - rewriteState.insertText(nameRange.End, "] "); + rewriteState.insertText(nameRange.Start, "!["); + rewriteState.insertText(nameRange.End, "]!"); } }