Skip to content

build: reproducible IREE runtime toolchain via make targets (#571) - #576

Merged
inureyes merged 1 commit into
mainfrom
build/571-iree-make-targets
Jul 1, 2026
Merged

inureyes merged 1 commit into
mainfrom
build/571-iree-make-targets

Conversation

@inureyes

@inureyes inureyes commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Part of the OpenXLA low-precision performance epic (#570). Wraps the source-built IREE runtime setup (scripts/iree/setup-cuda.sh, scripts/iree/setup-macos.sh) in idempotent make targets so the measurement environment for the rest of the epic is reproducible from a fresh checkout rather than a local uncommitted artifact.

What changed

  • Makefile targets. make iree auto-detects the host (CUDA on Linux, Metal on macOS) and dispatches to make iree-cuda / make iree-metal, which run the validated setup scripts. make iree-env prints the resolved paths, pinned IREE version, and HAL drivers. All are idempotent: the scripts reuse an existing clone / build / venv, so re-running does not rebuild when the pinned artifact is present. A dedicated "IREE Backend Targets" group is added to make help.
  • Reproducibility fix (both scripts). A runtime-only IREE configure at the pinned revision (e4a3b04) needs the benchmark and printf submodules: the top-level CMake pulls third_party/benchmark in under IREE_ENABLE_THREADING (on for the local-task driver) and third_party/printf under the runtime gates, neither gated by IREE_BUILD_*. The previous flatcc-only init therefore failed a fresh build at the configure/generate step. Both scripts now initialize every submodule except the heavy compiler-only ones (llvm-project, stablehlo, torch-mlir), which a runtime-only build (IREE_BUILD_COMPILER=OFF) never configures. The benchmark sentinel also self-heals an older flatcc-only clone.
  • --info mode. Each script gains a read-only --info that prints the resolved paths, pinned version, and HAL drivers (surfaced by make iree-env); the eval-safe --env output is unchanged.
  • README. The mlxcel-xla CUDA and macOS build sections now reference make iree instead of the ad-hoc clone / cmake / script invocation.

Validation (GB10, CUDA)

  • make iree-env prints backend, home, iree-compile, CUDA root, pinned version, and HAL drivers.
  • Reproducible from a clean source tree: removing the cloned src/ + build/ and running make iree-cuda re-clones, initializes flatcc + benchmark + printf, configures, and rebuilds libiree_runtime_unified.a (exit 0).
  • cargo build --release --features xla-iree links the freshly built runtime.
  • Token-exact on the GPU: greedy generation on Llama-3.2-1B (4-bit) is byte-identical between cuda f16 (default) and cuda f32 (48/48 tokens); f16 6.8 tok/s vs f32 4.85 tok/s.

Notes

  • The Metal targets (make iree-metal) follow the same CMake gates and pass bash -n, but are not validatable on this Linux host; Metal validation belongs to a macOS session (tracked under feat: extend the fused low-precision path to the Metal target #575).
  • Orthogonal observation (not addressed here): on the source-built CUDA runtime, MLXCEL_XLA_DEVICE=local-task reports "no driver 'local-task' registered" even though the driver is compiled in (libiree_hal_drivers_local_task_task_driver.a). This is a shim/runtime-registration behavior independent of this change and may warrant a follow-up.

Closes #571
Part of #570

Wrap scripts/iree/setup-{cuda,macos}.sh in idempotent `make iree`,
`iree-cuda`, `iree-metal`, and `iree-env` targets so the OpenXLA
measurement environment builds reproducibly from a fresh checkout
instead of a local uncommitted artifact.

Fix a reproducibility bug in both setup scripts: a runtime-only IREE
configure at the pinned revision needs the benchmark and printf
submodules (pulled in by the threading / runtime CMake gates, not the
IREE_BUILD_* flags), so the previous flatcc-only init failed a fresh
build at the configure/generate step. Initialize every submodule except
the heavy compiler-only ones (llvm-project, stablehlo, torch-mlir),
which a runtime-only build (IREE_BUILD_COMPILER=OFF) never configures.
The benchmark sentinel also self-heals an older flatcc-only clone.

Add a read-only `--info` mode to each script (resolved paths, pinned
version, HAL drivers) surfaced by `make iree-env`, and point the
mlxcel-xla README CUDA / macOS build sections at `make iree`.

Validated on GB10 (CUDA): a clean src re-clone plus `make iree-cuda`
rebuilds libiree_runtime_unified.a, `cargo build --release --features
xla-iree` links it, and greedy generation is token-exact between f16 and
f32 (48/48). The Metal targets follow the same CMake gates but are not
validatable on this Linux host.

Part of #570
@inureyes inureyes added type:chore Maintenance tasks (build, CI, etc.) priority:high High priority area:inference Generation, sampling, decoding (incl. speculative, DRY) status:review Under review labels Jul 1, 2026
@inureyes
inureyes merged commit 2baf6b1 into main Jul 1, 2026
5 checks passed
@inureyes
inureyes deleted the build/571-iree-make-targets branch July 1, 2026 08:34
@inureyes inureyes added status:done Completed and removed status:review Under review labels Jul 1, 2026
@inureyes inureyes self-assigned this Aug 31, 2026
be-free-snowboy pushed a commit to freestylejs/snowbrain-mlxcel that referenced this pull request Oct 27, 2026
Wrap scripts/iree/setup-{cuda,macos}.sh in idempotent `make iree`,
`iree-cuda`, `iree-metal`, and `iree-env` targets so the OpenXLA
measurement environment builds reproducibly from a fresh checkout
instead of a local uncommitted artifact.

Fix a reproducibility bug in both setup scripts: a runtime-only IREE
configure at the pinned revision needs the benchmark and printf
submodules (pulled in by the threading / runtime CMake gates, not the
IREE_BUILD_* flags), so the previous flatcc-only init failed a fresh
build at the configure/generate step. Initialize every submodule except
the heavy compiler-only ones (llvm-project, stablehlo, torch-mlir),
which a runtime-only build (IREE_BUILD_COMPILER=OFF) never configures.
The benchmark sentinel also self-heals an older flatcc-only clone.

Add a read-only `--info` mode to each script (resolved paths, pinned
version, HAL drivers) surfaced by `make iree-env`, and point the
mlxcel-xla README CUDA / macOS build sections at `make iree`.

Validated on GB10 (CUDA): a clean src re-clone plus `make iree-cuda`
rebuilds libiree_runtime_unified.a, `cargo build --release --features
xla-iree` links it, and greedy generation is token-exact between f16 and
f32 (48/48). The Metal targets follow the same CMake gates but are not
validatable on this Linux host.

Part of lablup#570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:inference Generation, sampling, decoding (incl. speculative, DRY) priority:high High priority status:done Completed type:chore Maintenance tasks (build, CI, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: Makefile targets to source-build the IREE runtime (CUDA + Metal)

1 participant