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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Nov 14 13:32:56 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-scf

Author: Rik Huijzer (rikhuijzer)

<details>
<summary>Changes</summary>

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.)

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


1 Files Affected:

- (modified) mlir/include/mlir/Dialect/SCF/IR/SCFOps.td (+14) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
index 2c5abe7a63ac44d..36aa5c6352c828f 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 final target like LLVM or SPIR-V.
+  }];
+
   let dependentDialects = ["arith::ArithDialect"];
 }
 

``````````

</details>


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


More information about the Mlir-commits mailing list