[Mlir-commits] [mlir] [MLIR][BUILD] Fix Unicode build issue on Windows. (PR #112300)

Harrison Hao llvmlistbot at llvm.org
Tue Oct 15 19:52:12 PDT 2024


https://github.com/harrisonGPU updated https://github.com/llvm/llvm-project/pull/112300

>From 76e6ecfb4c49484f5b4ecde80546bde2a0025536 Mon Sep 17 00:00:00 2001
From: Harrison Hao <harrison.hao at amd.com>
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 308e6490726c86..5e3044aa40569b 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 <tsworld1314 at gmail.com>
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 ab6bfe24fccf03..66f17f093f5094 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<?x4x?xf32>, %arg1: tensor<2x4x?xf32>) -> tensor<?x4x?xf32> {
   // RENAME: "test.concat"({{.*}}) {bxis = 0 : i64}
-  // RANGE: 《%{{.*}} = 〖"test.concat"〗({{.*}}) {axis = 0 : i64} : (tensor<?x4x?xf32>, tensor<2x4x?xf32>) -> tensor<?x4x?xf32>》
+  // RANGE: <%{{.*}} = ["test.concat"]({{.*}}) {axis = 0 : i64} : (tensor<?x4x?xf32>, tensor<2x4x?xf32>) -> tensor<?x4x?xf32>>
   %5 = "test.concat"(%arg0, %arg1) {axis = 0 : i64} : (tensor<?x4x?xf32>, tensor<2x4x?xf32>) -> tensor<?x4x?xf32>
   return %5 : tensor<?x4x?xf32>
 }
-
diff --git a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp
index 5e3044aa40569b..e70aa5d41aa049 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, "]!");
     }
   }
 



More information about the Mlir-commits mailing list