This directory contains command-line tools that developers add to their PATH for convenient access across all IREE worktrees. Tools here provide streamlined workflows for building, testing, and experimenting with IREE.
Naming convention: All tools must be prefixed with iree- to avoid PATH conflicts. Do not use names that conflict with existing IREE tools (e.g., don't name something iree-run-module or iree-compile).
Add this directory to your PATH:
export PATH="$PATH:$PWD/build_tools/bin"
Or add to your shell configuration for persistence.
Wrapper tools for building IREE with Bazel. These handle configuration, provide better defaults, and work from any subdirectory within a worktree.
For complete Bazel build documentation, see: Building with Bazel
# Configure once per worktree iree-bazel-configure # Build iree-bazel-build //tools:iree-compile # Test iree-bazel-test //runtime/src/iree/base:status_test # Run iree-bazel-run //tools:iree-compile -- --help
Tip: Working with Claude Code?
All
iree-bazel-*tools provide machine-readable documentation via--agent_md:# Generate documentation for Claude iree-bazel-configure --agent_md >> CLAUDE.local.mdThis appends concise tool documentation to your local Claude instructions, teaching Claude how to use the
iree-bazel-*tools in your project.
| Tool | Description |
|---|---|
iree-bazel-configure | Configure IREE for Bazel builds (run once per worktree) |
iree-bazel-build | Build targets |
iree-bazel-test | Run tests |
iree-bazel-run | Build and run executables from current directory |
iree-bazel-query | Query the build graph |
iree-bazel-cquery | Configuration-aware query (resolved select(), actual targets) |
iree-bazel-try | Compile and run C/C++ snippets without BUILD files |
iree-bazel-fuzz | Run libFuzzer targets with persistent corpus |
iree-bazel-lib | Shared library (sourced by other tools) |
All tools support:
-h, --help - Show help-n, --dry_run - Show command without executing-v, --verbose - Verbose outputShort flags can be combined: -nv is equivalent to -n -v.
Driver configuration happens during iree-bazel-configure:
# Enable CUDA driver IREE_HAL_DRIVER_CUDA=ON iree-bazel-configure # Enable multiple drivers IREE_HAL_DRIVER_CUDA=ON IREE_HAL_DRIVER_VULKAN=ON iree-bazel-configure
Built artifacts are placed in standard Bazel output directories at the repo root:
bazel-bin/ - Built executables and librariesbazel-testlogs/ - Test outputs and logsbazel-out/ - Full build treeSeveral tools support watch mode (-w) which rebuilds/reruns on file changes:
iree-bazel-build -w //tools:iree-opt # Rebuild on changes iree-bazel-test -w //runtime/...:test # Rerun tests on changes iree-bazel-run -w //tools:iree-opt -- input.mlir # Restart on changes
Watch mode requires ibazel.
Compile and run C/C++ snippets against IREE without writing BUILD files:
# Quick API exploration iree-bazel-try -e ' #include "iree/base/api.h" #include <stdio.h> int main() { printf("ok: %d\n", iree_status_is_ok(iree_ok_status())); return 0; }' # Run tests iree-bazel-try -e ' #include "iree/testing/gtest_harness.h" TEST(Status, Ok) { IREE_EXPECT_OK(iree_ok_status()); } ' # MLIR transforms echo 'func.func @f() { return }' | iree-bazel-try -e ' #include "iree/compiler/Tools/MlirTransformHarness.h" void xform(ModuleOp m) { m.walk([](Operation *op) { llvm::outs() << op->getName() << "\n"; }); } MLIR_TRANSFORM_MAIN_NO_PRINT(xform) '
Run iree-bazel-try --help for full documentation.