Skip to content

Bake iree-compile path into binary at build time#245

Merged
sjain-stanford merged 3 commits intoiree-org:mainfrom
MaheshRavishankar:users/MaheshRavishankar/fixIREECompilePaths
Mar 13, 2026
Merged

Bake iree-compile path into binary at build time#245
sjain-stanford merged 3 commits intoiree-org:mainfrom
MaheshRavishankar:users/MaheshRavishankar/fixIREECompilePaths

Conversation

@MaheshRavishankar
Copy link
Contributor

@MaheshRavishankar MaheshRavishankar commented Mar 13, 2026

Previously, getIreeCompilePath() only checked the
FUSILLI_EXTERNAL_IREE_COMPILE env var at runtime, falling back to
a bare "iree-compile" string that relies on the shell PATH. This
caused test failures (sh: 1: iree-compile: not found) when
iree-compile wasn't on PATH, even though CMake already knew its
location via the FUSILLI_EXTERNAL_IREE_COMPILE cache variable.

This follows the same pattern used for libIREECompiler.so:
IREE_COMPILER_LIB (CMake var) is baked into
FUSILLI_DEFAULT_IREE_COMPILER_LIB (compile definition) so the
binary can find the library at runtime without LD_LIBRARY_PATH.

Now iree-compile gets the same treatment:

  • CMake bakes the resolved path into FUSILLI_DEFAULT_IREE_COMPILE
    via target_compile_definitions
  • getIreeCompilePath() checks: env var > compile definition > PATH

The lookup precedence for both tools is now:

Tool Env var (runtime override) Compile definition (build-time default)
libIREECompiler FUSILLI_EXTERNAL_IREE_COMPILER_LIB FUSILLI_DEFAULT_IREE_COMPILER_LIB
iree-compile FUSILLI_EXTERNAL_IREE_COMPILE FUSILLI_DEFAULT_IREE_COMPILE

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Previously, `getIreeCompilePath()` only checked the
`FUSILLI_EXTERNAL_IREE_COMPILE` env var at runtime, falling back to
a bare `"iree-compile"` string that relies on the shell PATH. This
caused test failures (`sh: 1: iree-compile: not found`) when
iree-compile wasn't on PATH, even though CMake already knew its
location via the `FUSILLI_EXTERNAL_IREE_COMPILE` cache variable.

This follows the same pattern used for `libIREECompiler.so`:
`IREE_COMPILER_LIB` (CMake var) is baked into
`FUSILLI_DEFAULT_IREE_COMPILER_LIB` (compile definition) so the
binary can find the library at runtime without LD_LIBRARY_PATH.

Now `iree-compile` gets the same treatment:
- CMake bakes the resolved path into `FUSILLI_DEFAULT_IREE_COMPILE`
  via `target_compile_definitions`
- `getIreeCompilePath()` checks: env var > compile definition > PATH

The lookup precedence for both tools is now:

| Tool              | Env var (runtime override)          | Compile definition (build-time default)  |
|-------------------|-------------------------------------|------------------------------------------|
| libIREECompiler   | FUSILLI_EXTERNAL_IREE_COMPILER_LIB  | FUSILLI_DEFAULT_IREE_COMPILER_LIB        |
| iree-compile      | FUSILLI_EXTERNAL_IREE_COMPILE       | FUSILLI_DEFAULT_IREE_COMPILE             |

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com>
@MaheshRavishankar MaheshRavishankar force-pushed the users/MaheshRavishankar/fixIREECompilePaths branch from 1d43b2f to fa1383d Compare March 13, 2026 04:51
Copy link
Member

@sjain-stanford sjain-stanford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It mirrors what we do for libIREECompiler.so (just for PATH instead of LD_LIBRARY_PATH) so LGTM.

@sjain-stanford sjain-stanford merged commit 421f36c into iree-org:main Mar 13, 2026
10 of 12 checks passed
@MaheshRavishankar MaheshRavishankar deleted the users/MaheshRavishankar/fixIREECompilePaths branch March 13, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants