Replace all compilation uses of iree-translate with iree-compile. (#8576)
* Replace all compilation uses of iree-translate with ireec.
* ireec is used for e2e compilation. iree-translate is used to test specific translations (i.e. hal executable, vm IR, etc).
* ireec allows deprecated arguments previously used in iree-translate so it should be a drop-in replacement for users.
* It supports a new --output-format= argument that defaults to vm-bytecode
* It fails if no files are specified (read from stdin with '-').
* iree-translate still works like it always did with this change. A subsequent change will scale it back to just the translations needed for testing (not e2e compilation), which should make it a good deal smaller and cheaper to build.
* This is mostly a find/replace with specific fixups for VM and HAL tests that were testing translations.
* Convert VM translation tests back to iree-translate.
* Rename ireec -> iree-compile
* Properly registers LLVMIR translations (which are different from static registered "translations").
* Breaks out an explicit init_llvmir_translations.h to centralize this.
* Also fixes the CAPI.
* Adds a corresponding CAPI test for the compiler API (contributed by edubart). Including in this larger patch because it highlighted the fix needed in Compiler.cpp.
Co-authored-by: Eduardo Bart <edub4rt@gmail.com>
diff --git a/.github/workflows/validate_and_publish_release.yml b/.github/workflows/validate_and_publish_release.yml
index 60574b3..866f3ac 100644
--- a/.github/workflows/validate_and_publish_release.yml
+++ b/.github/workflows/validate_and_publish_release.yml
@@ -66,9 +66,9 @@
- name: Run iree-tblgen
id: run_iree_tblgen
run: ./bin/iree-tblgen --help
- - name: Run iree-translate
- id: run_iree_translate
- run: ./bin/iree-translate --help
+ - name: Run iree-compile
+ id: run_iree-compile
+ run: ./bin/iree-compile --help
publish_release:
name: "Publish release"
diff --git a/benchmarks/README.md b/benchmarks/README.md
index 0f10668..53151d1 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -78,6 +78,6 @@
$ iree-import-tflite <tflite-file> -o <mlir-output-file>
```
-5. Then compile the input MLIR file with `iree-translate`. The exact flags used
+5. Then compile the input MLIR file with `iree-compile`. The exact flags used
to compile and run the benchmarks can be found in
[this CMakeLists.txt file](./TFLite/CMakeLists.txt).
diff --git a/build_tools/bazel/iree_bytecode_module.bzl b/build_tools/bazel/iree_bytecode_module.bzl
index 4bd0ef8..0fb1e31 100644
--- a/build_tools/bazel/iree_bytecode_module.bzl
+++ b/build_tools/bazel/iree_bytecode_module.bzl
@@ -15,7 +15,8 @@
src,
module = None,
flags = ["-iree-mlir-to-vm-bytecode-module"],
- translate_tool = "//iree/tools:iree-translate",
+ # TODO: Rename this to 'compile_tool'
+ translate_tool = "//iree/tools:iree-compile",
linker_tool = "@llvm-project//lld:lld",
opt_tool = "//iree/tools:iree-opt",
opt_flags = [],
@@ -29,7 +30,7 @@
flags: additional flags to pass to the compiler. Bytecode
translation and backend flags are passed automatically.
translate_tool: the compiler to use to generate the module.
- Defaults to iree-translate.
+ Defaults to iree-compile.
linker_tool: the linker to use.
Defaults to the lld from the llvm-project directory.
opt_tool: Defaulting to iree-opt. Tool used to preprocess the source file
diff --git a/build_tools/cmake/iree_benchmark_suite.cmake b/build_tools/cmake/iree_benchmark_suite.cmake
index 4e9e4e8..62b4653 100644
--- a/build_tools/cmake/iree_benchmark_suite.cmake
+++ b/build_tools/cmake/iree_benchmark_suite.cmake
@@ -203,14 +203,14 @@
add_custom_command(
OUTPUT "${_VMFB_FILE}"
COMMAND
- "$<TARGET_FILE:iree::tools::iree-translate>"
+ "$<TARGET_FILE:iree::tools::iree-compile>"
${_TRANSLATION_ARGS}
"--mlir-print-op-on-diagnostic=false"
"${_MODULE_SOURCE}"
-o "${_VMFB_FILE}"
WORKING_DIRECTORY "${_VMFB_ARTIFACTS_DIR}"
DEPENDS
- iree::tools::iree-translate
+ iree::tools::iree-compile
"${_MODULE_SOURCE_TARGET}"
COMMENT "Generating VMFB for ${_COMMON_NAME_SEGMENTS}"
)
diff --git a/build_tools/cmake/iree_bytecode_module.cmake b/build_tools/cmake/iree_bytecode_module.cmake
index 4ea25d3..08fda98 100644
--- a/build_tools/cmake/iree_bytecode_module.cmake
+++ b/build_tools/cmake/iree_bytecode_module.cmake
@@ -15,7 +15,7 @@
# SRC: Source file to compile into a bytecode module.
# FLAGS: Flags to pass to the translation tool (list of strings).
# TRANSLATE_TOOL: Translation tool to invoke (CMake target). The default
-# tool is "iree-translate".
+# tool is "iree-compile".
# C_IDENTIFIER: Identifier to use for generate c embed code.
# If omitted then no C embed code will be generated.
# PUBLIC: Add this so that this library will be exported under ${PACKAGE}::
@@ -45,7 +45,7 @@
if(DEFINED _RULE_TRANSLATE_TOOL)
set(_TRANSLATE_TOOL ${_RULE_TRANSLATE_TOOL})
else()
- set(_TRANSLATE_TOOL "iree-translate")
+ set(_TRANSLATE_TOOL "iree-compile")
endif()
if(DEFINED _RULE_MODULE_FILE_NAME)
diff --git a/build_tools/cmake/iree_c_module.cmake b/build_tools/cmake/iree_c_module.cmake
index af83a8b..05eb2db 100644
--- a/build_tools/cmake/iree_c_module.cmake
+++ b/build_tools/cmake/iree_c_module.cmake
@@ -13,7 +13,7 @@
# SRC: MLIR source file to compile into a c module.
# H_FILE_OUTPUT: The H header file to output.
# TRANSLATE_TOOL: Translation tool to invoke (CMake target). The default
-# tool is "iree-translate".
+# tool is "iree-compile".
# FLAGS: Flags to pass to the translation tool (list of strings).
# TESTONLY: When added, this target will only be built if user passes
# -DIREE_BUILD_TESTS=ON to CMake.
@@ -47,7 +47,7 @@
if(DEFINED _RULE_TRANSLATE_TOOL)
set(_TRANSLATE_TOOL ${_RULE_TRANSLATE_TOOL})
else()
- set(_TRANSLATE_TOOL "iree-translate")
+ set(_TRANSLATE_TOOL "iree-compile")
endif()
iree_get_executable_path(_TRANSLATE_TOOL_EXECUTABLE ${_TRANSLATE_TOOL})
@@ -80,7 +80,7 @@
DEPENDS
${_RULE_H_FILE_OUTPUT}
)
-
+
add_library(${_NAME} INTERFACE)
add_dependencies(${_NAME} ${_GEN_TARGET})
add_dependencies(${_NAME}
diff --git a/build_tools/cmake/iree_hal_cts_test_suite.cmake b/build_tools/cmake/iree_hal_cts_test_suite.cmake
index cc067dd..5d0fe45 100644
--- a/build_tools/cmake/iree_hal_cts_test_suite.cmake
+++ b/build_tools/cmake/iree_hal_cts_test_suite.cmake
@@ -116,6 +116,8 @@
"${IREE_ROOT_DIR}/iree/hal/cts/testdata/${_FILE_NAME}.mlir"
FLAGS
${_TRANSLATE_FLAGS}
+ TRANSLATE_TOOL
+ "iree-translate"
PUBLIC
TESTONLY
)
diff --git a/build_tools/kokoro/gcp_ubuntu/cmake/linux/riscv64/test.sh b/build_tools/kokoro/gcp_ubuntu/cmake/linux/riscv64/test.sh
index 18ed61c..eade8aa 100755
--- a/build_tools/kokoro/gcp_ubuntu/cmake/linux/riscv64/test.sh
+++ b/build_tools/kokoro/gcp_ubuntu/cmake/linux/riscv64/test.sh
@@ -14,7 +14,7 @@
# Print the UTC time when set -x is on
export PS4='[$(date -u "+%T %Z")] '
-# Environment variable used by the emulator and iree-translate for the
+# Environment variable used by the emulator and iree-compile for the
# dylib-llvm-aot bytecode codegen.
export RISCV_TOOLCHAIN_ROOT=${RISCV_RV64_LINUX_TOOLCHAIN_ROOT?}
@@ -53,7 +53,7 @@
"${BUILD_RISCV_DIR?}/tosa.mlir"
)
fi
- "${BUILD_HOST_DIR?}/install/bin/iree-translate" "${translate_arg[@]}" "$@"
+ "${BUILD_HOST_DIR?}/install/bin/iree-compile" "${translate_arg[@]}" "$@"
}
generate_dylib_vmfb mhlo \
diff --git a/colab/mnist_training.ipynb b/colab/mnist_training.ipynb
index 7492a31..8422a0e 100644
--- a/colab/mnist_training.ipynb
+++ b/colab/mnist_training.ipynb
@@ -373,7 +373,7 @@
"2021-09-01 17:16:21.335942: I external/org_tensorflow/tensorflow/cc/saved_model/reader.cc:148] Reading SavedModel debug info (if present) from: /tmp/tmp0ke1h1w3.sm\n",
"2021-09-01 17:16:21.402265: I external/org_tensorflow/tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA\n",
"To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
- "iree-translate main is at 0x4762e0\n"
+ "iree-compile main is at 0x4762e0\n"
]
}
]
diff --git a/docs/api_docs/python/compiler/tools.rst b/docs/api_docs/python/compiler/tools.rst
index 7cc8911..a19c06b 100644
--- a/docs/api_docs/python/compiler/tools.rst
+++ b/docs/api_docs/python/compiler/tools.rst
@@ -6,7 +6,7 @@
builds. User level tools are distributed via the Python packages and are also
accessible via dedicated Python APIs, documented here.
-Core Compiler (`ireec`)
+Core Compiler (`iree-compile`)
-----------------------
.. automodule:: iree.compiler.tools
diff --git a/docs/developers/debugging/tf_integrations_test_repro.md b/docs/developers/debugging/tf_integrations_test_repro.md
index 8e914cb..e431f04 100644
--- a/docs/developers/debugging/tf_integrations_test_repro.md
+++ b/docs/developers/debugging/tf_integrations_test_repro.md
@@ -34,9 +34,9 @@
python -m iree_tfl_tests.posenet_i8_test -- target_backend=llvmaot -artifacts_dir=/tmp/posenet_i8_failure
```
-5. This will create an `iree_input.mlir` in the temp directory specified. Those can then be fed into `iree-translate` (built locally to reproduce the error)
+5. This will create an `iree_input.mlir` in the temp directory specified. Those can then be fed into `iree-compile` (built locally to reproduce the error)
```
-iree-translate -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=dylib-llvm-aot -iree-input-type=mhlo iree_input.mlir
+iree-compile -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=dylib-llvm-aot -iree-input-type=mhlo iree_input.mlir
```
diff --git a/docs/developers/design_docs/cuda_backend.md b/docs/developers/design_docs/cuda_backend.md
index be8bc04..05c87c2 100644
--- a/docs/developers/design_docs/cuda_backend.md
+++ b/docs/developers/design_docs/cuda_backend.md
@@ -75,7 +75,7 @@
```shell
# First translate into a VM bytecode module.
-$ ../iree-build/iree/tools/iree-translate \
+$ ../iree-build/iree/tools/iree-compile \
-iree-input-type=mhlo \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=cuda \
diff --git a/docs/developers/developing_iree/benchmarking.md b/docs/developers/developing_iree/benchmarking.md
index d1eb44c..49c8652 100644
--- a/docs/developers/developing_iree/benchmarking.md
+++ b/docs/developers/developing_iree/benchmarking.md
@@ -19,7 +19,7 @@
To use `iree-benchmark-module`, generate an IREE module for the target backend:
```shell
-$ bazel run //iree/tools:iree-translate -- \
+$ bazel run //iree/tools:iree-compile -- \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
$PWD/iree/samples/models/simple_abs.mlir \
@@ -107,7 +107,7 @@
`-iree-flow-export-benchmark-funcs` flag set:
```shell
-$ build/iree/tools/iree-translate \
+$ build/iree/tools/iree-compile \
-iree-input-type=mhlo \
-iree-mlir-to-vm-bytecode-module \
-iree-flow-export-benchmark-funcs \
diff --git a/docs/developers/developing_iree/developer_overview.md b/docs/developers/developing_iree/developer_overview.md
index b038be4..4a4d27a 100644
--- a/docs/developers/developing_iree/developer_overview.md
+++ b/docs/developers/developing_iree/developer_overview.md
@@ -103,25 +103,33 @@
[iree/samples/custom_modules/dialect](https://github.com/google/iree/blob/main/iree/samples/custom_modules/dialect)
for a sample.
-### iree-translate
+### iree-compile
-`iree-translate` converts MLIR input into external formats like IREE modules. It
-is similar to
-[mlir-translate](https://github.com/llvm/llvm-project/tree/master/mlir/tools/mlir-translate),
-see "translation" in
-[MLIR's Glossary](https://mlir.llvm.org/getting_started/Glossary/#translation)
-for more information.
+`iree-compile` is IREE's main compiler driver for generating binaries from
+supported input MLIR assembly.
For example, to translate `simple.mlir` to an IREE module:
```shell
-$ ../iree-build/iree/tools/iree-translate \
- -iree-mlir-to-vm-bytecode-module \
+$ ../iree-build/iree/tools/iree-compile \
-iree-hal-target-backends=vmvx \
$PWD/iree/samples/models/simple_abs.mlir \
-o /tmp/simple_abs_vmvx.vmfb
```
+# iree-translate
+
+This is the IREE equivalent of MLIR's translation tool, which is used for
+testing translations between supported formats. It is used by various unit
+tests which are testing these features in isolation (outside of the main
+compiler driver).
+
+See
+[mlir-translate](https://github.com/llvm/llvm-project/tree/master/mlir/tools/mlir-translate),
+see "translation" in
+[MLIR's Glossary](https://mlir.llvm.org/getting_started/Glossary/#translation)
+for more information.
+
Custom translations may also be layered on top of `iree-translate`, see
[iree/samples/custom_modules/dialect](https://github.com/google/iree/blob/main/iree/samples/custom_modules/dialect)
for a sample.
@@ -131,7 +139,7 @@
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
+This program can be used in sequence with `iree-compile` to translate a
`.mlir` file to an IREE module and then execute it. Here is an example command
that executes the simple `simple_abs_vmvx.vmfb` compiled from `simple_abs.mlir`
above on IREE's VMVX driver:
@@ -153,7 +161,7 @@
[check framework](https://github.com/google/iree/tree/main/docs/developing_iree/testing_guide.md#end-to-end-tests).
```shell
-$ ../iree-build/iree/tools/iree-translate \
+$ ../iree-build/iree/tools/iree-compile \
-iree-input-type=mhlo \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
diff --git a/docs/developers/developing_iree/llvm_version_bump.md b/docs/developers/developing_iree/llvm_version_bump.md
index 56e24ab..ee4f8ca 100644
--- a/docs/developers/developing_iree/llvm_version_bump.md
+++ b/docs/developers/developing_iree/llvm_version_bump.md
@@ -65,7 +65,7 @@
Bazel can help, especially for catching nit-picky strict things:
```
-bazel build iree/tools:iree-translate
+bazel build iree/tools:iree-compile
bazel test iree/compiler/...
```
diff --git a/docs/developers/developing_iree/profiling_vulkan_gpu.md b/docs/developers/developing_iree/profiling_vulkan_gpu.md
index 59d4faa..b429f08 100644
--- a/docs/developers/developing_iree/profiling_vulkan_gpu.md
+++ b/docs/developers/developing_iree/profiling_vulkan_gpu.md
@@ -35,7 +35,7 @@
```shell
# First translate into a VM bytecode module
-$ /path/to/iree/build/iree/tools/iree-translate -- \
+$ /path/to/iree/build/iree/tools/iree-compile -- \
-iree-input-type=mhlo \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vulkan-spirv \
diff --git a/docs/developers/get_started/getting_started_android_cmake.md b/docs/developers/get_started/getting_started_android_cmake.md
index df64baa..31160ca 100644
--- a/docs/developers/get_started/getting_started_android_cmake.md
+++ b/docs/developers/get_started/getting_started_android_cmake.md
@@ -140,8 +140,7 @@
```shell
# Assuming in IREE source root
-$ ../iree-build-host/install/bin/iree-translate \
- -iree-mlir-to-vm-bytecode-module \
+$ ../iree-build-host/install/bin/iree-compile \
-iree-hal-target-backends=vmvx \
$PWD/iree/samples/models/simple_abs.mlir \
-o /tmp/simple_abs_vmvx.vmfb
@@ -179,8 +178,7 @@
Translate a source MLIR into IREE module:
```shell
-$ ../iree-build-host/install/bin/iree-translate \
- -iree-mlir-to-vm-bytecode-module \
+$ ../iree-build-host/install/bin/iree-compile \
-iree-hal-target-backends=vulkan-spirv \
$PWD/iree/samples/models/simple_abs.mlir \
-o /tmp/simple_abs_vulkan.vmfb
@@ -256,8 +254,7 @@
Translate a source MLIR into an IREE module:
```shell
-$ ../iree-build-host/install/bin/iree-translate \
- -iree-mlir-to-vm-bytecode-module \
+$ ../iree-build-host/install/bin/iree-compile \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-llvm-target-triple=aarch64-linux-android \
$PWD/iree/samples/models/simple_abs.mlir \
diff --git a/docs/developers/get_started/getting_started_linux_bazel.md b/docs/developers/get_started/getting_started_linux_bazel.md
index c010058..f8f8948 100644
--- a/docs/developers/get_started/getting_started_linux_bazel.md
+++ b/docs/developers/get_started/getting_started_linux_bazel.md
@@ -109,7 +109,7 @@
```shell
$ ls bazel-bin/iree/tools/
-$ ./bazel-bin/iree/tools/iree-translate --help
+$ ./bazel-bin/iree/tools/iree-compile --help
```
Translate a
diff --git a/docs/developers/get_started/getting_started_linux_cmake.md b/docs/developers/get_started/getting_started_linux_cmake.md
index 0c78030..ce1be20 100644
--- a/docs/developers/get_started/getting_started_linux_cmake.md
+++ b/docs/developers/get_started/getting_started_linux_cmake.md
@@ -95,7 +95,7 @@
```shell
$ ls ../iree-build/iree/tools
-$ ../iree-build/iree/tools/iree-translate --help
+$ ../iree-build/iree/tools/iree-compile --help
```
Translate a
@@ -113,7 +113,7 @@
```shell
# Assuming in IREE source root
-$ ../iree-build/iree/tools/iree-translate \
+$ ../iree-build/iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-llvm-target-triple=x86_64-linux-gnu \
-iree-hal-target-backends=dylib-llvm-aot \
diff --git a/docs/developers/get_started/getting_started_linux_vulkan.md b/docs/developers/get_started/getting_started_linux_vulkan.md
index 5fba4e7..05e5493 100644
--- a/docs/developers/get_started/getting_started_linux_vulkan.md
+++ b/docs/developers/get_started/getting_started_linux_vulkan.md
@@ -110,15 +110,15 @@
### Compiling for the Vulkan HAL
-Pass the flag `-iree-hal-target-backends=vulkan-spirv` to `iree-translate`:
+Pass the flag `-iree-hal-target-backends=vulkan-spirv` to `iree-compile`:
```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/samples/models/simple_abs.mlir -o /tmp/module.vmfb
+$ cmake --build ../iree-build/ --target iree_tools_iree-compile
+$ ../iree-build/iree/tools/iree-compile -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/samples/models/simple_abs.mlir -o /tmp/module.vmfb
+$ bazel run iree/tools:iree-compile -- -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>
diff --git a/docs/developers/get_started/getting_started_macos_bazel.md b/docs/developers/get_started/getting_started_macos_bazel.md
index 4b3eece..384f31a 100644
--- a/docs/developers/get_started/getting_started_macos_bazel.md
+++ b/docs/developers/get_started/getting_started_macos_bazel.md
@@ -112,7 +112,7 @@
```shell
$ ls bazel-bin/iree/tools/
-$ ./bazel-bin/iree/tools/iree-translate --help
+$ ./bazel-bin/iree/tools/iree-compile --help
```
Translate a
diff --git a/docs/developers/get_started/getting_started_macos_cmake.md b/docs/developers/get_started/getting_started_macos_cmake.md
index ef7aef3..ef5898d 100644
--- a/docs/developers/get_started/getting_started_macos_cmake.md
+++ b/docs/developers/get_started/getting_started_macos_cmake.md
@@ -95,7 +95,7 @@
```shell
$ ls ../iree-build/iree/tools
-$ ../iree-build/iree/tools/iree-translate --help
+$ ../iree-build/iree/tools/iree-compile --help
```
Translate a
diff --git a/docs/developers/get_started/getting_started_riscv_cmake.md b/docs/developers/get_started/getting_started_riscv_cmake.md
index 2efedf7..17791ad 100644
--- a/docs/developers/get_started/getting_started_riscv_cmake.md
+++ b/docs/developers/get_started/getting_started_riscv_cmake.md
@@ -110,7 +110,7 @@
Translate a source MLIR into IREE module:
```shell
-$ ../iree-build-host/install/bin/iree-translate \
+$ ../iree-build-host/install/bin/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
${PWD}/iree/samples/models/simple_abs.mlir \
@@ -153,7 +153,7 @@
Translate a source MLIR into an IREE module:
```shell
-$ ../iree-build-host/install/bin/iree-translate \
+$ ../iree-build-host/install/bin/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-llvm-target-triple=riscv64 \
@@ -189,7 +189,7 @@
VLS(Vector Length Specific) style codes.
```shell
-$ ../iree-build-host/install/bin/iree-translate \
+$ ../iree-build-host/install/bin/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-input-type=mhlo \
diff --git a/docs/developers/get_started/getting_started_windows_bazel.md b/docs/developers/get_started/getting_started_windows_bazel.md
index 3c2e69e..e08bb2a 100644
--- a/docs/developers/get_started/getting_started_windows_bazel.md
+++ b/docs/developers/get_started/getting_started_windows_bazel.md
@@ -114,7 +114,7 @@
```powershell
> dir bazel-bin\iree\tools\
-> .\bazel-bin\iree\tools\iree-translate.exe --help
+> .\bazel-bin\iree\tools\iree-compile.exe --help
```
Translate a
diff --git a/docs/developers/get_started/getting_started_windows_cmake.md b/docs/developers/get_started/getting_started_windows_cmake.md
index bd02798..4967fd4 100644
--- a/docs/developers/get_started/getting_started_windows_cmake.md
+++ b/docs/developers/get_started/getting_started_windows_cmake.md
@@ -94,7 +94,7 @@
### LLVM AOT Backend
`-iree-hal-target-backends=dylib-llvm-aot` can be used to generate modules with
-ahead-of-time compiled kernels stored in DLLs. Run the iree-opt/iree-translate
+ahead-of-time compiled kernels stored in DLLs. Run the iree-opt/iree-compile
tools from a command prompt with `lld-link.exe` or `link.exe` tools on the
`PATH` and the MSVC/Windows SDK environment variables; the easiest way to get
this configured is to use the `vsvarsall.bat` or `vcvars64.bat` files to set
@@ -105,7 +105,7 @@
Translate a source MLIR file into an IREE module:
```powershell
-> ..\iree-build\iree\tools\iree-translate.exe \
+> ..\iree-build\iree\tools\iree-compile.exe \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
iree/samples/models/simple_abs.mlir \
@@ -117,7 +117,7 @@
cross-compiling:
```powershell
-> ..\iree-build\iree\tools\iree-translate.exe \
+> ..\iree-build\iree\tools\iree-compile.exe \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-llvm-target-triple=x86_64-pc-windows-msvc \
@@ -135,7 +135,7 @@
```powershell
> dir ..\iree-build\iree\tools
-> ..\iree-build\iree\tools\iree-translate.exe --help
+> ..\iree-build\iree\tools\iree-compile.exe --help
```
Translate a
diff --git a/docs/developers/get_started/getting_started_windows_vulkan.md b/docs/developers/get_started/getting_started_windows_vulkan.md
index 938db53..0c544bf 100644
--- a/docs/developers/get_started/getting_started_windows_vulkan.md
+++ b/docs/developers/get_started/getting_started_windows_vulkan.md
@@ -107,15 +107,15 @@
### Compiling for the Vulkan HAL
-Pass the flag `-iree-hal-target-backends=vulkan-spirv` to `iree-translate.exe`:
+Pass the flag `-iree-hal-target-backends=vulkan-spirv` to `iree-compile.exe`:
```powershell
# -- CMake --
-> cmake --build ..\iree-build\ --target iree_tools_iree-translate
-> ..\iree-build\iree\tools\iree-translate.exe -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=vulkan-spirv .\iree\tools\test\iree-run-module.mlir -o .\build\module.vmfb
+> cmake --build ..\iree-build\ --target iree_tools_iree-compile
+> ..\iree-build\iree\tools\iree-compile.exe -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=vulkan-spirv .\iree\tools\test\iree-run-module.mlir -o .\build\module.vmfb
# -- Bazel --
-> bazel run iree/tools:iree-translate -- -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=vulkan-spirv .\iree\tools\test\iree-run-module.mlir -o .\build\module.vmfb
+> bazel run iree/tools:iree-compile -- -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=vulkan-spirv .\iree\tools\test\iree-run-module.mlir -o .\build\module.vmfb
```
> Tip:<br>
diff --git a/docs/website/docs/building-from-source/android.md b/docs/website/docs/building-from-source/android.md
index 2a113d8..7b051d7 100644
--- a/docs/website/docs/building-from-source/android.md
+++ b/docs/website/docs/building-from-source/android.md
@@ -110,7 +110,7 @@
Invoke the host compiler tools to produce a bytecode module flatbuffer:
``` shell
-../iree-build/install/bin/iree-translate \
+../iree-build/install/bin/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
iree/samples/models/simple_abs.mlir \
diff --git a/docs/website/docs/building-from-source/getting-started.md b/docs/website/docs/building-from-source/getting-started.md
index a6824fa..1d8170f 100644
--- a/docs/website/docs/building-from-source/getting-started.md
+++ b/docs/website/docs/building-from-source/getting-started.md
@@ -123,7 +123,7 @@
``` shell
ls ../iree-build/iree/tools/
-../iree-build/iree/tools/iree-translate --help
+../iree-build/iree/tools/iree-compile --help
```
<!-- TODO(scotttodd): troubleshooting section? link to github issues? -->
diff --git a/docs/website/docs/building-from-source/riscv.md b/docs/website/docs/building-from-source/riscv.md
index c5405cd..27ff4c0 100644
--- a/docs/website/docs/building-from-source/riscv.md
+++ b/docs/website/docs/building-from-source/riscv.md
@@ -103,7 +103,7 @@
Invoke the host compiler tools to produce a bytecode module flatbuffer:
``` shell
-../iree-build/install/bin/iree-translate \
+../iree-build/install/bin/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vmvx \
iree/samples/models/simple_abs.mlir \
@@ -145,7 +145,7 @@
with the additional command-line flags
```shell hl_lines="3 4 5 6 7 8"
-iree/tools/iree-translate \
+iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-llvm-target-triple=riscv64 \
diff --git a/docs/website/docs/deployment-configurations/bare-metal.md b/docs/website/docs/deployment-configurations/bare-metal.md
index 4c81c37..a7e2a64 100644
--- a/docs/website/docs/deployment-configurations/bare-metal.md
+++ b/docs/website/docs/deployment-configurations/bare-metal.md
@@ -28,7 +28,7 @@
build directory
```shell
-iree/tools/iree-translate \
+iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-stream-partitioning-favor=min-peak-memory \
-iree-hal-target-backends=dylib-llvm-aot \
@@ -64,7 +64,7 @@
`static_library_loader`.
By default, the demo targets the host machine when compiling. To produce a
-bare-metal compatible model, run `iree-translate` as in the previous example
+bare-metal compatible model, run `iree-compile` as in the previous example
and add the additional `-iree-llvm-static-library-output-path=` flag to specify
the static library destination. This will produce a `.h\.o` file to link
directly into the target application.
diff --git a/docs/website/docs/deployment-configurations/cpu-dylib.md b/docs/website/docs/deployment-configurations/cpu-dylib.md
index 615de7c..3664a1d 100644
--- a/docs/website/docs/deployment-configurations/cpu-dylib.md
+++ b/docs/website/docs/deployment-configurations/cpu-dylib.md
@@ -53,7 +53,7 @@
```
!!! tip
- `iree-translate` is installed as `/path/to/python/site-packages/iree/tools/core/iree-translate`.
+ `iree-compile` is installed as `/path/to/python/site-packages/iree/tools/core/iree-compile`.
You can find out the full path to the `site-packages` directory via the
`python -m site` command.
@@ -89,7 +89,7 @@
In the build directory, run the following command:
``` shell hl_lines="3"
-iree/tools/iree-translate \
+iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
iree_input.mlir -o mobilenet-dylib.vmfb
diff --git a/docs/website/docs/deployment-configurations/gpu-cuda-rocm.md b/docs/website/docs/deployment-configurations/gpu-cuda-rocm.md
index 9147799..023aa24 100644
--- a/docs/website/docs/deployment-configurations/gpu-cuda-rocm.md
+++ b/docs/website/docs/deployment-configurations/gpu-cuda-rocm.md
@@ -57,7 +57,7 @@
```
!!! tip
- `iree-translate` is installed as `/path/to/python/site-packages/iree/tools/core/iree-translate`.
+ `iree-compile` is installed as `/path/to/python/site-packages/iree/tools/core/iree-compile`.
You can find out the full path to the `site-packages` directory via the
`python -m site` command.
@@ -95,7 +95,7 @@
=== "Nvidia/CUDA"
``` shell hl_lines="3-5"
- iree/tools/iree-translate \
+ iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=cuda \
-iree-cuda-llvm-target-arch=<...> \
@@ -117,7 +117,7 @@
=== "AMD/ROCm"
``` shell hl_lines="3-6"
- iree/tools/iree-translate \
+ iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=rocm \
-iree-rocm-target-chip=<...> \
diff --git a/docs/website/docs/deployment-configurations/gpu-vulkan.md b/docs/website/docs/deployment-configurations/gpu-vulkan.md
index 041d0ea..c107a8c 100644
--- a/docs/website/docs/deployment-configurations/gpu-vulkan.md
+++ b/docs/website/docs/deployment-configurations/gpu-vulkan.md
@@ -105,7 +105,7 @@
```
!!! tip
- `iree-translate` is installed as `/path/to/python/site-packages/iree/tools/core/iree-translate`.
+ `iree-compile` is installed as `/path/to/python/site-packages/iree/tools/core/iree-compile`.
You can find out the full path to the `site-packages` directory via the
`python -m site` command.
@@ -140,7 +140,7 @@
In the build directory, run the following command:
``` shell hl_lines="3 4"
-iree/tools/iree-translate \
+iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=vulkan-spirv \
-iree-vulkan-target-triple=<...> \
diff --git a/docs/website/docs/getting-started/tflite-cmd.md b/docs/website/docs/getting-started/tflite-cmd.md
index a9bdb89..20219c8 100644
--- a/docs/website/docs/getting-started/tflite-cmd.md
+++ b/docs/website/docs/getting-started/tflite-cmd.md
@@ -24,7 +24,7 @@
iree-import-tflite ${TFLITE_PATH} -o ${IMPORT_PATH}
# Compile for the CPU backend
-iree-translate \
+iree-compile \
--iree-mlir-to-vm-bytecode-module \
--iree-input-type=tosa \
--iree-hal-target-backends=dylib-llvm-aot \
diff --git a/docs/website/docs/reference/optimization-options.md b/docs/website/docs/reference/optimization-options.md
index 9deb0ae..7bb95c4 100644
--- a/docs/website/docs/reference/optimization-options.md
+++ b/docs/website/docs/reference/optimization-options.md
@@ -5,10 +5,10 @@
These flags can be passed to the:
-* `ireec` command line tool
+* `iree-compile` command line tool
* `extra_args=["--flag"]` argument to `iree.compiler.tools` Python wrappers
* In-process Python compiler API
- `iree.compiler.transforms.ireec.CompilerOptions("--flag", "--flag2")`
+ `iree.compiler.transforms.iree-compile.CompilerOptions("--flag", "--flag2")`
constructor
* `ireeCompilerOptionsSetFlags()` compiler C API function
diff --git a/experimental/web/sample_dynamic/build_sample.sh b/experimental/web/sample_dynamic/build_sample.sh
index a01f198..1847215 100755
--- a/experimental/web/sample_dynamic/build_sample.sh
+++ b/experimental/web/sample_dynamic/build_sample.sh
@@ -43,7 +43,7 @@
# Compile from .mlir input to portable .vmfb file using host tools #
###############################################################################
-TRANSLATE_TOOL="${INSTALL_ROOT?}/bin/iree-translate"
+TRANSLATE_TOOL="${INSTALL_ROOT?}/bin/iree-compile"
EMBED_DATA_TOOL="${INSTALL_ROOT?}/bin/generate_embed_data"
translate_sample() {
diff --git a/experimental/web/sample_dynamic/index.html b/experimental/web/sample_dynamic/index.html
index 80be8b1..9246d37 100644
--- a/experimental/web/sample_dynamic/index.html
+++ b/experimental/web/sample_dynamic/index.html
@@ -140,7 +140,7 @@
<p>
Programs must be compiled for WebAssembly to run on this page, using
- options to <code>iree-translate</code> such as:
+ options to <code>iree-compile</code> such as:
</p>
<textarea type="text" readonly spellcheck="false"
diff --git a/experimental/web/sample_static/build_sample.sh b/experimental/web/sample_static/build_sample.sh
index c4c0564..fc8fa99 100755
--- a/experimental/web/sample_static/build_sample.sh
+++ b/experimental/web/sample_static/build_sample.sh
@@ -43,7 +43,7 @@
# Compile from .mlir input to static C source files using host tools #
###############################################################################
-TRANSLATE_TOOL="${INSTALL_ROOT?}/bin/iree-translate"
+TRANSLATE_TOOL="${INSTALL_ROOT?}/bin/iree-compile"
EMBED_DATA_TOOL="${INSTALL_ROOT?}/bin/generate_embed_data"
INPUT_NAME="mnist"
INPUT_PATH="${ROOT_DIR?}/iree/samples/models/mnist.mlir"
diff --git a/integrations/tensorflow/iree_tf_compiler/README.md b/integrations/tensorflow/iree_tf_compiler/README.md
index 4bdf6ae..acb2130 100644
--- a/integrations/tensorflow/iree_tf_compiler/README.md
+++ b/integrations/tensorflow/iree_tf_compiler/README.md
@@ -16,7 +16,7 @@
### iree-import-tf
`iree-import-tf` provides a single entry-point for compiling TensorFlow saved
-models to "IREE Input Dialects" that can be fed to `iree-translate` or
+models to "IREE Input Dialects" that can be fed to `iree-compile` or
`iree-opt` and operated on further.
#### Usage
diff --git a/iree/builtins/device/README.md b/iree/builtins/device/README.md
index 71fdc6c..288ec4c 100644
--- a/iree/builtins/device/README.md
+++ b/iree/builtins/device/README.md
@@ -17,7 +17,7 @@
|||
vvv
+------------+ +---------+ +================+
- | input.mlir | ---> | codegen | ---> | iree-translate |
+ | input.mlir | ---> | codegen | ---> | iree-compile |
+------------+ +---------+ +================+
|
+----------------------------+
diff --git a/iree/compiler/Translation/test/BUILD b/iree/compiler/Translation/test/BUILD
index 165e90f..6d47904 100644
--- a/iree/compiler/Translation/test/BUILD
+++ b/iree/compiler/Translation/test/BUILD
@@ -26,6 +26,7 @@
include = ["*.mlir"],
),
tools = [
+ "//iree/tools:iree-compile",
"//iree/tools:iree-translate",
"@llvm-project//llvm:FileCheck",
],
diff --git a/iree/compiler/Translation/test/CMakeLists.txt b/iree/compiler/Translation/test/CMakeLists.txt
index 8fa58ce..9ebd69c 100644
--- a/iree/compiler/Translation/test/CMakeLists.txt
+++ b/iree/compiler/Translation/test/CMakeLists.txt
@@ -19,6 +19,7 @@
"streams.mlir"
TOOLS
FileCheck
+ iree::tools::iree-compile
iree::tools::iree-translate
)
diff --git a/iree/compiler/Translation/test/smoketest.mlir b/iree/compiler/Translation/test/smoketest.mlir
index 2bcbc71..f2ad857 100644
--- a/iree/compiler/Translation/test/smoketest.mlir
+++ b/iree/compiler/Translation/test/smoketest.mlir
@@ -1,4 +1,4 @@
-// RUN: iree-translate -split-input-file --iree-input-type=mhlo -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module -iree-vm-bytecode-module-output-format=flatbuffer-text %s | FileCheck %s
+// RUN: iree-compile -split-input-file --iree-input-type=mhlo -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module -iree-vm-bytecode-module-output-format=flatbuffer-text %s | FileCheck %s
// CHECK-LABEL: "name": "simple_module"
module @simple_module {
diff --git a/iree/compiler/Translation/test/streams.mlir b/iree/compiler/Translation/test/streams.mlir
index a7a0a59..eb7b625 100644
--- a/iree/compiler/Translation/test/streams.mlir
+++ b/iree/compiler/Translation/test/streams.mlir
@@ -1,4 +1,4 @@
-// RUN: iree-translate -split-input-file -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module -iree-vm-bytecode-module-output-format=flatbuffer-text %s -print-ir-after=iree-vm-ordinal-allocation 2>&1 | FileCheck %s
+// RUN: iree-compile -split-input-file -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module -iree-vm-bytecode-module-output-format=flatbuffer-text %s -print-ir-after=iree-vm-ordinal-allocation 2>&1 | FileCheck %s
// This file has a few test programs that show how to mix `flow` dispatches into
// those created by the `linalg` dispatch region formation: the idea is to use
diff --git a/iree/hal/local/elf/testdata/generate.sh b/iree/hal/local/elf/testdata/generate.sh
index e14d405..94adeb8 100755
--- a/iree/hal/local/elf/testdata/generate.sh
+++ b/iree/hal/local/elf/testdata/generate.sh
@@ -12,11 +12,11 @@
# happens every few months as we are not yet binary-stable but in the future
# will be a bigger issue.
#
-# To use, ensure iree-translate and your compiled ld.lld are on your PATH and
+# To use, ensure iree-compile and your compiled ld.lld are on your PATH and
# run the script:
# $ ./iree/hal/local/elf/testdata/generate.sh
-# Uncomment to see the iree-translate commands issued:
+# Uncomment to see the iree-compile commands issued:
# set -x
set -e
@@ -24,7 +24,7 @@
TESTDATA="${ROOT_DIR}/iree/hal/local/elf/testdata"
# $1: file name ("foo_arm_32.so")
-# $2: list of iree-translate arguments for targeting
+# $2: list of iree-compile arguments for targeting
function compile_and_extract_library() {
local so_name=$1
shift
@@ -33,7 +33,7 @@
echo "Updating ${TESTDATA}/${so_name}"
CMD=(
- iree-translate
+ iree-compile
-iree-mlir-to-hal-executable
${TESTDATA}/elementwise_mul.mlir
-o="${TESTDATA}/${so_name}"
diff --git a/iree/hal/local/executable_library_benchmark.md b/iree/hal/local/executable_library_benchmark.md
index 88d06b9..9a1a8e3 100644
--- a/iree/hal/local/executable_library_benchmark.md
+++ b/iree/hal/local/executable_library_benchmark.md
@@ -113,8 +113,7 @@
1. Build your module with the flags you want for your target architecture:
```
-iree-translate \
- -iree-mlir-to-vm-bytecode-module \
+iree-compile \
-iree-input-type=mhlo \
iree/samples/simple_embedding/simple_embedding_test.mlir \
-o=module.vmfb \
diff --git a/iree/modules/check/test/BUILD b/iree/modules/check/test/BUILD
index ce646ce..8fcf88a 100644
--- a/iree/modules/check/test/BUILD
+++ b/iree/modules/check/test/BUILD
@@ -26,7 +26,7 @@
tags = ["hostonly"],
tools = [
"//iree/tools:iree-check-module",
- "//iree/tools:iree-translate",
+ "//iree/tools:iree-compile",
"@llvm-project//llvm:FileCheck",
],
)
diff --git a/iree/modules/check/test/CMakeLists.txt b/iree/modules/check/test/CMakeLists.txt
index ed1b37d..6ce1270 100644
--- a/iree/modules/check/test/CMakeLists.txt
+++ b/iree/modules/check/test/CMakeLists.txt
@@ -19,7 +19,7 @@
TOOLS
FileCheck
iree::tools::iree-check-module
- iree::tools::iree-translate
+ iree::tools::iree-compile
LABELS
"hostonly"
)
diff --git a/iree/modules/check/test/failure.mlir b/iree/modules/check/test/failure.mlir
index d673baa..842487e 100644
--- a/iree/modules/check/test/failure.mlir
+++ b/iree/modules/check/test/failure.mlir
@@ -1,5 +1,5 @@
-// RUN: iree-translate --iree-input-type=mhlo --iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-check-module --expect_failure - | FileCheck %s
-// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-translate --iree-input-type=mhlo --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-check-module --driver=vulkan --expect_failure - | FileCheck %s)
+// RUN: iree-compile --iree-input-type=mhlo --iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-check-module --expect_failure - | FileCheck %s
+// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-compile --iree-input-type=mhlo --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-check-module --driver=vulkan --expect_failure - | FileCheck %s)
// CHECK-LABEL: expect_failure.expect_true_of_false
// CHECK: Expected 0 to be nonzero
diff --git a/iree/modules/check/test/success.mlir b/iree/modules/check/test/success.mlir
index 9c9650f..333dddc 100644
--- a/iree/modules/check/test/success.mlir
+++ b/iree/modules/check/test/success.mlir
@@ -1,5 +1,5 @@
-// RUN: iree-translate --iree-input-type=mhlo --iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-check-module --driver=vmvx -
-// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-translate --iree-input-type=mhlo --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-check-module --driver=vulkan -)
+// RUN: iree-compile --iree-input-type=mhlo --iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-check-module --driver=vmvx -
+// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-compile --iree-input-type=mhlo --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-check-module --driver=vulkan -)
func @expect_true() {
%true = util.unfoldable_constant 1 : i32
diff --git a/iree/samples/custom_modules/dialect/custom-translate-main.cc b/iree/samples/custom_modules/dialect/custom-translate-main.cc
index cec4100..c61a62d 100644
--- a/iree/samples/custom_modules/dialect/custom-translate-main.cc
+++ b/iree/samples/custom_modules/dialect/custom-translate-main.cc
@@ -5,7 +5,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Custom translation main entry function.
-// Based on the iree-translate main entry function (iree-translate-main.cc).
+// Based on the iree-compile main entry function (iree-compile-main.cc).
//
// We need this entry function because we want to register the custom
// dialect, which is missing in IREE's translation main entry function.
diff --git a/iree/samples/dynamic_shapes/README.md b/iree/samples/dynamic_shapes/README.md
index aafebcf..39f6b4b 100644
--- a/iree/samples/dynamic_shapes/README.md
+++ b/iree/samples/dynamic_shapes/README.md
@@ -67,21 +67,21 @@
1. Run the Colab notebook and download the `dynamic_shapes.mlir` file it
generates
-2. Build the `iree-translate` tool (see
+2. Build the `iree-compile` tool (see
[here](https://google.github.io/iree/building-from-source/getting-started/)
for general instructions on building using CMake)
```
cmake -B ../iree-build/ -DCMAKE_BUILD_TYPE=RelWithDebInfo .
- cmake --build ../iree-build/ --target iree_tools_iree-translate
+ cmake --build ../iree-build/ --target iree_tools_iree-compile
```
-3. Compile the `dynamic_shapes.mlir` file using `iree-translate`. The
+3. Compile the `dynamic_shapes.mlir` file using `iree-compile`. The
[dylib-llvm-aot](https://google.github.io/iree/deployment-configurations/cpu-dylib/)
configuration has the best support for dynamic shapes:
```
- ../iree-build/iree/tools/iree-translate \
+ ../iree-build/iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-input-type=mhlo \
diff --git a/iree/samples/dynamic_shapes/test.sh b/iree/samples/dynamic_shapes/test.sh
index 17af379..cbc496f 100755
--- a/iree/samples/dynamic_shapes/test.sh
+++ b/iree/samples/dynamic_shapes/test.sh
@@ -21,12 +21,12 @@
${ROOT_DIR}/iree/samples/dynamic_shapes/dynamic_shapes.ipynb
test -f ${ARTIFACTS_DIR}/dynamic_shapes.mlir && echo "dynamic_shapes.mlir exists"
-# 2. Compile the `iree-translate` tool.
+# 2. Compile the `iree-compile` tool.
cmake -B ${BUILD_DIR} -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ${ROOT_DIR}
-cmake --build ${BUILD_DIR} --target iree_tools_iree-translate -- -k 0
+cmake --build ${BUILD_DIR} --target iree_tools_iree-compile -- -k 0
-# 3. Compile `dynamic_shapes.mlir` using `iree-translate`.
-${BUILD_DIR}/iree/tools/iree-translate \
+# 3. Compile `dynamic_shapes.mlir` using `iree-compile`.
+${BUILD_DIR}/iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-input-type=mhlo \
diff --git a/iree/samples/static_library/CMakeLists.txt b/iree/samples/static_library/CMakeLists.txt
index cd46e87..cd8120e 100644
--- a/iree/samples/static_library/CMakeLists.txt
+++ b/iree/samples/static_library/CMakeLists.txt
@@ -10,11 +10,11 @@
return()
endif()
-# Set iree-translate binary.
-set(_TRANSLATE_TOOL_EXECUTABLE $<TARGET_FILE:iree_tools_iree-translate>)
+# Set iree-compile binary.
+set(_TRANSLATE_TOOL_EXECUTABLE $<TARGET_FILE:iree_tools_iree-compile>)
## Example with VM bytecode module.
-# Setup args for iree-translate.
+# Setup args for iree-compile.
set(_TRANSLATE_ARGS)
list(APPEND _TRANSLATE_ARGS "-iree-mlir-to-vm-bytecode-module")
list(APPEND _TRANSLATE_ARGS "-iree-hal-target-backends=dylib-llvm-aot")
@@ -25,7 +25,7 @@
list(APPEND _TRANSLATE_ARGS "-o")
list(APPEND _TRANSLATE_ARGS "simple_mul.vmfb")
-# Custom command for iree-translate to generate static library and bytecode.
+# Custom command for iree-compile to generate static library and bytecode.
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/simple_mul.h
@@ -46,7 +46,7 @@
LINKER_LANGUAGE C)
# Note: If you're cross compiling the simple_mul for a different backend, you'll
-# need to run iree-translate manually to produce the desired '.vmfb' and '.h/.o'
+# need to run iree-compile manually to produce the desired '.vmfb' and '.h/.o'
# files. Substitute the 'simple_mul' dependency in iree_cc_binary() below with
# your own static library and the `simple_mul.vmfb` in the iree_c_embed_data()
# rule. You can use paths to files, i.e. 'path/to/generated/output.vmfb' in
@@ -100,7 +100,7 @@
endif()
## Example with VM C module.
-# Setup args for iree-translate.
+# Setup args for iree-compile.
set(_TRANSLATE_ARGS)
list(APPEND _TRANSLATE_ARGS "-iree-mlir-to-vm-c-module")
list(APPEND _TRANSLATE_ARGS "-iree-hal-target-backends=dylib-llvm-aot")
@@ -111,7 +111,7 @@
list(APPEND _TRANSLATE_ARGS "-o")
list(APPEND _TRANSLATE_ARGS "simple_mul_emitc.h")
-# Custom command for iree-translate to generate static library and C module.
+# Custom command for iree-compile to generate static library and C module.
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/simple_mul_c_module.h
diff --git a/iree/samples/static_library/README.md b/iree/samples/static_library/README.md
index f527717..013d33c 100644
--- a/iree/samples/static_library/README.md
+++ b/iree/samples/static_library/README.md
@@ -24,7 +24,7 @@
useful on "bare metal" or embedded systems running IREE that lack operating
systems or the ability to load shared libraries in binaries.
-When static library output is enabled, `iree-translate` produces a separate
+When static library output is enabled, `iree-compile` produces a separate
static library to compile into the target program. At runtime bytecode module
instructs the VM which static libraries to load exported functions from the
model.
diff --git a/iree/samples/static_library/static_library_demo.c b/iree/samples/static_library/static_library_demo.c
index 2da897e..1497de7 100644
--- a/iree/samples/static_library/static_library_demo.c
+++ b/iree/samples/static_library/static_library_demo.c
@@ -5,7 +5,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// A example of static library loading in IREE. See the README.md for more info.
-// Note: this demo requires artifacts from iree-translate before it will run.
+// Note: this demo requires artifacts from iree-compile before it will run.
#include "iree/hal/local/loaders/static_library_loader.h"
#include "iree/hal/local/sync_device.h"
diff --git a/iree/samples/variables_and_state/README.md b/iree/samples/variables_and_state/README.md
index dc0e086..b03b0ee 100644
--- a/iree/samples/variables_and_state/README.md
+++ b/iree/samples/variables_and_state/README.md
@@ -88,10 +88,10 @@
For example, to use IREE's `dylib-llvm-aot` target, which is optimized for CPU
execution using LLVM, refer to the
[documentation](https://google.github.io/iree/deployment-configurations/cpu-dylib/)
-and compile the imported `counter.mlir` file using `iree-translate`:
+and compile the imported `counter.mlir` file using `iree-compile`:
```
-../iree-build/iree/tools/iree-translate \
+../iree-build/iree/tools/iree-compile \
-iree-mlir-to-vm-bytecode-module \
-iree-hal-target-backends=dylib-llvm-aot \
-iree-input-type=mhlo \
diff --git a/iree/test/e2e/matmul/generate_e2e_matmul_tests.py b/iree/test/e2e/matmul/generate_e2e_matmul_tests.py
index f6f0008..c982356 100644
--- a/iree/test/e2e/matmul/generate_e2e_matmul_tests.py
+++ b/iree/test/e2e/matmul/generate_e2e_matmul_tests.py
@@ -572,7 +572,7 @@
"--module_path",
type=str,
help=
- "Module path (typically .vmfb) to be referenced in the output trace. Should match the output path of the iree-translate command generating the module.",
+ "Module path (typically .vmfb) to be referenced in the output trace. Should match the output path of the iree-compile command generating the module.",
required=True)
parser.add_argument(
"--requirements",
diff --git a/iree/test/e2e/tensor_ops/BUILD b/iree/test/e2e/tensor_ops/BUILD
index 1c694b2..6c8f78c 100644
--- a/iree/test/e2e/tensor_ops/BUILD
+++ b/iree/test/e2e/tensor_ops/BUILD
@@ -28,8 +28,8 @@
tags = ["hostonly"],
tools = [
"//iree/tools:iree-benchmark-module",
+ "//iree/tools:iree-compile",
"//iree/tools:iree-run-mlir",
- "//iree/tools:iree-translate",
"@llvm-project//llvm:FileCheck",
],
)
diff --git a/iree/test/e2e/tensor_ops/CMakeLists.txt b/iree/test/e2e/tensor_ops/CMakeLists.txt
index 2acc931..3c9adf2 100644
--- a/iree/test/e2e/tensor_ops/CMakeLists.txt
+++ b/iree/test/e2e/tensor_ops/CMakeLists.txt
@@ -18,8 +18,8 @@
TOOLS
FileCheck
iree::tools::iree-benchmark-module
+ iree::tools::iree-compile
iree::tools::iree-run-mlir
- iree::tools::iree-translate
LABELS
"hostonly"
)
diff --git a/iree/tools/BUILD b/iree/tools/BUILD
index 753c641..3460b0d 100644
--- a/iree/tools/BUILD
+++ b/iree/tools/BUILD
@@ -239,6 +239,17 @@
)
cc_library(
+ name = "init_llvmir_translations",
+ hdrs = [
+ "init_llvmir_translations.h",
+ ],
+ deps = [
+ "@llvm-project//mlir:ArmNeonToLLVMIRTranslation",
+ "@llvm-project//mlir:ToLLVMIRTranslation",
+ ],
+)
+
+cc_library(
name = "iree_opt_main",
srcs = ["iree-opt-main.cc"],
deps = [
@@ -380,18 +391,15 @@
cc_library(
name = "iree_translate_lib",
srcs = [
+ "iree_compile_lib.cc",
"iree_translate_lib.cc",
- "ireec_lib.cc",
],
hdrs = ["iree_translate_lib.h"],
deps = [
- ":init_compiler_modules",
- ":init_iree_passes_and_dialects",
- ":init_mlir_passes_and_dialects",
+ ":init_llvmir_translations",
":init_passes_and_dialects",
":init_targets",
":init_translations",
- ":init_xla_dialects",
"//iree/compiler/Codegen",
"//iree/compiler/ConstEval",
"//iree/compiler/Dialect/VM/Target:init_targets",
@@ -402,14 +410,12 @@
"//iree/compiler/Translation:IREEVM",
"//iree/compiler/Utils",
"@llvm-project//llvm:Support",
- "@llvm-project//mlir:ArmNeonToLLVMIRTranslation",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:LLVMToLLVMIRTranslation",
"@llvm-project//mlir:Parser",
"@llvm-project//mlir:Pass",
"@llvm-project//mlir:SCFTransforms",
"@llvm-project//mlir:Support",
- "@llvm-project//mlir:ToLLVMIRTranslation",
"@llvm-project//mlir:Translation",
],
)
@@ -424,8 +430,8 @@
)
cc_binary(
- name = "ireec",
- srcs = ["ireec-main.cc"],
+ name = "iree-compile",
+ srcs = ["iree-compile-main.cc"],
tags = ["hostonly"],
deps = [
":iree_translate_lib",
diff --git a/iree/tools/CMakeLists.txt b/iree/tools/CMakeLists.txt
index 8d14c87..e81e3cf 100644
--- a/iree/tools/CMakeLists.txt
+++ b/iree/tools/CMakeLists.txt
@@ -314,6 +314,17 @@
iree_cc_library(
NAME
+ init_llvmir_translations
+ HDRS
+ "init_llvmir_translations.h"
+ DEPS
+ MLIRArmNeonToLLVMIRTranslation
+ MLIRLLVMToLLVMIRTranslation
+ PUBLIC
+ )
+
+ iree_cc_library(
+ NAME
init_compiler_modules
HDRS
"init_compiler_modules.h"
@@ -379,19 +390,15 @@
HDRS
"iree_translate_lib.h"
SRCS
- "ireec_lib.cc"
+ "iree_compile_lib.cc"
"iree_translate_lib.cc"
DEPS
- ::init_compiler_modules
- ::init_iree_passes_and_dialects
- ::init_mlir_passes_and_dialects
+ ::init_llvmir_translations
+ ::init_passes_and_dialects
::init_targets
::init_translations
- ::init_xla_dialects
LLVMSupport
MLIRIR
- MLIRArmNeonToLLVMIRTranslation
- MLIRLLVMToLLVMIRTranslation
MLIRSCFTransforms
MLIRParser
MLIRPass
@@ -424,16 +431,14 @@
iree_cc_binary(
NAME
- ireec
+ iree-compile
SRCS
- "ireec-main.cc"
+ "iree-compile-main.cc"
DEPS
::iree_translate_lib
DATA
${IREE_LLD_TARGET}
HOSTONLY
- # TODO: Enable when ready. Excluded for now to save build time for folks.
- EXCLUDE_FROM_ALL
)
iree_cc_binary(
diff --git a/iree/tools/init_llvmir_translations.h b/iree/tools/init_llvmir_translations.h
new file mode 100644
index 0000000..dd35149
--- /dev/null
+++ b/iree/tools/init_llvmir_translations.h
@@ -0,0 +1,30 @@
+// Copyright 2020 The IREE Authors
+//
+// Licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// Configures a context with hooks to translate custom extensions to LLVMIR.
+// Note that this has nothing to do with the named translations that are
+// globally registered as part of init_translations.h for the purpose of
+// driving iree-translate. This is maintained separately to other dialect
+// initializations because it causes a transitive dependency on LLVMIR.
+
+#ifndef IREE_TOOLS_INIT_LLVMIR_TRANSLATIONS_H_
+#define IREE_TOOLS_INIT_LLVMIR_TRANSLATIONS_H_
+
+#include "mlir/Target/LLVMIR/Dialect/ArmNeon/ArmNeonToLLVMIRTranslation.h"
+#include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"
+
+namespace mlir {
+namespace iree_compiler {
+
+inline void registerLLVMIRTranslations(DialectRegistry ®istry) {
+ mlir::registerLLVMDialectTranslation(registry);
+ mlir::registerArmNeonDialectTranslation(registry);
+}
+
+} // namespace iree_compiler
+} // namespace mlir
+
+#endif // IREE_TOOLS_INIT_LLVMIR_TRANSLATIONS_H_
diff --git a/iree/tools/init_translations.h b/iree/tools/init_translations.h
index d97735e..2d83267 100644
--- a/iree/tools/init_translations.h
+++ b/iree/tools/init_translations.h
@@ -9,6 +9,11 @@
//
// Based on MLIR's InitAllTranslations but without translations we don't care
// about.
+//
+// Note that this performs registration of named translations for the use of
+// iree-translate. This is different from "LLVM IR Translations", which are
+// registered on a context and provide hooks for populating LLVM IR for
+// certain dialects. See init_llvmir_translations.h.
#ifndef IREE_TOOLS_INIT_TRANSLATIONS_H_
#define IREE_TOOLS_INIT_TRANSLATIONS_H_
diff --git a/iree/tools/ireec-main.cc b/iree/tools/iree-compile-main.cc
similarity index 100%
rename from iree/tools/ireec-main.cc
rename to iree/tools/iree-compile-main.cc
diff --git a/iree/tools/iree-dump-module-main.c b/iree/tools/iree-dump-module-main.c
index df3ff5a..70adcbd 100644
--- a/iree/tools/iree-dump-module-main.c
+++ b/iree/tools/iree-dump-module-main.c
@@ -13,7 +13,7 @@
// Today we just print to JSON. We could do something more useful (size
// analysis, etc), but JSON should be enough.
//
-// We could also move all of this into iree-translate (mlir -> vmfb -> json),
+// We could also move all of this into iree-compile (mlir -> vmfb -> json),
// though having a tiny little tool not reliant on LLVM is nice (can run this
// on a device).
int main(int argc, char** argv) {
diff --git a/iree/tools/ireec_lib.cc b/iree/tools/iree_compile_lib.cc
similarity index 95%
rename from iree/tools/ireec_lib.cc
rename to iree/tools/iree_compile_lib.cc
index 0ef5b78..a6dae52 100644
--- a/iree/tools/ireec_lib.cc
+++ b/iree/tools/iree_compile_lib.cc
@@ -14,12 +14,10 @@
#include "iree/compiler/Pipelines/Pipelines.h"
#include "iree/compiler/Utils/PassUtils.h"
#include "iree/compiler/Utils/TracingUtils.h"
-#include "iree/tools/init_compiler_modules.h"
-#include "iree/tools/init_iree_dialects.h"
-#include "iree/tools/init_mlir_dialects.h"
+#include "iree/tools/init_dialects.h"
+#include "iree/tools/init_llvmir_translations.h"
#include "iree/tools/init_passes.h"
#include "iree/tools/init_targets.h"
-#include "iree/tools/init_xla_dialects.h"
#include "iree/tools/iree_translate_lib.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
@@ -73,18 +71,20 @@
int mlir::iree_compiler::runIreecMain(int argc, char **argv) {
llvm::InitLLVM y(argc, argv);
- mlir::DialectRegistry registry;
static llvm::cl::OptionCategory mainOptions("IREE Main Options");
- mlir::registerMlirDialects(registry);
- // TODO: Make this conditional?
- mlir::registerXLADialects(registry);
+ // Global/static registrations.
+ // Allegedly need to register passes to get good reproducers
+ // TODO: Verify this (I think that this was fixed some time ago).
mlir::iree_compiler::registerAllPasses();
- mlir::iree_compiler::registerIreeDialects(registry);
- mlir::iree_compiler::registerIreeCompilerModuleDialects(registry);
mlir::iree_compiler::registerHALTargetBackends();
mlir::iree_compiler::registerVMTargets();
+ // MLIRContext registration and hooks.
+ mlir::DialectRegistry registry;
+ mlir::iree_compiler::registerAllDialects(registry);
+ mlir::iree_compiler::registerLLVMIRTranslations(registry);
+
// Register MLIRContext command-line options like
// -mlir-print-op-on-diagnostic.
mlir::registerMLIRContextCLOptions();
diff --git a/iree/tools/iree_translate_lib.cc b/iree/tools/iree_translate_lib.cc
index 9c9a3b2..301dbe0 100644
--- a/iree/tools/iree_translate_lib.cc
+++ b/iree/tools/iree_translate_lib.cc
@@ -12,13 +12,11 @@
#include <type_traits>
#include "iree/compiler/Dialect/VM/Target/init_targets.h"
-#include "iree/tools/init_compiler_modules.h"
-#include "iree/tools/init_iree_dialects.h"
-#include "iree/tools/init_mlir_dialects.h"
+#include "iree/tools/init_dialects.h"
+#include "iree/tools/init_llvmir_translations.h"
#include "iree/tools/init_passes.h"
#include "iree/tools/init_targets.h"
#include "iree/tools/init_translations.h"
-#include "iree/tools/init_xla_dialects.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
@@ -36,27 +34,25 @@
#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/Timing.h"
#include "mlir/Support/ToolUtilities.h"
-#include "mlir/Target/LLVMIR/Dialect/ArmNeon/ArmNeonToLLVMIRTranslation.h"
-#include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"
#include "mlir/Tools/mlir-translate/Translation.h"
// TODO: Once we are switched to runIreecMain, this can be slimmed down
// substantially, since it will just be about testing actual translations.
int mlir::iree_compiler::runIreeTranslateMain(int argc, char **argv) {
llvm::InitLLVM y(argc, argv);
- mlir::DialectRegistry registry;
- mlir::registerMlirDialects(registry);
- mlir::registerLLVMDialectTranslation(registry);
- // TODO: Make this conditional?
- mlir::registerArmNeonDialectTranslation(registry);
- mlir::registerXLADialects(registry);
- mlir::iree_compiler::registerAllPasses();
- mlir::iree_compiler::registerIreeDialects(registry);
- mlir::iree_compiler::registerIreeCompilerModuleDialects(registry);
+
+ // Global/static registrations.
mlir::iree_compiler::registerHALTargetBackends();
mlir::iree_compiler::registerVMTargets();
mlir::registerMlirTranslations();
mlir::iree_compiler::registerIreeTranslations();
+ mlir::iree_compiler::registerAllPasses();
+
+ // MLIRContext registration and hooks.
+ mlir::DialectRegistry registry;
+ mlir::iree_compiler::registerAllDialects(registry);
+ mlir::iree_compiler::registerLLVMIRTranslations(registry);
+
// Make sure command line options are registered.
(void)mlir::iree_compiler::IREE::HAL::TargetOptions::FromFlags::get();
diff --git a/iree/tools/iree_translate_lib.h b/iree/tools/iree_translate_lib.h
index d964d2e..08e8914 100644
--- a/iree/tools/iree_translate_lib.h
+++ b/iree/tools/iree_translate_lib.h
@@ -14,8 +14,8 @@
// NOTE: We are transitioning from the main compiler being based on
// the MLIR translation library (i.e. iree-translate) to a dedicated tool
-// called ireec. When this is done, the above should go away and this file
-// should be renamed to ireec_lib.h.
+// called iree-compile. When this is done, the above should go away and this
+// file should be renamed to iree_compile_lib.h.
int runIreecMain(int argc, char **argv);
} // namespace iree_compiler
diff --git a/iree/tools/test/BUILD b/iree/tools/test/BUILD
index be357dd..b5f827b 100644
--- a/iree/tools/test/BUILD
+++ b/iree/tools/test/BUILD
@@ -34,9 +34,9 @@
],
tools = [
"//iree/tools:iree-benchmark-module",
+ "//iree/tools:iree-compile",
"//iree/tools:iree-run-mlir",
"//iree/tools:iree-run-module",
- "//iree/tools:iree-translate",
"@llvm-project//lld",
"@llvm-project//llvm:FileCheck",
],
@@ -50,7 +50,7 @@
],
tools = [
"//iree/tools:iree-benchmark-module",
- "//iree/tools:iree-translate",
+ "//iree/tools:iree-compile",
"@llvm-project//llvm:FileCheck",
],
)
diff --git a/iree/tools/test/CMakeLists.txt b/iree/tools/test/CMakeLists.txt
index 57ef3b3..e243d99 100644
--- a/iree/tools/test/CMakeLists.txt
+++ b/iree/tools/test/CMakeLists.txt
@@ -25,9 +25,9 @@
${IREE_LLD_TARGET}
FileCheck
iree::tools::iree-benchmark-module
+ iree::tools::iree-compile
iree::tools::iree-run-mlir
iree::tools::iree-run-module
- iree::tools::iree-translate
LABELS
"hostonly"
)
@@ -40,7 +40,7 @@
TOOLS
FileCheck
iree::tools::iree-benchmark-module
- iree::tools::iree-translate
+ iree::tools::iree-compile
LABELS
"hostonly"
)
diff --git a/iree/tools/test/benchmark_flags.txt b/iree/tools/test/benchmark_flags.txt
index b2d9d70..17b9c5e 100644
--- a/iree/tools/test/benchmark_flags.txt
+++ b/iree/tools/test/benchmark_flags.txt
@@ -2,7 +2,7 @@
// HELP: --module_file
// HELP: --benchmark_list_tests
-// RUN: ( iree-translate --iree-input-type=mhlo --iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --benchmark_list_tests --driver=vmvx --benchmark_list_tests ) | FileCheck --check-prefix=LIST-BENCHMARKS %s
+// RUN: ( iree-compile --iree-input-type=mhlo --iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --benchmark_list_tests --driver=vmvx --benchmark_list_tests ) | FileCheck --check-prefix=LIST-BENCHMARKS %s
module {
// LIST-BENCHMARKS: BM_foo1
func @foo1() -> tensor<4xf32> {
diff --git a/iree/tools/test/iree-benchmark-module.mlir b/iree/tools/test/iree-benchmark-module.mlir
index 174b24a..1ff6662 100644
--- a/iree/tools/test/iree-benchmark-module.mlir
+++ b/iree/tools/test/iree-benchmark-module.mlir
@@ -1,6 +1,6 @@
-// RUN: iree-translate -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx --entry_function=abs --function_input=f32=-2 | FileCheck %s
-// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-translate --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vulkan --entry_function=abs --function_input=f32=-2 | FileCheck %s)
-// RUN: iree-translate --iree-hal-target-backends=dylib-llvm-aot -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=dylib --entry_function=abs --function_input=f32=-2 | FileCheck %s
+// RUN: iree-compile -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx --entry_function=abs --function_input=f32=-2 | FileCheck %s
+// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-compile --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vulkan --entry_function=abs --function_input=f32=-2 | FileCheck %s)
+// RUN: iree-compile --iree-hal-target-backends=dylib-llvm-aot -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=dylib --entry_function=abs --function_input=f32=-2 | FileCheck %s
// CHECK-LABEL: BM_abs
func @abs(%input : tensor<f32>) -> (tensor<f32>) {
diff --git a/iree/tools/test/iree-run-module.mlir b/iree/tools/test/iree-run-module.mlir
index 7bdff06..71ce4f9 100644
--- a/iree/tools/test/iree-run-module.mlir
+++ b/iree/tools/test/iree-run-module.mlir
@@ -1,6 +1,6 @@
-// RUN: (iree-translate -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-run-module --driver=vmvx --entry_function=abs --function_input=f32=-2) | FileCheck %s
-// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || ((iree-translate --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-run-module --driver=vulkan --entry_function=abs --function_input=f32=-2) | FileCheck %s)
-// RUN: (iree-translate --iree-hal-target-backends=dylib-llvm-aot -iree-mlir-to-vm-bytecode-module %s | iree-run-module --driver=dylib --entry_function=abs --function_input=f32=-2) | FileCheck %s
+// RUN: (iree-compile -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-run-module --driver=vmvx --entry_function=abs --function_input=f32=-2) | FileCheck %s
+// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || ((iree-compile --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-run-module --driver=vulkan --entry_function=abs --function_input=f32=-2) | FileCheck %s)
+// RUN: (iree-compile --iree-hal-target-backends=dylib-llvm-aot -iree-mlir-to-vm-bytecode-module %s | iree-run-module --driver=dylib --entry_function=abs --function_input=f32=-2) | FileCheck %s
// CHECK-LABEL: EXEC @abs
func @abs(%input : tensor<f32>) -> (tensor<f32>) {
diff --git a/iree/tools/test/multiple_args.mlir b/iree/tools/test/multiple_args.mlir
index 61f6f74..8fb3c0a 100644
--- a/iree/tools/test/multiple_args.mlir
+++ b/iree/tools/test/multiple_args.mlir
@@ -1,6 +1,6 @@
-// RUN: iree-translate -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-run-module --entry_function=multi_input --function_input="2xi32=[1 2]" --function_input="2xi32=[3 4]" | FileCheck %s
+// RUN: iree-compile -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-run-module --entry_function=multi_input --function_input="2xi32=[1 2]" --function_input="2xi32=[3 4]" | FileCheck %s
// RUN: iree-run-mlir --iree-hal-target-backends=vmvx --function-input='2xi32=[1 2]' --function-input='2xi32=[3 4]' %s | FileCheck %s
-// RUN: iree-translate -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx --entry_function=multi_input --function_input="2xi32=[1 2]" --function_input="2xi32=[3 4]" | FileCheck --check-prefix=BENCHMARK %s
+// RUN: iree-compile -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx --entry_function=multi_input --function_input="2xi32=[1 2]" --function_input="2xi32=[3 4]" | FileCheck --check-prefix=BENCHMARK %s
// BENCHMARK-LABEL: BM_multi_input
// CHECK-LABEL: EXEC @multi_input
diff --git a/iree/tools/test/multiple_exported_functions.mlir b/iree/tools/test/multiple_exported_functions.mlir
index affb83d..efdd3d6 100644
--- a/iree/tools/test/multiple_exported_functions.mlir
+++ b/iree/tools/test/multiple_exported_functions.mlir
@@ -1,5 +1,5 @@
-// RUN: iree-translate -iree-input-type=mhlo -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx | FileCheck %s
-// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-translate -iree-input-type=mhlo -iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vulkan | FileCheck %s)
+// RUN: iree-compile -iree-input-type=mhlo -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx | FileCheck %s
+// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-compile -iree-input-type=mhlo -iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vulkan | FileCheck %s)
module {
func @foo1() -> tensor<4xf32> {
diff --git a/iree/tools/test/repeated_return.mlir b/iree/tools/test/repeated_return.mlir
index b6c2ceb..a606666 100644
--- a/iree/tools/test/repeated_return.mlir
+++ b/iree/tools/test/repeated_return.mlir
@@ -1,5 +1,5 @@
-// RUN: (iree-translate -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-run-module --entry_function=many_tensor) | FileCheck %s
-// RUN: iree-translate -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx --entry_function=many_tensor | FileCheck --check-prefix=BENCHMARK %s
+// RUN: (iree-compile -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-run-module --entry_function=many_tensor) | FileCheck %s
+// RUN: iree-compile -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx --entry_function=many_tensor | FileCheck --check-prefix=BENCHMARK %s
// RUN: iree-run-mlir -iree-hal-target-backends=vmvx %s | FileCheck %s
// BENCHMARK-LABEL: BM_many_tensor
diff --git a/iree/tools/test/scalars.mlir b/iree/tools/test/scalars.mlir
index 52adfad..757ecbe 100644
--- a/iree/tools/test/scalars.mlir
+++ b/iree/tools/test/scalars.mlir
@@ -1,5 +1,5 @@
-// RUN: (iree-translate -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-run-module --entry_function=scalar --function_input=42) | FileCheck %s
-// RUN: iree-translate -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx --entry_function=scalar --function_input=42 | FileCheck --check-prefix=BENCHMARK %s
+// RUN: (iree-compile -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-run-module --entry_function=scalar --function_input=42) | FileCheck %s
+// RUN: iree-compile -iree-hal-target-backends=vmvx -iree-mlir-to-vm-bytecode-module %s | iree-benchmark-module --driver=vmvx --entry_function=scalar --function_input=42 | FileCheck --check-prefix=BENCHMARK %s
// RUN: (iree-run-mlir --iree-hal-target-backends=vmvx --function-input=42 %s) | FileCheck %s
// BENCHMARK-LABEL: BM_scalar
diff --git a/iree/vm/BUILD b/iree/vm/BUILD
index 2b13444..35dde95 100644
--- a/iree/vm/BUILD
+++ b/iree/vm/BUILD
@@ -272,6 +272,7 @@
src = "bytecode_module_benchmark.mlir",
c_identifier = "iree_vm_bytecode_module_benchmark_module",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
cc_binary_benchmark(
@@ -291,6 +292,7 @@
src = "bytecode_module_size_benchmark.mlir",
c_identifier = "iree_vm_bytecode_module_size_benchmark_module",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_cmake_extra_content(
diff --git a/iree/vm/CMakeLists.txt b/iree/vm/CMakeLists.txt
index f03dce3..858bb13 100644
--- a/iree/vm/CMakeLists.txt
+++ b/iree/vm/CMakeLists.txt
@@ -234,6 +234,8 @@
"bytecode_module_benchmark.mlir"
C_IDENTIFIER
"iree_vm_bytecode_module_benchmark_module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
TESTONLY
@@ -260,6 +262,8 @@
"bytecode_module_size_benchmark.mlir"
C_IDENTIFIER
"iree_vm_bytecode_module_size_benchmark_module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
TESTONLY
diff --git a/iree/vm/test/BUILD b/iree/vm/test/BUILD
index 65741dc..c0f5ba5 100644
--- a/iree/vm/test/BUILD
+++ b/iree/vm/test/BUILD
@@ -60,142 +60,166 @@
name = "arithmetic_ops",
src = "arithmetic_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "arithmetic_ops_f32",
src = "arithmetic_ops_f32.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "arithmetic_ops_i64",
src = "arithmetic_ops_i64.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "assignment_ops",
src = "assignment_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "assignment_ops_f32",
src = "assignment_ops_f32.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "assignment_ops_i64",
src = "assignment_ops_i64.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "buffer_ops",
src = "buffer_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "call_ops",
src = "call_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "comparison_ops",
src = "comparison_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "comparison_ops_f32",
src = "comparison_ops_f32.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "comparison_ops_i64",
src = "comparison_ops_i64.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "control_flow_ops",
src = "control_flow_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "conversion_ops",
src = "conversion_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "conversion_ops_f32",
src = "conversion_ops_f32.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "conversion_ops_i64",
src = "conversion_ops_i64.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "global_ops",
src = "global_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "global_ops_f32",
src = "global_ops_f32.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "global_ops_i64",
src = "global_ops_i64.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "list_ops",
src = "list_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "list_ops_i64",
src = "list_ops_i64.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "list_variant_ops",
src = "list_variant_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "ref_ops",
src = "ref_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "shift_ops",
src = "shift_ops.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
iree_bytecode_module(
name = "shift_ops_i64",
src = "shift_ops_i64.mlir",
flags = ["-iree-vm-ir-to-bytecode-module"],
+ translate_tool = "//iree/tools:iree-translate",
)
diff --git a/iree/vm/test/CMakeLists.txt b/iree/vm/test/CMakeLists.txt
index 494b6ef..81b3f67 100644
--- a/iree/vm/test/CMakeLists.txt
+++ b/iree/vm/test/CMakeLists.txt
@@ -55,6 +55,8 @@
arithmetic_ops
SRC
"arithmetic_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -65,6 +67,8 @@
arithmetic_ops_f32
SRC
"arithmetic_ops_f32.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -75,6 +79,8 @@
arithmetic_ops_i64
SRC
"arithmetic_ops_i64.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -85,6 +91,8 @@
assignment_ops
SRC
"assignment_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -95,6 +103,8 @@
assignment_ops_f32
SRC
"assignment_ops_f32.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -105,6 +115,8 @@
assignment_ops_i64
SRC
"assignment_ops_i64.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -115,6 +127,8 @@
buffer_ops
SRC
"buffer_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -125,6 +139,8 @@
call_ops
SRC
"call_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -135,6 +151,8 @@
comparison_ops
SRC
"comparison_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -145,6 +163,8 @@
comparison_ops_f32
SRC
"comparison_ops_f32.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -155,6 +175,8 @@
comparison_ops_i64
SRC
"comparison_ops_i64.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -165,6 +187,8 @@
control_flow_ops
SRC
"control_flow_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -175,6 +199,8 @@
conversion_ops
SRC
"conversion_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -185,6 +211,8 @@
conversion_ops_f32
SRC
"conversion_ops_f32.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -195,6 +223,8 @@
conversion_ops_i64
SRC
"conversion_ops_i64.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -205,6 +235,8 @@
global_ops
SRC
"global_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -215,6 +247,8 @@
global_ops_f32
SRC
"global_ops_f32.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -225,6 +259,8 @@
global_ops_i64
SRC
"global_ops_i64.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -235,6 +271,8 @@
list_ops
SRC
"list_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -245,6 +283,8 @@
list_ops_i64
SRC
"list_ops_i64.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -255,6 +295,8 @@
list_variant_ops
SRC
"list_variant_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -265,6 +307,8 @@
ref_ops
SRC
"ref_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -275,6 +319,8 @@
shift_ops
SRC
"shift_ops.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
@@ -285,6 +331,8 @@
shift_ops_i64
SRC
"shift_ops_i64.mlir"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
FLAGS
"-iree-vm-ir-to-bytecode-module"
PUBLIC
diff --git a/iree/vm/test/emitc/CMakeLists.txt b/iree/vm/test/emitc/CMakeLists.txt
index 77513a1..68df57d 100644
--- a/iree/vm/test/emitc/CMakeLists.txt
+++ b/iree/vm/test/emitc/CMakeLists.txt
@@ -53,6 +53,8 @@
"arithmetic_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -64,6 +66,8 @@
"arithmetic_ops_f32.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -75,6 +79,8 @@
"arithmetic_ops_i64.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -86,6 +92,8 @@
"assignment_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -97,6 +105,8 @@
"assignment_ops_f32.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -108,6 +118,8 @@
"assignment_ops_i64.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -119,6 +131,8 @@
"buffer_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -130,6 +144,8 @@
"call_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -141,6 +157,8 @@
"comparison_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -152,6 +170,8 @@
"comparison_ops_f32.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -163,6 +183,8 @@
"comparison_ops_i64.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -174,6 +196,8 @@
"control_flow_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -185,6 +209,8 @@
"conversion_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -196,6 +222,8 @@
"conversion_ops_f32.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -207,6 +235,8 @@
"conversion_ops_i64.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -218,6 +248,8 @@
"global_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -229,6 +261,8 @@
"global_ops_f32.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -240,6 +274,8 @@
"global_ops_i64.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -251,6 +287,8 @@
"list_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -262,6 +300,8 @@
"list_variant_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -273,6 +313,8 @@
"ref_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -284,6 +326,8 @@
"shift_ops.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
iree_c_module(
@@ -295,6 +339,8 @@
"shift_ops_i64.h"
FLAGS
"-iree-vm-ir-to-c-module"
+ TRANSLATE_TOOL
+ iree_tools_iree-translate
)
endif()
diff --git a/llvm-external-projects/iree-compiler-api/BUILD.bazel b/llvm-external-projects/iree-compiler-api/BUILD.bazel
index 02cd3b5..8ad8fcd 100644
--- a/llvm-external-projects/iree-compiler-api/BUILD.bazel
+++ b/llvm-external-projects/iree-compiler-api/BUILD.bazel
@@ -71,6 +71,7 @@
"//iree/compiler/InputConversion/TOSA",
"//iree/compiler/Pipelines",
"//iree/compiler/Utils",
+ "//iree/tools:init_llvmir_translations",
"//iree/tools:init_passes_and_dialects",
"//iree/tools:init_targets",
"//iree/tools:iree_translate_lib",
diff --git a/llvm-external-projects/iree-compiler-api/build_tools/smoketest.py b/llvm-external-projects/iree-compiler-api/build_tools/smoketest.py
index 9b04e47..2c12eba 100644
--- a/llvm-external-projects/iree-compiler-api/build_tools/smoketest.py
+++ b/llvm-external-projects/iree-compiler-api/build_tools/smoketest.py
@@ -61,5 +61,4 @@
print(f"REVISIONS={version.REVISIONS!r}")
# Check console scripts.
-subprocess.check_output(["ireec", "-help"])
-subprocess.check_output(["iree-translate", "-help"])
+subprocess.check_output(["iree-compile", "-help"])
diff --git a/llvm-external-projects/iree-compiler-api/include/iree-compiler-c/Tools.h b/llvm-external-projects/iree-compiler-api/include/iree-compiler-c/Tools.h
index 49b176f..b073f51 100644
--- a/llvm-external-projects/iree-compiler-api/include/iree-compiler-c/Tools.h
+++ b/llvm-external-projects/iree-compiler-api/include/iree-compiler-c/Tools.h
@@ -13,8 +13,8 @@
extern "C" {
#endif
-/// Runs the IREE compiler main function. This is used to build ireec-like
-/// binaries that link against a common shared library.
+/// Runs the IREE compiler main function. This is used to build
+/// iree-compile-like binaries that link against a common shared library.
MLIR_CAPI_EXPORTED int ireeCompilerRunMain(int argc, char **argv);
/// Runs LLD in "generic" mode (i.e. as `lld`, requiring a -flavor command line
diff --git a/llvm-external-projects/iree-compiler-api/lib/CAPI/CMakeLists.txt b/llvm-external-projects/iree-compiler-api/lib/CAPI/CMakeLists.txt
index 997cffb..7a103fc 100644
--- a/llvm-external-projects/iree-compiler-api/lib/CAPI/CMakeLists.txt
+++ b/llvm-external-projects/iree-compiler-api/lib/CAPI/CMakeLists.txt
@@ -33,6 +33,7 @@
iree::compiler::Pipelines
# Passes and dialects.
+ iree::tools::init_llvmir_translations
iree::tools::init_passes_and_dialects
# All HAL Targets.
diff --git a/llvm-external-projects/iree-compiler-api/lib/CAPI/Compiler.cpp b/llvm-external-projects/iree-compiler-api/lib/CAPI/Compiler.cpp
index 6bf07fc..51aa04e 100644
--- a/llvm-external-projects/iree-compiler-api/lib/CAPI/Compiler.cpp
+++ b/llvm-external-projects/iree-compiler-api/lib/CAPI/Compiler.cpp
@@ -14,6 +14,7 @@
#include "iree/compiler/Pipelines/Pipelines.h"
#include "iree/compiler/Utils/OptionUtils.h"
#include "iree/tools/init_dialects.h"
+#include "iree/tools/init_llvmir_translations.h"
#include "iree/tools/init_passes.h"
#include "iree/tools/init_targets.h"
#include "mlir/CAPI/IR.h"
@@ -63,7 +64,8 @@
void ireeCompilerRegisterAllDialects(MlirContext context) {
DialectRegistry registry;
- registerAllDialects(registry);
+ mlir::iree_compiler::registerAllDialects(registry);
+ mlir::iree_compiler::registerLLVMIRTranslations(registry);
unwrap(context)->appendDialectRegistry(registry);
}
diff --git a/llvm-external-projects/iree-compiler-api/lib/CAPI/Tools.cpp b/llvm-external-projects/iree-compiler-api/lib/CAPI/Tools.cpp
index e3b8416..e54b595 100644
--- a/llvm-external-projects/iree-compiler-api/lib/CAPI/Tools.cpp
+++ b/llvm-external-projects/iree-compiler-api/lib/CAPI/Tools.cpp
@@ -9,5 +9,5 @@
#include "iree/tools/iree_translate_lib.h"
int ireeCompilerRunMain(int argc, char **argv) {
- return mlir::iree_compiler::runIreeTranslateMain(argc, argv);
+ return mlir::iree_compiler::runIreecMain(argc, argv);
}
diff --git a/llvm-external-projects/iree-compiler-api/python/CMakeLists.txt b/llvm-external-projects/iree-compiler-api/python/CMakeLists.txt
index 2571ecf..43e4dd6 100644
--- a/llvm-external-projects/iree-compiler-api/python/CMakeLists.txt
+++ b/llvm-external-projects/iree-compiler-api/python/CMakeLists.txt
@@ -126,10 +126,10 @@
endfunction()
add_iree_compiler_busybox_tool(
- IREECompilerIREECTool
- OUTPUT_NAME ireec
+ IREECompilerIREECompileTool
+ OUTPUT_NAME iree-compile
SRCS
- IREECTool.c
+ IREECompileTool.c
)
if(TARGET lld)
diff --git a/llvm-external-projects/iree-compiler-api/python/IREECTool.c b/llvm-external-projects/iree-compiler-api/python/IREECompileTool.c
similarity index 100%
rename from llvm-external-projects/iree-compiler-api/python/IREECTool.c
rename to llvm-external-projects/iree-compiler-api/python/IREECompileTool.c
diff --git a/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/__init__.py b/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/__init__.py
index ef243e9..21e9e0d 100644
--- a/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/__init__.py
+++ b/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/__init__.py
@@ -7,8 +7,8 @@
R'''
This module contains Python wrappers for various IREE command-line tools.
-This top-level API provides access to the `ireec` tool, which compiles MLIR
-ASM via IREE's compiler to a supported output format (i.e. VM flatbuffer, C
+This top-level API provides access to the `iree-compiler` tool, which compiles
+MLIR ASM via IREE's compiler to a supported output format (i.e. VM flatbuffer, C
source code, etc).
Example
diff --git a/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/binaries.py b/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/binaries.py
index 2d02f18..f5899a5 100644
--- a/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/binaries.py
+++ b/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/binaries.py
@@ -29,19 +29,18 @@
]
_BUILTIN_TOOLS = [
- "ireec",
+ "iree-compile",
"iree-lld",
- "iree-translate",
]
# In normal distribution circumstances, each named tool is associated with
# a python module that provides a `get_tool` function for getting its absolute
# path. This dictionary maps the tool name to the module.
_TOOL_MODULE_MAP = {
- # Note that ireec is builtin, but if not found, it can be resolved
+ # Note that iree-compile is builtin, but if not found, it can be resolved
# in the external 'core' module. This is used for some outside packaging
# options.
- "ireec": "iree.tools.core",
+ "iree-compile": "iree.tools.core",
"iree-lld": "iree.tools.core",
"iree-import-tflite": "iree.tools.tflite",
"iree-import-xla": "iree.tools.xla",
@@ -147,9 +146,6 @@
def _get_builtin_tool(exe_name: str) -> Optional[str]:
- # Transitional note: iree-translate is allowed and resolves to "ireec".
- if exe_name == "iree-translate":
- exe_name = "ireec"
if platform.system() == "Windows":
exe_name = exe_name + ".exe"
this_path = os.path.dirname(__file__)
diff --git a/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/core.py b/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/core.py
index dfb2855..6f23fa5 100644
--- a/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/core.py
+++ b/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/core.py
@@ -171,7 +171,7 @@
Returns:
List of strings of command line.
"""
- iree_translate = find_tool("ireec")
+ iree_translate = find_tool("iree-compile")
if not options.target_backends:
raise ValueError("Expected a non-empty list for 'target_backends'")
diff --git a/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/scripts/ireec/__main__.py b/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/scripts/ireec/__main__.py
index 2ded4b8..bffb786 100644
--- a/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/scripts/ireec/__main__.py
+++ b/llvm-external-projects/iree-compiler-api/python/iree/compiler/tools/scripts/ireec/__main__.py
@@ -13,7 +13,7 @@
def main(args=None):
if args is None:
args = sys.argv[1:]
- exe = binaries.find_tool("ireec")
+ exe = binaries.find_tool("iree-compile")
return subprocess.call(args=[exe] + args)
diff --git a/llvm-external-projects/iree-compiler-api/setup.py b/llvm-external-projects/iree-compiler-api/setup.py
index c1ab146..b884b99 100644
--- a/llvm-external-projects/iree-compiler-api/setup.py
+++ b/llvm-external-projects/iree-compiler-api/setup.py
@@ -212,9 +212,10 @@
],),
entry_points={
"console_scripts": [
+ "iree-compile = iree.compiler.tools.scripts.ireec.__main__:main",
+ # TODO: We have renamed to iree-compile on 2022-03-18. Remove
+ # this alias once no longer needed.
"ireec = iree.compiler.tools.scripts.ireec.__main__:main",
- # Transitional note: iree-translate resolves to ireec.
- "iree-translate = iree.compiler.tools.scripts.ireec.__main__:main",
],
},
install_requires=[
diff --git a/llvm-external-projects/iree-compiler-api/unittests/CAPI/CMakeLists.txt b/llvm-external-projects/iree-compiler-api/unittests/CAPI/CMakeLists.txt
new file mode 100644
index 0000000..5729d14
--- /dev/null
+++ b/llvm-external-projects/iree-compiler-api/unittests/CAPI/CMakeLists.txt
@@ -0,0 +1,20 @@
+################################################################################
+# iree-compiler-api-compile-mhlo-test
+# If there ever become more of these, please convert into a function instead
+# of open coding.
+################################################################################
+
+add_executable(
+ iree-compiler-api-compile-mhlo-test
+ compile-mhlo-test-main.c
+)
+target_link_libraries(iree-compiler-api-compile-mhlo-test
+ PRIVATE
+ IREECompilerAPICompilerCAPI
+ MLIRCAPIIR
+)
+
+add_test(
+ NAME iree-compiler-api-compile-mhlo-test
+ COMMAND iree-compiler-api-compile-mhlo-test
+)
diff --git a/llvm-external-projects/iree-compiler-api/unittests/CAPI/compile-mhlo-test-main.c b/llvm-external-projects/iree-compiler-api/unittests/CAPI/compile-mhlo-test-main.c
new file mode 100644
index 0000000..6f8f95a
--- /dev/null
+++ b/llvm-external-projects/iree-compiler-api/unittests/CAPI/compile-mhlo-test-main.c
@@ -0,0 +1,143 @@
+// Copyright 2022 The IREE Authors
+//
+// Licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// Simple unit test that demonstrates compiling from MHLO using the CAPI.
+// There is room for improvement on the high level APIs, and if some of what
+// is here is extracted into new APIs, please simplify this test accordingly.
+//
+// Originally contributed due to the work of edubart who figured out how to
+// be the first user of the combined MLIR+IREE CAPI:
+// https://github.com/google/iree/pull/8582
+
+#include <iree-compiler-c/Compiler.h>
+#include <iree/base/string_builder.h>
+#include <stdio.h>
+
+static void bytecode_builder_callback(MlirStringRef str, void* userdata) {
+ iree_string_builder_t* builder = (iree_string_builder_t*)userdata;
+ iree_string_builder_append_string(
+ builder, iree_make_string_view(str.data, str.length));
+}
+
+// Compiles MLIR code into VM bytecode for the given target backend.
+static bool iree_compile_mlir_to_bytecode(iree_string_view_t mlir_source,
+ iree_string_view_t target_backend,
+ iree_string_builder_t* out_builder) {
+ // TODO: support customizing compiling flags?
+ // TODO: support enabling different input dialects other than MHLO?
+ // TODO: return IREE status with error information instead of a boolean?
+ // TODO: only call registers once to speedup second calls?
+ // TODO: cache MLIR context, pass manager to speedup second calls?
+
+ // Expects string builder to be initialized.
+ if (out_builder == NULL) {
+ return false;
+ }
+
+ // The IREE source code states that this function should be called before
+ // creating any MLIRContext if one expects all the possible target backends
+ // to be available.
+ ireeCompilerRegisterTargetBackends();
+
+ // Register passes that may be required in the lowering pipeline.
+ ireeCompilerRegisterAllPasses();
+
+ // Create MLIR context.
+ MlirContext context = mlirContextCreate();
+
+ // Register all IREE dialects and dialects it depends on.
+ ireeCompilerRegisterAllDialects(context);
+
+ // Create MLIR module from a chunk of text.
+ MlirModule module = mlirModuleCreateParse(
+ context, mlirStringRefCreate(mlir_source.data, mlir_source.size));
+ if (mlirModuleIsNull(module)) {
+ return false;
+ }
+
+ // Prepare target backend flag.
+ char target_buf[128];
+ iree_string_builder_t target_builder;
+ iree_string_builder_initialize_with_storage(target_buf, sizeof(target_buf),
+ &target_builder);
+ iree_string_builder_append_cstring(&target_builder,
+ "--iree-hal-target-backends=");
+ iree_string_builder_append_string(&target_builder, target_backend);
+
+ // Create compiler options.
+ IreeCompilerOptions options = ireeCompilerOptionsCreate();
+ const char* compiler_flags[] = {iree_string_builder_buffer(&target_builder)};
+ MlirLogicalResult status =
+ ireeCompilerOptionsSetFlags(options, 1, compiler_flags, NULL, NULL);
+ if (mlirLogicalResultIsFailure(status)) {
+ ireeCompilerOptionsDestroy(options);
+ mlirModuleDestroy(module);
+ mlirContextDestroy(context);
+ return false;
+ }
+
+ // Run MLIR pass pipeline to lower the high level MLIR code down to to IREE VM
+ // MLIR code.
+ MlirPassManager pass = mlirPassManagerCreate(context);
+ MlirOpPassManager op_pass = mlirPassManagerGetAsOpPassManager(pass);
+
+ // Enable use of MHLO dialect.
+ ireeCompilerBuildMHLOImportPassPipeline(op_pass);
+ ireeCompilerBuildIREEVMPassPipeline(options, op_pass);
+ status = mlirPassManagerRun(pass, module);
+ if (mlirLogicalResultIsFailure(status)) {
+ mlirPassManagerDestroy(pass);
+ ireeCompilerOptionsDestroy(options);
+ mlirModuleDestroy(module);
+ mlirContextDestroy(context);
+ return false;
+ }
+
+ // Compile MLIR VM code to VM bytecode.
+ status = ireeCompilerTranslateModuletoVMBytecode(
+ options, mlirModuleGetOperation(module), bytecode_builder_callback,
+ out_builder);
+
+ // Cleanups.
+ mlirPassManagerDestroy(pass);
+ ireeCompilerOptionsDestroy(options);
+ mlirModuleDestroy(module);
+ mlirContextDestroy(context);
+ return mlirLogicalResultIsSuccess(status);
+}
+
+int main(int argc, char** argv) {
+ // MLIR code that we will compile
+ iree_string_view_t mlir_code = iree_make_cstring_view(
+ "func @simple_mul(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>) -> "
+ "tensor<4xf32>\n"
+ " {\n"
+ " %0 = \"mhlo.multiply\"(%arg0, %arg1) : "
+ "(tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32>\n"
+ " return %0 : tensor<4xf32>\n"
+ "}\n");
+
+ // Initializes string builder that will contains the output bytecode.
+ iree_string_builder_t bytecode_builder;
+ iree_string_builder_initialize(iree_allocator_system(), &bytecode_builder);
+
+ // Compiles MLIR to VM bytecode.
+ bool status = iree_compile_mlir_to_bytecode(
+ mlir_code, iree_make_cstring_view("dylib"), &bytecode_builder);
+ if (!status) {
+ iree_string_builder_deinitialize(&bytecode_builder);
+ fprintf(stderr, "failed to compiler MLIR code\n");
+ return -1;
+ }
+
+ // For testing purposes, just print the length vs the full contents.
+ iree_string_view_t bytecode = iree_string_builder_view(&bytecode_builder);
+ printf("GENERATED VMFB SIZE: %d\n", (int)bytecode.size);
+
+ // Cleanups.
+ iree_string_builder_deinitialize(&bytecode_builder);
+ return 0;
+}
diff --git a/llvm-external-projects/iree-compiler-api/unittests/CMakeLists.txt b/llvm-external-projects/iree-compiler-api/unittests/CMakeLists.txt
index 1750864..31c231a 100644
--- a/llvm-external-projects/iree-compiler-api/unittests/CMakeLists.txt
+++ b/llvm-external-projects/iree-compiler-api/unittests/CMakeLists.txt
@@ -17,5 +17,6 @@
ENVIRONMENT PYTHONPATH=${IREE_COMPILER_API_BINARY_DIR}/python_package)
endfunction()
+add_subdirectory(CAPI)
add_subdirectory(tools)
add_subdirectory(transforms/ireec)