Merge pull request #2281 from ScottTodd:docs-iree-opt PiperOrigin-RevId: 318352808
diff --git a/docs/developer_overview.md b/docs/developer_overview.md index 5898490..7ab969b 100644 --- a/docs/developer_overview.md +++ b/docs/developer_overview.md
@@ -68,24 +68,35 @@ [mlir-opt](https://github.com/llvm/llvm-project/tree/master/mlir/tools/mlir-opt) and runs sets of IREE's compiler passes on `.mlir` input files. See "conversion" in [MLIR's Glossary](https://mlir.llvm.org/getting_started/Glossary/#conversion) -for more information. +for more information. Transformations performed by `iree-opt` can range from +individual passes performing isolated manipulations to broad pipelines that +encompass a sequence of steps. Test `.mlir` files that are checked in typically include a `RUN` block at the top of the file that specifies which passes should be performed and if `FileCheck` should be used to test the generated output. -For example, to run some passes on the -[reshape.mlir](https://github.com/google/iree/blob/master/iree/compiler/Translation/SPIRV/XLAToSPIRV/test/reshape.mlir) -test file: +Here's an example of a small compiler pass running on a +[test file](https://github.com/google/iree/blob/master/iree/compiler/Dialect/IREE/Transforms/test/drop_compiler_hints.mlir): ```shell $ bazel run iree/tools:iree-opt -- \ -split-input-file \ - -iree-index-computation \ - -simplify-spirv-affine-exprs=false \ - -convert-iree-to-spirv \ - -verify-diagnostics \ - $PWD/iree/compiler/Translation/SPIRV/XLAToSPIRV/test/reshape.mlir + -print-ir-before-all \ + -iree-drop-compiler-hints \ + $PWD/iree/compiler/Dialect/IREE/Transforms/test/drop_compiler_hints.mlir +``` + +For a more complex example, here's how to run IREE's complete transformation +pipeline targeting the VMLA backend on the +[fullyconnected.mlir](https://github.com/google/iree/blob/master/iree/test/e2e/models/fullyconnected.mlir) +model file: + +```shell +$ bazel run iree/tools:iree-opt -- \ + -iree-transformation-pipeline \ + -iree-hal-target-backends=vmla \ + $PWD/iree/test/e2e/models/fullyconnected.mlir ``` Custom passes may also be layered on top of `iree-opt`, see
diff --git a/iree/compiler/Dialect/IREE/Transforms/test/drop_compiler_hints.mlir b/iree/compiler/Dialect/IREE/Transforms/test/drop_compiler_hints.mlir index ef76d07..9486f96 100644 --- a/iree/compiler/Dialect/IREE/Transforms/test/drop_compiler_hints.mlir +++ b/iree/compiler/Dialect/IREE/Transforms/test/drop_compiler_hints.mlir
@@ -1,5 +1,8 @@ // RUN: iree-opt -split-input-file -iree-drop-compiler-hints %s | IreeFileCheck --implicit-check-not="iree.do_not_optimize" %s +// This file is used as an example in docs/developer_overview.md. +// If you move or delete it, please update the documentation accordingly. + // CHECK-LABEL: @constant func @constant() -> i32 { // CHECK-NEXT: %[[C1:.+]] = constant 1