Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MLIR][BUILD] Fix Unicode build issue on Windows. #112300

Merged
merged 4 commits into from
Oct 18, 2024

Conversation

harrisonGPU
Copy link
Contributor

This issue is from #77668. I encountered a build issue because it used Unicode. When I built MLIR on Windows with Visual Studio 2022, I faced a build failure.

@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Oct 15, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 15, 2024

@llvm/pr-subscribers-mlir-core

@llvm/pr-subscribers-mlir

Author: Harrison Hao (harrisonGPU)

Changes

This issue is from #77668. I encountered a build issue because it used Unicode. When I built MLIR on Windows with Visual Studio 2022, I faced a build failure.


Full diff: https://github.com/llvm/llvm-project/pull/112300.diff

1 Files Affected:

  • (modified) mlir/tools/mlir-rewrite/mlir-rewrite.cpp (+8-8)
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();

Copy link
Member

@jpienaar jpienaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG from me

} else {
rewriteState.insertText(nameRange.Start, "〔");
rewriteState.insertText(nameRange.End, "〕");
rewriteState.insertText(nameRange.Start, " [");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets perhaps make this something like " ![" and "]! " - previously one could differentiate between generic or not form.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I have already updated it.

@harrisonGPU
Copy link
Contributor Author

Hi @jpienaar , I have updated this PR, please take a look again. :)

@harrisonGPU harrisonGPU merged commit eb446eb into llvm:main Oct 18, 2024
8 checks passed
@harrisonGPU harrisonGPU deleted the harrison/dix branch October 18, 2024 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:core MLIR Core Infrastructure mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants