Skip to content

Commit

Permalink
Update docs to add input_type flag (#6122)
Browse files Browse the repository at this point in the history
Reflect changes introduced in #6030

Co-authored-by: CindyLiu <hcindyl@google.com>
Co-authored-by: Scott Todd <scotttodd@google.com>
  • Loading branch information
hcindyl and ScottTodd committed Jun 8, 2021
1 parent 4775aff commit af7dfeb
Show file tree
Hide file tree
Showing 20 changed files with 107 additions and 101 deletions.
4 changes: 2 additions & 2 deletions build_tools/kokoro/gcp_ubuntu/cmake/linux/riscv64/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ IREE_RUN_OUT=$(/usr/src/qemu-riscv/qemu-riscv64 -cpu rv64,x-v=true,x-k=true,vlen
-L "${RISCV_TOOLCHAIN_ROOT?}/sysroot" \
"${BUILD_RISCV_DIR?}/iree/tools/iree-run-module" --driver=dylib \
--module_file="${BUILD_RISCV_DIR?}/iree-run-module-llvm_aot.vmfb" \
--entry_function=abs --function_input="i32=-10")
--entry_function=abs --function_input="f32=-10")

# Check the result of running abs(-10).
if [[ "${IREE_RUN_OUT}" != *"i32=10" ]]; then
if [[ "${IREE_RUN_OUT}" != *"f32=10" ]]; then
exit 1
fi
1 change: 1 addition & 0 deletions docs/developers/design_docs/cuda_backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func @add(%lhs: tensor<4xf32>, %rhs: tensor<4xf32>) -> tensor<4xf32>
```shell
# First translate into a VM bytecode module using linalg on tensors path.
$ ../iree-build/iree/tools/iree-translate \
-iree-input-type=mhlo \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=cuda \
-iree-flow-dispatch-linalg-on-tensors \
Expand Down
7 changes: 4 additions & 3 deletions docs/developers/developing_iree/benchmarking.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To use `iree-benchmark-module`, generate an IREE module for the target backend:
$ bazel run //iree/tools:iree-translate -- \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
$PWD/iree/tools/test/iree-benchmark-module.mlir \
$PWD/iree/samples/models/simple_abs.mlir \
-o /tmp/module.fb
```

Expand All @@ -33,7 +33,7 @@ $ bazel run //iree/tools:iree-benchmark-module -- \
--module_file=/tmp/module.fb \
--driver=vmvx \
--entry_function=abs \
--function_input=i32=-2
--function_input=f32=-2
```

You'll see output like
Expand Down Expand Up @@ -80,7 +80,7 @@ $ ./bazel-bin/iree/tools/iree-benchmark-module \
--module_file=/tmp/module.fb \
--driver=vmvx \
--entry_function=abs \
--function_input=i32=-2
--function_input=f32=-2
```

```shell
Expand Down Expand Up @@ -108,6 +108,7 @@ dispatch functions, generate an IREE module with the

```shell
$ build/iree/tools/iree-translate \
-iree-input-type=mhlo \
-iree-mlir-to-vm-bytecode-module \
-iree-flow-export-benchmark-funcs \
-iree-hal-target-backends=vmvx \
Expand Down
23 changes: 12 additions & 11 deletions docs/developers/developing_iree/developer_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ $ ../iree-build/iree/tools/iree-opt \
```

For a more complex example, here's how to run IREE's complete transformation
pipeline targeting the VMLA backend on the
pipeline targeting the VMVX backend on the
[fullyconnected.mlir](https://github.com/google/iree/blob/main/iree/test/e2e/models/fullyconnected.mlir)
model file:

Expand Down Expand Up @@ -118,8 +118,8 @@ For example, to translate `simple.mlir` to an IREE module:
$ ../iree-build/iree/tools/iree-translate \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
$PWD/iree/tools/test/iree-run-module.mlir \
-o /tmp/simple.vmfb
$PWD/iree/samples/models/simple_abs.mlir \
-o /tmp/simple_abs_vmvx.vmfb
```

Custom translations may also be layered on top of `iree-translate`, see
Expand All @@ -133,15 +133,15 @@ and executes an exported main function using the provided inputs.

