From c62fc9dd9d9bb82caf049c8830840617bdcdc40f Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Wed, 26 Jun 2024 08:35:38 -0700 Subject: [PATCH] Add docs for Encoding, IREECodegen, and IREEGPU dialects. (#17743) These will be visible at https://iree.dev/reference/mlir-dialects/ Previews: * https://scotttodd.github.io/iree/reference/mlir-dialects/Encoding/ * https://scotttodd.github.io/iree/reference/mlir-dialects/IREECodegen/ * https://scotttodd.github.io/iree/reference/mlir-dialects/IREEGPU/ --- .../Codegen/Dialect/Codegen/IR/BUILD.bazel | 18 +++++++++++++++++- .../Codegen/Dialect/Codegen/IR/CMakeLists.txt | 9 +++++++++ .../Dialect/Codegen/IR/IREECodegenDialect.td | 2 +- .../Codegen/Dialect/GPU/IR/BUILD.bazel | 18 +++++++++++++++++- .../Codegen/Dialect/GPU/IR/CMakeLists.txt | 9 +++++++++ .../Codegen/Dialect/GPU/IR/IREEGPUDialect.td | 2 +- .../Codegen/Dialect/GPU/IR/IREEGPUOps.td | 2 +- .../docs/reference/mlir-dialects/index.md | 3 +++ docs/website/mkdocs.yml | 3 +++ docs/website/postprocess_dialect_docs.py | 3 +++ 10 files changed, 64 insertions(+), 5 deletions(-) diff --git a/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/BUILD.bazel b/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/BUILD.bazel index eb06d03365cd..21fe43850f08 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/BUILD.bazel +++ b/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/BUILD.bazel @@ -4,7 +4,7 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library", "iree_gentbl_cc_library", "iree_td_library") +load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library", "iree_gentbl_cc_library", "iree_tablegen_doc", "iree_td_library") load("//build_tools/bazel:enforce_glob.bzl", "enforce_glob") package( @@ -199,3 +199,19 @@ iree_gentbl_cc_library( "//compiler/src/iree/compiler/Codegen/Interfaces:td_files", ], ) + +iree_tablegen_doc( + name = "IREECodegenDialectDocGen", + tbl_outs = [ + ( + [ + "--gen-dialect-doc", + "--dialect=iree_codegen", + ], + "IREECodegenDialect.md", + ), + ], + tblgen = "@llvm-project//mlir:mlir-tblgen", + td_file = "IREECodegenOps.td", + deps = [":td_files"], +) diff --git a/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/CMakeLists.txt b/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/CMakeLists.txt index 2270484f77c3..11a3e0c82efc 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/CMakeLists.txt +++ b/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/CMakeLists.txt @@ -117,4 +117,13 @@ iree_tablegen_library( --gen-op-defs UKernelOps.cpp.inc ) +iree_tablegen_doc( + NAME + IREECodegenDialectDocGen + TD_FILE + "IREECodegenOps.td" + OUTS + --gen-dialect-doc --dialect=iree_codegen IREECodegenDialect.md +) + ### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ### diff --git a/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenDialect.td b/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenDialect.td index 1977f0a998e8..7f47fbe10be4 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenDialect.td +++ b/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenDialect.td @@ -18,7 +18,7 @@ def IREECodegen_Dialect : Dialect { let cppNamespace = "::mlir::iree_compiler::IREE::Codegen"; let summary = [{ - A dialect representing attributes used by the IREE Code generation. + A dialect for common functionality used by IREE code generation. }]; let description = [{ This dialect is primarily meant to hold attributes that carry the diff --git a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/BUILD.bazel b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/BUILD.bazel index 08921bfd9e8d..a87a1dd7ac38 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/BUILD.bazel +++ b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/BUILD.bazel @@ -4,7 +4,7 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library", "iree_gentbl_cc_library", "iree_td_library") +load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library", "iree_gentbl_cc_library", "iree_tablegen_doc", "iree_td_library") load("//build_tools/bazel:enforce_glob.bzl", "enforce_glob") package( @@ -187,3 +187,19 @@ iree_gentbl_cc_library( ":td_files", ], ) + +iree_tablegen_doc( + name = "IREEGPUDialectDocGen", + tbl_outs = [ + ( + [ + "--gen-dialect-doc", + "--dialect=iree_gpu", + ], + "IREEGPUDialect.md", + ), + ], + tblgen = "@llvm-project//mlir:mlir-tblgen", + td_file = "IREEGPUOps.td", + deps = [":td_files"], +) diff --git a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/CMakeLists.txt b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/CMakeLists.txt index 19a4dd20de29..d43954cefab2 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/CMakeLists.txt +++ b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/CMakeLists.txt @@ -112,4 +112,13 @@ iree_tablegen_library( --gen-op-defs IREEGPUOps.cpp.inc ) +iree_tablegen_doc( + NAME + IREEGPUDialectDocGen + TD_FILE + "IREEGPUOps.td" + OUTS + --gen-dialect-doc --dialect=iree_gpu IREEGPUDialect.md +) + ### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ### diff --git a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUDialect.td b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUDialect.td index 28a2423f79da..d6655172cddf 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUDialect.td +++ b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUDialect.td @@ -20,7 +20,7 @@ def IREEGPU_Dialect : Dialect { let cppNamespace = "::mlir::iree_compiler::IREE::GPU"; let summary = [{ - A dialect representing attributes used by GPU focused IREE code generation. + A dialect for common functionality used by GPU focused IREE code generation. }]; let description = [{ This dialect provides operations and attributes to aid in code generation diff --git a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUOps.td b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUOps.td index 90689e7fb4d2..0549c090e715 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUOps.td +++ b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUOps.td @@ -134,7 +134,7 @@ def IREEGPU_MultiMmaOp : Op, tensor into tensor ``` - ## Motivation, Design Choices, and Pitfalls + #### Motivation, Design Choices, and Pitfalls The idea behind this operation is to decouple the layout setting/tiling required to target certain intrinsics from the lowering to them. Because diff --git a/docs/website/docs/reference/mlir-dialects/index.md b/docs/website/docs/reference/mlir-dialects/index.md index 611abef1c5ee..1862d59d8e10 100644 --- a/docs/website/docs/reference/mlir-dialects/index.md +++ b/docs/website/docs/reference/mlir-dialects/index.md @@ -19,11 +19,14 @@ these dialects can be found in the Dialect | Description --------------------------- | ----------- [Check](./Check.md) | Defines assertions for IREE tests +[Encoding](./Encoding.md) | Tensor encoding attributes and related ops [Flow](./Flow.md) | Models execution data flow and partitioning [HAL](./HAL.md) | Represents operations against the IREE HAL[^1] [HAL/Inline](./HALInline.md) | Inline HAL interop runtime module dialect [HAL/Loader](./HALLoader.md) | HAL inline executable loader runtime module dialect [IO/Parameters](./IOParameters.md) | External parameter resource management APIs +[IREECodegen](./IREECodegen.md) | Common functionality used by IREE code generation +[IREEGPU](./IREEGPU.md) | Common functionality used by GPU focused IREE code generation [LinalgExt](./LinalgExt.md) | Extensions to the Linalg dialect for specific operations [Stream](./Stream.md) | Model execution partitioning and scheduling [Util](./Util.md) | Types and ops common across IREE subdialects diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml index 15b75b7ddfdf..ac70451ee2ef 100644 --- a/docs/website/mkdocs.yml +++ b/docs/website/mkdocs.yml @@ -160,11 +160,14 @@ nav: # Note: these files are generated by generate_extra_files.sh. - "Internal dialects": - Check: "reference/mlir-dialects/Check.md" + - Encoding: "reference/mlir-dialects/Encoding.md" - Flow: "reference/mlir-dialects/Flow.md" - HAL: "reference/mlir-dialects/HAL.md" - HAL/Inline: "reference/mlir-dialects/HALInline.md" - HAL/Loader: "reference/mlir-dialects/HALLoader.md" - IO/Parameters: "reference/mlir-dialects/IOParameters.md" + - IREECodegen: "reference/mlir-dialects/IREECodegen.md" + - IREEGPU: "reference/mlir-dialects/IREEGPU.md" - LinalgExt: "reference/mlir-dialects/LinalgExt.md" - Stream: "reference/mlir-dialects/Stream.md" - Util: "reference/mlir-dialects/Util.md" diff --git a/docs/website/postprocess_dialect_docs.py b/docs/website/postprocess_dialect_docs.py index dd1de32ae66d..0caef2a2646e 100644 --- a/docs/website/postprocess_dialect_docs.py +++ b/docs/website/postprocess_dialect_docs.py @@ -70,10 +70,13 @@ def main(args): dialect_sources_map = { "Check.md": "compiler/src/iree/compiler/Modules/Check/IR", "Flow.md": "compiler/src/iree/compiler/Dialect/Flow/IR", + "Encoding.md": "compiler/src/iree/compiler/Dialect/Encoding/IR", "HAL.md": "compiler/src/iree/compiler/Dialect/HAL/IR", "HALInline.md": "compiler/src/iree/compiler/Modules/HAL/Inline/IR", "HALLoader.md": "compiler/src/iree/compiler/Modules/HAL/Loader/IR", "IOParameters.md": "compiler/src/iree/compiler/Modules/IO/Parameters/IR", + "IREECodegen.md": "compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR", + "IREEGPU.md": "compiler/src/iree/compiler/Codegen/Dialect/GPU/IR", "IREEInput.md": "llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/Input", "IREEVectorExt.md": "llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/VectorExt/IR", "LinalgExt.md": "compiler/src/iree/compiler/Dialect/LinalgExt/IR",