[Mlir-commits] [mlir] [mlir][emitc][NFC] Add type clarification to the description for the emitc.global op (PR #127997)

Andrey Timonin llvmlistbot at llvm.org
Fri Feb 21 06:52:01 PST 2025


https://github.com/EtoAndruwa updated https://github.com/llvm/llvm-project/pull/127997

>From e97953575814bcdbba5fa34e70a22690e4a5c4b6 Mon Sep 17 00:00:00 2001
From: EtoAndruwa <timonina1909 at gmail.com>
Date: Thu, 20 Feb 2025 15:13:12 +0300
Subject: [PATCH 1/2] [mlir][emitc][NFC] Add type clarification to the
 description for the emitc.global operation

---
 mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 4fbce995ce5b8..e7a76e808e6c6 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -1126,8 +1126,8 @@ def EmitC_GlobalOp : EmitC_Op<"global", [Symbol]> {
   let summary = "A global variable";
   let description = [{
     The `emitc.global` operation declares or defines a named global variable.
-    The backing memory for the variable is allocated statically and is
-    described by the type of the variable.
+    The backing memory for the variable is allocated statically and described by
+    the variable's type, which must be an EmitC type.
     Optionally, an `initial_value` can be provided.
     Internal linkage can be specified using the `static_specifier` unit attribute
     and external linkage can be specified using the `extern_specifier` unit attribute.
@@ -1147,6 +1147,8 @@ def EmitC_GlobalOp : EmitC_Op<"global", [Symbol]> {
     emitc.global @x : !emitc.array<2xf32> = dense<0.0>
     // Global variable with an initial values.
     emitc.global @x : !emitc.array<3xi32> = dense<[0, 1, 2]>
+    // Global variable with an opaque initial value.
+    emitc.global @y : !emitc.opaque<"char"> = #emitc.opaque<"CHAR_MIN">
     // External global variable
     emitc.global extern @x : !emitc.array<2xf32>
     // Constant global variable with internal linkage

>From 6e2969c3d6787225e0ddc5f14921ed85d05986b7 Mon Sep 17 00:00:00 2001
From: Andrey Timonin <timonina1909 at gmail.com>
Date: Fri, 21 Feb 2025 17:51:53 +0300
Subject: [PATCH 2/2] Update mlir/include/mlir/Dialect/EmitC/IR/EmitC.td

Co-authored-by: Marius Brehler <marius.brehler at gmail.com>
---
 mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index e7a76e808e6c6..cf464f6a09e5b 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -1148,7 +1148,7 @@ def EmitC_GlobalOp : EmitC_Op<"global", [Symbol]> {
     // Global variable with an initial values.
     emitc.global @x : !emitc.array<3xi32> = dense<[0, 1, 2]>
     // Global variable with an opaque initial value.
-    emitc.global @y : !emitc.opaque<"char"> = #emitc.opaque<"CHAR_MIN">
+    emitc.global @x : !emitc.opaque<"char"> = #emitc.opaque<"CHAR_MIN">
     // External global variable
     emitc.global extern @x : !emitc.array<2xf32>
     // Constant global variable with internal linkage



More information about the Mlir-commits mailing list