This program can be used in sequence with `iree-translate` to translate a
`.mlir` file to an IREE module and then execute it. Here is an example command
that executes the simple `simple.vmfb` compiled from `simple.mlir` above on
IREE's VMLA driver:
that executes the simple `simple_abs_vmvx.vmfb` compiled from `simple_abs.mlir`
above on IREE's VMVX driver:

```shell
$ ../iree-build/iree/tools/iree-run-module \
--module_file=/tmp/simple.vmfb \
--module_file=/tmp/simple_abs_vmvx.vmfb \
--driver=vmvx \
--entry_function=abs \
--function_input=i32=-2
--function_input=f32=-2
```

### iree-check-module
Expand All @@ -154,6 +154,7 @@ runner for the IREE

```shell
$ ../iree-build/iree/tools/iree-translate \
-iree-input-type=mhlo \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
$PWD/iree/test/e2e/xla_ops/abs.mlir \
Expand All @@ -176,12 +177,12 @@ does some additional work that usually must be explicit, like marking every
function as exported by default and running all of them.

For example, to execute the contents of
[iree/tools/test/iree-run-mlir.mlir](https://github.com/google/iree/blob/main/iree/tools/test/iree-run-mlir.mlir):
[iree/samples/models/simple_abs.mlir](https://github.com/google/iree/blob/main/iree/samples/models/simple_abs.mlir):

```shell
$ ../iree-build/iree/tools/iree-run-mlir \
$PWD/iree/tools/test/iree-run-mlir.mlir \
-function-input="i32=-2" \
$PWD/iree/samples/models/simple_abs.mlir \
-function-input="f32=-2" \
-iree-hal-target-backends=vmvx
```

Expand All @@ -193,7 +194,7 @@ file.
For example, to inspect the module translated above:

```shell
$ ../iree-build/iree/tools/iree-dump-module /tmp/simple.vmfb
$ ../iree-build/iree/tools/iree-dump-module /tmp/simple_abs_vmvx.vmfb
```

### Useful generic flags
Expand Down
3 changes: 2 additions & 1 deletion docs/developers/developing_iree/profiling_vulkan_gpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ func @dot(%lhs: tensor<2x4xf32>, %rhs: tensor<4x2xf32>) -> tensor<2x2xf32>
```shell
# First translate into a VM bytecode module
$ /path/to/iree/build/iree/tools/iree-translate -- \
-iree-input-type=mhlo \
-iree-mlir-to-vm-bytecode-module \
--iree-hal-target-backends=vulkan-spirv \
-iree-hal-target-backends=vulkan-spirv \
/path/to/mhlo-dot.mlir \
-o /tmp/mhlo-dot.vmfb

Expand Down
36 changes: 18 additions & 18 deletions docs/developers/get_started/getting_started_android_cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,16 @@ Translate a source MLIR into IREE module:
$ ../iree-build-host/install/bin/iree-translate \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
$PWD/iree/tools/test/iree-run-module.mlir \
-o /tmp/simple-vmvx.vmfb
$PWD/iree/samples/models/simple_abs.mlir \
-o /tmp/simple_abs_vmvx.vmfb
```

Then push the IREE runtime executable and module to the device:

```shell
$ adb push ../iree-build-android/iree/tools/iree-run-module /data/local/tmp/
$ adb shell chmod +x /data/local/tmp/iree-run-module
$ adb push /tmp/simple-vmvx.vmfb /data/local/tmp/
$ adb push /tmp/simple_abs_vmvx.vmfb /data/local/tmp/
```

Log into Android:
Expand All @@ -166,12 +166,12 @@ $ adb shell
android $ cd /data/local/tmp/
android $ ./iree-run-module \
--driver=vmvx \
--module_file=simple-vmvx.vmfb \
--module_file=simple_abs_vmvx.vmfb \
--entry_function=abs \
--function_input=i32=-5
--function_input=f32=-5

EXEC @abs
i32=5
f32=5
```

