Skip to content

Commit

Permalink
Update getting started docs
Browse files Browse the repository at this point in the history
Add info on the restored iree-run-module
Make examples use a consistent file that exports its functions and add a note about exporting

Tested:
Ran all the commands to make sure they actually work.
PiperOrigin-RevId: 294763513
  • Loading branch information
GMNGeoffrey authored and copybara-github committed Feb 12, 2020
1 parent fe359ae commit fbf26ee
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,55 @@ $ bazel run //iree/tools:iree-opt -- \
The `iree-translate` program translates from a .mlir input file into an IREE
module.

For example, to translate `gather.mlir` to an IREE module with Bazel on Linux,
For example, to translate `simple.mlir` to an IREE module with bazel on Linux,
use this command:

```shell
$ bazel run //iree/tools:iree-translate -- \
-iree-mlir-to-vm-bytecode-module \
$PWD/test/e2e/xla/gather.mlir \
--iree-hal-target-backends=interpreter-bytecode \
$PWD/iree/tools/test/simple.mlir \
-o /tmp/module.fb
```

Custom translations may also be layered on top of `iree-translate` - see
[iree/samples/custom_modules/dialect](../iree/samples/custom_modules/dialect)
for a sample.

### iree-run-module

The `iree-run-module` program takes an already translated IREE module as input
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 `module.fb` compiled from `simple.mlir` above on the IREE
interpreter

```shell
$ bazel run //iree/tools:iree-run-module -- \
--input_file=/tmp/module.fb \
--driver=interpreter \
--entry_function=abs \
--inputs="i32=-2"
```

### iree-run-mlir

The `iree-run-mlir` program takes a .mlir file as input, translates it to an
IREE bytecode module, and executes the module.

It is designed for testing and debugging, not production use cases, and
therefore 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 a test .mlir file, use this command:

```shell
$ bazel run //iree/tools:iree-run-mlir -- $PWD/test/e2e/xla/reverse.mlir
$ bazel run //iree/tools:iree-run-mlir -- \
$PWD/iree/tools/test/simple.mlir \
--input-value="i32=-2" \
--iree-hal-target-backends=interpreter-bytecode
```

### iree-dump-module
Expand Down

0 comments on commit fbf26ee

Please sign in to comment.