[Mlir-commits] [mlir] [mlir][linalg] added some conditions for values being undefined in the documentation for `linalg.generic` (PR #96251)

Jacob Yu llvmlistbot at llvm.org
Fri Jun 21 04:22:12 PDT 2024


https://github.com/pingshiyu updated https://github.com/llvm/llvm-project/pull/96251

>From 1e3973bc43ab6492c1d7b2fbfa5ef88a042fd913 Mon Sep 17 00:00:00 2001
From: pingshiyu <pingshiyu at gmail.com>
Date: Fri, 21 Jun 2024 00:37:14 +0100
Subject: [PATCH 1/2] added some mentions of UBs in the documentation

---
 mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
index 5ee363ed32572..6fbb50dbf94ef 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
@@ -82,6 +82,11 @@ def GenericOp : LinalgStructuredBase_Op<"generic", [
         types:
           parallel, reduction, window
 
+    Any values within the output operands that are not unindexed by the 
+    `indexing_maps` are undefined.
+    Any dimensions associated with a `reduction` `iterator_types` must not 
+    be used for indexing output operands, otherwise the results are undefined.
+
     Example:
     Defining a #matmul_trait attribute in MLIR can be done as follows:
       ```mlir

>From 18c535c54a8f5e1cbfbfaac52d1b99ff289e1312 Mon Sep 17 00:00:00 2001
From: pingshiyu <pingshiyu at gmail.com>
Date: Fri, 21 Jun 2024 12:21:58 +0100
Subject: [PATCH 2/2] updated to make wording more clear

---
 .../mlir/Dialect/Linalg/IR/LinalgStructuredOps.td        | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
index 6fbb50dbf94ef..feba467c2fd5a 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
@@ -82,8 +82,13 @@ def GenericOp : LinalgStructuredBase_Op<"generic", [
         types:
           parallel, reduction, window
 
-    Any values within the output operands that are not unindexed by the 
-    `indexing_maps` are undefined.
+    Any element within the output operands that are not indexed by the 
+    `indexing_maps` are undefined. 
+    For example, if the output operand is a `tensor<2x2xf32>`, and is accessed
+    by the affine map `affine_map<(i) -> (i, i)>` indexing the diagonal elements
+    `[0, 0]` and `[1, 1]`, then the other elements (at `[0, 1]` and `[1, 0]`) are
+    undefined. 
+    
     Any dimensions associated with a `reduction` `iterator_types` must not 
     be used for indexing output operands, otherwise the results are undefined.
 



More information about the Mlir-commits mailing list