### Vulkan HAL backend
Expand All @@ -185,16 +185,16 @@ Translate a source MLIR into IREE module:
$ ../iree-build-host/install/bin/iree-translate \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vulkan-spirv \
$PWD/iree/tools/test/iree-run-module.mlir \
-o /tmp/simple-vulkan.vmfb
$PWD/iree/samples/models/simple_abs.mlir \
-o /tmp/simple_abs_vulkan.vmfb
```

Then push the IREE runtime executable and module to the device:

```shell
$ adb push ../iree-build-android/iree/tools/iree-run-module /data/local/tmp/
$ adb shell chmod +x /data/local/tmp/iree-run-module
$ adb push /tmp/simple-vulkan.vmfb /data/local/tmp/
$ adb push /tmp/simple_abs_vulkan.vmfb /data/local/tmp/
```

Log into Android:
Expand All @@ -205,12 +205,12 @@ $ adb shell
android $ cd /data/local/tmp/
android $ ./iree-run-module \
--driver=vulkan \
--module_file=simple-vulkan.vmfb \
--module_file=simple_abs_vulkan.vmfb \
--entry_function=abs \
--function_input=i32=-5
--function_input=f32=-5

EXEC @abs
i32=5
f32=5
```

#### Common issues
Expand Down Expand Up @@ -263,16 +263,16 @@ $ ../iree-build-host/install/bin/iree-translate \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-llvm-target-triple=aarch64-linux-android \
$PWD/iree/tools/test/iree-run-module.mlir \
-o /tmp/simple-llvm_aot.vmfb
$PWD/iree/samples/models/simple_abs.mlir \
-o /tmp/simple_abs_dylib.vmfb
```

Then push the IREE runtime executable and module to the device:

```shell
$ adb push ../iree-build-android/iree/tools/iree-run-module /data/local/tmp/
$ adb shell chmod +x /data/local/tmp/iree-run-module
$ adb push /tmp/simple-llvm_aot.vmfb /data/local/tmp/
$ adb push /tmp/simple_abs_dylib.vmfb /data/local/tmp/
```

Log into Android:
Expand All @@ -283,10 +283,10 @@ $ adb shell
android $ cd /data/local/tmp/
android $ ./iree-run-module \
--driver=dylib \
--module_file=simple-llvm_aot.vmfb \
--module_file=simple_abs_dylib.vmfb \
--entry_function=abs \
--function_input=i32=-5
--function_input=f32=-5

EXEC @abs
i32=5
f32=5
```
6 changes: 3 additions & 3 deletions docs/developers/get_started/getting_started_linux_bazel.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ $ ./bazel-bin/iree/tools/iree-translate --help
```

Translate a
[MLIR file](https://github.com/google/iree/blob/main/iree/tools/test/iree-run-mlir.mlir)
[MLIR file](https://github.com/google/iree/blob/main/iree/samples/models/simple_abs.mlir)
and execute a function in the compiled module:

```shell
$ ./bazel-bin/iree/tools/iree-run-mlir ./iree/tools/test/iree-run-mlir.mlir \
-function-input="i32=-2" -iree-hal-target-backends=vmvx -print-mlir
$ ./bazel-bin/iree/tools/iree-run-mlir ./iree/samples/models/simple_abs.mlir \
-function-input="f32=-2" -iree-hal-target-backends=vmvx -print-mlir
```

### Further Reading
Expand Down
16 changes: 8 additions & 8 deletions docs/developers/get_started/getting_started_linux_cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ $ ../iree-build/iree/tools/iree-translate --help
```

