[Mlir-commits] [mlir] [mlir][scf] Add high-level documentation (PR #72313)
Rik Huijzer
llvmlistbot at llvm.org
Tue Nov 14 13:32:25 PST 2023
https://github.com/rikhuijzer created https://github.com/llvm/llvm-project/pull/72313
Credits for this description go to @ftynse in <https://discourse.llvm.org/t/scf-dialect-vs-cfg/3524/2> and @antiagainst in <https://www.lei.chat/posts/mlir-codegen-dialects-for-machine-learning-compilers/>! (Unless it's wrong of course, then it's my bad.)
>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/2] [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/2] 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"];
More information about the Mlir-commits
mailing list