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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Nov 15 01:31:41 PST 2023


Author: Rik Huijzer
Date: 2023-11-15T10:31:37+01:00
New Revision: bc38da5d464c8efdbccf5b357bcaa024bf799d28

URL: https://github.com/llvm/llvm-project/commit/bc38da5d464c8efdbccf5b357bcaa024bf799d28
DIFF: https://github.com/llvm/llvm-project/commit/bc38da5d464c8efdbccf5b357bcaa024bf799d28.diff

LOG: [mlir][scf] Add high-level documentation (#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.)

EDIT: Also related:
<https://discourse.llvm.org/t/codegen-dialect-overview/2723>.

---------

Co-authored-by: Mehdi Amini <joker.eph at gmail.com>

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SCF/IR/SCFOps.td

Removed: 
    


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


        


More information about the Mlir-commits mailing list