Translate a
[MLIR file](https://github.com/google/iree/blob/main/iree/tools/test/iree-run-module.mlir)
[MLIR file](https://github.com/google/iree/blob/main/iree/samples/models/simple_abs.mlir)
and execute a function in the compiled module:

```shell
$ ../iree-build/iree/tools/iree-run-mlir $PWD/iree/tools/test/iree-run-module.mlir \
-function-input="i32=-2" -iree-hal-target-backends=vmvx -print-mlir
$ ../iree-build/iree/tools/iree-run-mlir $PWD/iree/samples/models/simple_abs.mlir \
-function-input="f32=-2" -iree-hal-target-backends=vmvx -print-mlir
```

### LLVM Ahead-of-Time (AOT) backend
Expand All @@ -124,21 +124,21 @@ $ ../iree-build/iree/tools/iree-translate \
-iree-mlir-to-vm-bytecode-module \
-iree-llvm-target-triple=x86_64-linux-gnu \
-iree-hal-target-backends=dylib-llvm-aot \
iree/tools/test/iree-run-module.mlir \
-o /tmp/simple-llvm_aot.vmfb
iree/samples/models/simple_abs.mlir \
-o /tmp/simple_abs_dylib.vmfb
```

Then run the compiled module using the `dylib` HAL driver:

```shell
$ ../iree-build/iree/tools/iree-run-module \
--driver=dylib \
--module_file=/tmp/simple-llvm_aot.vmfb \
--module_file=/tmp/simple_abs_dylib.vmfb \
--entry_function=abs \
--function_input=i32=-5
--function_input=f32=-5

EXEC @abs
i32=5
f32=5
```


Expand Down
8 changes: 4 additions & 4 deletions docs/developers/get_started/getting_started_linux_vulkan.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ Pass the flag `-iree-hal-target-backends=vulkan-spirv` to `iree-translate`:
```shell
# -- CMake --
$ cmake --build ../iree-build/ --target iree_tools_iree-translate
$ ../iree-build/iree/tools/iree-translate -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=vulkan-spirv ./iree/tools/test/iree-run-module.mlir -o /tmp/module.vmfb
$ ../iree-build/iree/tools/iree-translate -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=vulkan-spirv ./iree/samples/models/simple_abs.mlir -o /tmp/module.vmfb

# -- Bazel --
$ bazel run iree/tools:iree-translate -- -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=vulkan-spirv $PWD/iree/tools/test/iree-run-module.mlir -o /tmp/module.vmfb
$ bazel run iree/tools:iree-translate -- -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=vulkan-spirv $PWD/iree/samples/models/simple_abs.mlir -o /tmp/module.vmfb
```

> Tip:<br>
Expand All @@ -138,14 +138,14 @@ $ ../iree-build/iree/tools/iree-run-module \
--driver=vulkan \
--module_file=/tmp/module.vmfb \
--entry_function=abs \
--function_input=i32=-2
--function_input=f32=-2

# -- Bazel --
$ bazel run iree/tools:iree-run-module -- \
--driver=vulkan \
--module_file=/tmp/module.vmfb \
--entry_function=abs \
--function_input=i32=-2
--function_input=f32=-2
```

## Running IREE's Vulkan Samples
Expand Down
6 changes: 3 additions & 3 deletions docs/developers/get_started/getting_started_macos_bazel.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ $ ./bazel-bin/iree/tools/iree-translate --help
```

Translate a
[MLIR file](https://github.com/google/iree/blob/main/iree/tools/test/iree-run-mlir.mlir)
[MLIR file](https://github.com/google/iree/blob/main/iree/samples/models/simple_abs.mlir)
and execute a function in the compiled module:

```shell
$ ./bazel-bin/iree/tools/iree-run-mlir ./iree/tools/test/iree-run-mlir.mlir \
-function-input="i32=-2" -iree-hal-target-backends=vmvx -print-mlir
$ ./bazel-bin/iree/tools/iree-run-mlir ./iree/samples/models/simple_abs.mlir \
-function-input="f32=-2" -iree-hal-target-backends=vmvx -print-mlir
```

### Further Reading
Expand Down
6 changes: 3 additions & 3 deletions docs/developers/get_started/getting_started_macos_cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ $ ../iree-build/iree/tools/iree-translate --help
```

Translate a
[MLIR file](https://github.com/google/iree/blob/main/iree/tools/test/iree-run-mlir.mlir)
[MLIR file](https://github.com/google/iree/blob/main/iree/samples/models/simple_abs.mlir)
and execute a function in the compiled module:

```shell
$ ../iree-build/iree/tools/iree-run-mlir $PWD/iree/tools/test/iree-run-mlir.mlir \
-function-input="i32=-2" -iree-hal-target-backends=vmvx -print-mlir
$ ../iree-build/iree/tools/iree-run-mlir $PWD/iree/samples/models/simple_abs.mlir \
-function-input="f32=-2" -iree-hal-target-backends=vmvx -print-mlir
```

### Further Reading
Expand Down
Loading

0 comments on commit af7dfeb

Please sign in to comment.