Skip to content

Commit bc38da5

Browse files
[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 <[email protected]>
1 parent dedf2c6 commit bc38da5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ include "mlir/Interfaces/ViewLikeInterface.td"
2626
def SCF_Dialect : Dialect {
2727
let name = "scf";
2828
let cppNamespace = "::mlir::scf";
29+
30+
let description = [{
31+
The `scf` (structured control flow) dialect contains operations that
32+
represent control flow constructs such as `if` and `for`. Being
33+
_structured_ means that the control flow has a structure unlike, for
34+
example, `goto`s or `assert`s. Unstructured control flow operations are
35+
located in the `cf` (control flow) dialect.
36+
37+
Originally, this dialect was developed as a common lowering stage for the
38+
`affine` and `linalg` dialects. Both convert to SCF loops instead of
39+
targeting branch-based CFGs directly. Typically, `scf` is lowered to `cf`
40+
and then lowered to some final target like LLVM or SPIR-V.
41+
}];
42+
2943
let dependentDialects = ["arith::ArithDialect"];
3044
}
3145

0 commit comments

Comments
 (0)