[Mlir-commits] [mlir] [docs][mlir] Fix usage of dense elements array for memref.global (PR #121022)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Dec 23 18:30:46 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Giordano Salvador (e3m3)

<details>
<summary>Changes</summary>

Fix the usage of dense elements array for the `memref.global` documentation.

Specifically, add missing brackets in multi-value dense array:
* `dense<0.0,2.0>` -> `dense<[0.0,2.0]>`
* `dense<1,4>` -> `dense<[1,4]>`

See [docs](https://mlir.llvm.org/docs/Dialects/MemRef/#memrefglobal-memrefglobalop).

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


1 Files Affected:

- (modified) mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td (+3-3) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index a0d8d34f38237a..e597fc193bcec2 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -1126,10 +1126,10 @@ def MemRef_GlobalOp : MemRef_Op<"global", [Symbol]> {
 
     ```mlir
     // Private variable with an initial value.
-    memref.global "private" @x : memref<2xf32> = dense<0.0,2.0>
+    memref.global "private" @x : memref<2xf32> = dense<[0.0,2.0]>
 
     // Private variable with an initial value and an alignment (power of 2).
-    memref.global "private" @x : memref<2xf32> = dense<0.0,2.0> {alignment = 64}
+    memref.global "private" @x : memref<2xf32> = dense<[0.0,2.0]> {alignment = 64}
 
     // Declaration of an external variable.
     memref.global "private" @y : memref<4xi32>
@@ -1138,7 +1138,7 @@ def MemRef_GlobalOp : MemRef_Op<"global", [Symbol]> {
     memref.global @z : memref<3xf16> = uninitialized
 
     // Externally visible constant variable.
-    memref.global constant @c : memref<2xi32> = dense<1, 4>
+    memref.global constant @c : memref<2xi32> = dense<[1, 4]>
     ```
   }];
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/121022


More information about the Mlir-commits mailing list