[Mlir-commits] [mlir] [mlir][scf] Add high-level documentation (PR #72313)

Rik Huijzer llvmlistbot at llvm.org
Wed Nov 15 01:25:53 PST 2023


https://github.com/rikhuijzer updated https://github.com/llvm/llvm-project/pull/72313

>From 666ce24542a51b21dd9b7b98548fcd030e56e778 Mon Sep 17 00:00:00 2001
From: Rik Huijzer <github at huijzer.xyz>
Date: Tue, 14 Nov 2023 22:26:10 +0100
Subject: [PATCH 1/3] [mlir][scf] Add high-level documentation

---
 mlir/include/mlir/Dialect/SCF/IR/SCFOps.td | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
index 2c5abe7a63ac44d..f487ea52586eb7d 100644
--- a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
+++ b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
@@ -26,6 +26,20 @@ include "mlir/Interfaces/ViewLikeInterface.td"
 def SCF_Dialect : Dialect {
   let name = "scf";
   let cppNamespace = "::mlir::scf";
+
+  let description = [{
+    The `scf` (structured control flow) dialect contains operations that
+    represent control flow constructs such as `if` and `for`. Being
+    _structured_ means that the control flow has a structure unlike, for
+    example, `goto`s or `assert`s. Unstructured control flow operations are
+    located in the `cf` (control flow) dialect.
+
+    Originally, this dialect was developed as a common lowering stage for the
+    `affine` and `linalg` dialects. Both convert to SCF loops instead of
+    targeting branch-based CFGs directly. Typically, `scf` is lowered to `sc`
+    and then lowered to some target like LLVM or SPIR-V.
+  }];
+
   let dependentDialects = ["arith::ArithDialect"];
 }
 

>From b614c252cc700888b9fb985727b228617d049808 Mon Sep 17 00:00:00 2001
From: Rik Huijzer <github at huijzer.xyz>
Date: Tue, 14 Nov 2023 22:31:57 +0100
Subject: [PATCH 2/3] Add one word for clarity

---
 mlir/include/mlir/Dialect/SCF/IR/SCFOps.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
index f487ea52586eb7d..36aa5c6352c828f 100644
--- a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
+++ b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
@@ -37,7 +37,7 @@ def SCF_Dialect : Dialect {
     Originally, this dialect was developed as a common lowering stage for the
     `affine` and `linalg` dialects. Both convert to SCF loops instead of
     targeting branch-based CFGs directly. Typically, `scf` is lowered to `sc`
-    and then lowered to some target like LLVM or SPIR-V.
+    and then lowered to some final target like LLVM or SPIR-V.
   }];
 
   let dependentDialects = ["arith::ArithDialect"];

>From e46495ccf9ab86a4f163aff9be0f53e9967ebc1f Mon Sep 17 00:00:00 2001
From: Rik Huijzer <github at huijzer.xyz>
Date: Wed, 15 Nov 2023 10:25:46 +0100
Subject: [PATCH 3/3] Update mlir/include/mlir/Dialect/SCF/IR/SCFOps.td

Co-authored-by: Mehdi Amini <joker.eph at gmail.com>
---
 mlir/include/mlir/Dialect/SCF/IR/SCFOps.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
index 36aa5c6352c828f..573e804b405e84c 100644
--- a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
+++ b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
@@ -36,7 +36,7 @@ def SCF_Dialect : Dialect {
 
     Originally, this dialect was developed as a common lowering stage for the
     `affine` and `linalg` dialects. Both convert to SCF loops instead of
-    targeting branch-based CFGs directly. Typically, `scf` is lowered to `sc`
+    targeting branch-based CFGs directly. Typically, `scf` is lowered to `cf`
     and then lowered to some final target like LLVM or SPIR-V.
   }];
 



More information about the Mlir-commits mailing list