Repository navigation
test(xla): qualify the OpenXLA/IREE engine on ROCm/HIP - #2307
Merged
Merged
Conversation
Provision and qualify the `mlxcel-xla` runtime and compiler pipeline on AMD ROCm/HIP (`gfx1151`, Radeon 8060S Graphics) across Phase 0 through Phase 4.
- Add `scripts/iree/setup-rocm.sh` and `Makefile` targets (`iree-rocm`, `iree`, `iree-env`) to build the IREE `3.12.0rc20260721` HIP runtime (`libiree_runtime_unified.a` with `IREE_HAL_DRIVER_HIP=ON`) and install the matching `iree-compile` and `iree-run-module` binaries.
- Extend `build.rs`, `src/lib/mlxcel-xla/build.rs`, and `src/lib/mlxcel-core/build_support/rocm_rpath.rs` to consume `IREE_ROCM_HOME` (`cfg(xla_iree_rocm)`) and emit `DT_RPATH` (`/opt/rocm/lib`) when either `rocm` or `xla_iree_rocm` is active so `dlopen("libamdhip64.so", ...)` succeeds without manual `LD_LIBRARY_PATH`.
- Format full multi-line IREE status details via `iree_status_fprint` in `src/lib/mlxcel-xla/csrc/xla_iree.c` and annotate `[compile]`, `[runtime-init]`, `[module-load]`, and `[weight-upload]` errors with actionable environment-variable remedies.
- Validate `MLXCEL_XLA_ROCM_TARGET` (rejecting unset, empty, comma-separated, or non-`gfx*` targets) and `MLXCEL_XLA_PRECISION` (defaulting `hip` to `f16` and rejecting invalid values) in `src/lib/mlxcel-xla/src/emitter/builder.rs` and `src/lib/mlxcel-xla/src/iree.rs`.
- Generalize `scripts/xla/fusion_spike.sh` for `MLXCEL_XLA_DEVICE=hip` and update `scripts/xla/validate_arch.sh` with ROCm instructions and a Rust `xla_traj_dump` reference fallback when the Python HF oracle venv is unavailable.
- Document the ROCm build, environment variables, and full `gfx1151` qualification report in `docs/benchmark_results/xla_iree_rocm_qualification.md`, `src/lib/mlxcel-xla/README.md`, `docs/installation.md`, and `docs/environment-variables.md`.
Closes #851
…n reports Enforce rustfmt formatting, refine precision environment variable parsing with unit tests, record the explicit support decision in the ROCm qualification report, and add bilingual technical reports for PR #2307. - Fix line wrapping in `src/lib/mlxcel-xla/src/emitter/builder.rs`, `src/lib/mlxcel-xla/src/iree.rs`, and `src/lib/mlxcel-xla/src/phi4_audio.rs` so `cargo fmt --check` passes cleanly. - Trim whitespace in `precision_env_override`, extract pure `resolve_precision_checked_with_override`, and add `resolve_precision_validates_and_defaults` unit test. - Append Section 6 ("Support Decision & Support Boundaries") in `docs/benchmark_results/xla_iree_rocm_qualification.md` declaring the Conditionally Supported verdict and boundaries. - Add bilingual technical reports `TECHNICAL_REPORTS/2307-xla-iree-rocm-qualification-20261014.en.md` and `TECHNICAL_REPORTS/2307-xla-iree-rocm-qualification-20261014.ko.md`.
Member
Author
Implementation Review SummaryIntent
Findings Addressed
Remaining Items
Verification
|
Harden ROCm build support, compile binary discovery, target architecture validation, and shell verification tooling for PR #2307 (issue #851). - Restrict ROCm rpath emission in `rocm_rpath.rs` to Linux target OS so macOS builds avoid unsupported linker flags when `IREE_ROCM_HOME` is set. - Require non-empty trimmed binary path when resolving `MLXCEL_XLA_IREE_COMPILE` from environment variables in `iree.rs`. - Lowercase AMD GPU target architecture in `validate_rocm_target` to handle identifiers like `GFX1151` and add corresponding test coverage. - Add `-f` flag to curl in `scripts/iree/setup-rocm.sh` to fail fast on HTTP download errors. - Ensure temporary oracle file created by `mktemp` in `scripts/xla/validate_arch.sh` is cleaned up on exit when `--oracle` is not supplied.
…al reports Update bilingual technical reports for PR #2307 to document the security, performance, and portability hardening findings: - ROCm rpath target OS gate in `rocm_rpath.rs` protecting non-Linux builds from unsupported linker flags. - Non-empty validation on trimmed `MLXCEL_XLA_IREE_COMPILE` paths in `iree.rs`. - AMD GPU target architecture identifier lowercase normalization in `validate_rocm_target` (`builder.rs`). - Fast-fail curl downloads (`-f`) in `setup-rocm.sh` and temporary oracle cleanup trap in `validate_arch.sh`.
Member
Author
Security and Performance Review SummaryReview ScopePR #2307 qualifies the OpenXLA/IREE execution backend ( Findings Addressed
Verification
|
Member
Author
PR Finalization CompleteSummary
All checks passing. Ready for merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Qualifies the OpenXLA/IREE engine (
--features xla-backend,xla-iree) on AMD ROCm/HIP (MLXCEL_XLA_DEVICE=hip,gfx1151/ AMD Radeon 8060S Graphics, ROCm 7.2.2) across all 5 phases defined in #851.Changes
scripts/iree/setup-rocm.sh,Makefile,build.rs,src/lib/mlxcel-xla/build.rs,src/lib/mlxcel-core/build_support/rocm_rpath.rs): Provision IREE3.12.0rc20260721(dc9601f88654749456c7cee4ae87e13de2654e1e) withIREE_HAL_DRIVER_HIP=ONinto~/.cache/mlxcel/iree-rocm-3.12.0rc20260721, wireIREE_ROCM_HOME+IREE_ROCM_COMPILEinto Cargo andMakefile(make iree-rocm), and emit/opt/rocm/libintoDT_RPATHwhenxla_iree_rocmis active so IREE's dynamicdlopen("libamdhip64.so", ...)works out of the box.iree-run-module --list_drivers(hip),--dump_devices=hip(AMD Radeon 8060S Graphics,gfx1151), and 5/5 bit-exact runs ofadd_f32.vmfb,matmul_f32.vmfb, andmatmul_f16.vmfbonhip.src/lib/mlxcel-xla/csrc/xla_iree.c,src/lib/mlxcel-xla/src/emitter/builder.rs,src/lib/mlxcel-xla/src/iree.rs): Upgraded the C shim to capture full multi-line IREE status tracebacks viairee_status_fprintand emit stage-annotated[compile],[runtime-init],[module-load], and[weight-upload]errors; enforced strict validation onMLXCEL_XLA_ROCM_TARGET(requiring a singlegfx*SKU onhip) andMLXCEL_XLA_PRECISION(defaultinghiptof16and rejecting invalid strings); verifiedmlxcel generateonLlama-3.2-1B-Instruct-4bit(14.22 tok/svs0.42 tok/sCPU, 33.9x) andQwen3-0.6B-4bit(21.05 tok/svs4.78 tok/sCPU, 4.4x).xla_oracle_check(64/64 TOKEN-EXACT PASSacrossf32,f16,bf16, andpackedonLlama-3.2-1B-Instruct-4bit, and64/64onf32andf16forQwen3-0.6B-4bit),xla_batch_benchcontinuous batching (B_max=4at65.80 tok/smean andB_max=8at82.06 tok/smean,100% REFERENCE-EXACT PASS),mlxcel-server/v1/completions(non-streaming and streaming SSE onhip), and a 20-iteration stability smoke loop (20/20identical completions, steady147.8 MiBpost-exit VRAM).scripts/xla/fusion_spike.sh,scripts/xla/validate_arch.sh): Generalizedfusion_spike.shforMLXCEL_XLA_DEVICE=hip(--iree-rocm-target), measured packed int8 dequant onhip(1,209dispatches, 2 unfused dispatches per linear layer,--iree-global-opt-data-tilingfails iniree-ROCMSelectLoweringStrategyPass), and cross-posted the ROCm findings to track(upstream-iree): fused dequant->matmul for the packed int8 bandwidth win #574.docs/benchmark_results/xla_iree_rocm_qualification.md,src/lib/mlxcel-xla/README.md,docs/installation.md,docs/environment-variables.md): Checked in the full qualification report and updated user/crate documentation.Verification
cargo fmt --checkcargo test -p mlxcel-xla --libcargo clippy -p mlxcel-xla --lib --tests -- -D warningsbash scripts/xla/validate_arch.sh --structural-onlygfx1151documented indocs/benchmark_results/xla_iree_rocm_qualification.mdCloses #851