Skip to content

[NFC][mlir][emitc] fix misspelling in description of emitc.global #115548

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

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

EtoAndruwa
Copy link
Contributor

Missing ! before emitc.global was added in the EmitC.td.

@llvmbot
Copy link
Member

llvmbot commented Nov 8, 2024

@llvm/pr-subscribers-mlir

Author: Andrey Timonin (EtoAndruwa)

Changes

Missing ! before emitc.global was added in the EmitC.td.


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

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/EmitC/IR/EmitC.td (+2-2)
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 7c84ab4dd39eb7..91916c1c4493dd 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -1110,9 +1110,9 @@ def EmitC_GlobalOp : EmitC_Op<"global", [Symbol]> {
 
     ```mlir
     // Global variable with an initial value.
-    emitc.global @x : emitc.array<2xf32> = dense<0.0, 2.0>
+    emitc.global @x : !emitc.array<2xf32> = dense<0.0, 2.0>
     // External global variable
-    emitc.global extern @x : emitc.array<2xf32>
+    emitc.global extern @x : !emitc.array<2xf32>
     // Constant global variable with internal linkage
     emitc.global static const @x : i32 = 0
     ```

@llvmbot
Copy link
Member

llvmbot commented Nov 8, 2024

@llvm/pr-subscribers-mlir-emitc

Author: Andrey Timonin (EtoAndruwa)

Changes

Missing ! before emitc.global was added in the EmitC.td.


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

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/EmitC/IR/EmitC.td (+2-2)
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 7c84ab4dd39eb7..91916c1c4493dd 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -1110,9 +1110,9 @@ def EmitC_GlobalOp : EmitC_Op<"global", [Symbol]> {
 
     ```mlir
     // Global variable with an initial value.
-    emitc.global @x : emitc.array<2xf32> = dense<0.0, 2.0>
+    emitc.global @x : !emitc.array<2xf32> = dense<0.0, 2.0>
     // External global variable
-    emitc.global extern @x : emitc.array<2xf32>
+    emitc.global extern @x : !emitc.array<2xf32>
     // Constant global variable with internal linkage
     emitc.global static const @x : i32 = 0
     ```

@EtoAndruwa EtoAndruwa marked this pull request as draft November 8, 2024 21:54
@EtoAndruwa EtoAndruwa force-pushed the fix-global-description branch from 9e13316 to b4d2c5d Compare November 8, 2024 21:59
@EtoAndruwa EtoAndruwa marked this pull request as ready for review November 8, 2024 21:59
@EtoAndruwa
Copy link
Contributor Author

EtoAndruwa commented Nov 8, 2024

It seems that something is wrong in the parser of emitc.global due to:

error: expected '>'
emitc.global @x : !emitc.array<2xf32> = dense<0.0, 2.0>

@EtoAndruwa EtoAndruwa marked this pull request as draft November 8, 2024 22:07
@EtoAndruwa
Copy link
Contributor Author

It seems that something is wrong in the parser of emitc.global due to:

error: expected '>'
emitc.global @x : !emitc.array<2xf32> = dense<0.0, 2.0>

Wrong usage of dense here. Right example of usage is:

emitc.global @myglobal : !emitc.array<2xf32> = dense<4.000000e+00>
// CPP-DEFAULT: float myglobal[2] = {4.000000000e+00f, 4.000000000e+00f};
// CPP-DECLTOP: float myglobal[2] = {4.000000000e+00f, 4.000000000e+00f};

@EtoAndruwa
Copy link
Contributor Author

It seems that something is wrong in the parser of emitc.global due to:

error: expected '>'
emitc.global @x : !emitc.array<2xf32> = dense<0.0, 2.0>

Wrong usage of dense here. Right example of usage is:

emitc.global @myglobal : !emitc.array<2xf32> = dense<4.000000e+00>
// CPP-DEFAULT: float myglobal[2] = {4.000000000e+00f, 4.000000000e+00f};
// CPP-DECLTOP: float myglobal[2] = {4.000000000e+00f, 4.000000000e+00f};

I guess author wanted to get something like:

int32_t global_array[3] = {0, 1, 2};

Therefore, the right version will be:

emitc.global @global_array : !emitc.array<3xi32> = dense<[0, 1, 2]>

@EtoAndruwa EtoAndruwa marked this pull request as ready for review November 8, 2024 22:58
Copy link
Contributor

@simon-camp simon-camp left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@marbre marbre left a comment

Choose a reason for hiding this comment

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

Thanks!

@marbre marbre merged commit 4c9cb97 into llvm:main Nov 13, 2024
10 checks passed
@EtoAndruwa EtoAndruwa deleted the fix-global-description branch November 14, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants