test(xla): validate Phase 4 families on IREE-Metal (macOS)

未关闭
#3,358 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
一周以上
新手友好度
12/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
活跃
技术栈
git, macos, python, rust

调研方向

Start with the Phase 4 probes and gates named in the issue, then read src/lib/mlxcel-xla/src/emitter/builder.rs:166 to see why bf16 is rejected on IREE-Metal. Run the delta-rule probe on metal at f32 and f16 to check the 5e-5 bound, then record each family's gate results and any near-tie divergences in spike/openxla/FINDINGS_ssm.md. Done means all gates pass or divergences are documented, with the ROCm gates still green.

由索引模型根据 Issue 内容生成。

描述

area:architecture area:inference platform:macos priority:low status:ready type:test

Part of #564

Problem / Background

Epic #564 brings SSM / hybrid / recurrent architectures to the OpenXLA/IREE backend. Design record: spike/openxla/SSM_HYBRID_DESIGN.md (written 2026-07-01; most symbol locations it cites have moved, use the ones in this issue, which were re-located on main at 56bfb92a, and re-verify them before editing). The Stage 2a spike-first pattern this follows is in spike/openxla/STAGE2_DESIGN.md and spike/openxla/FINDINGS_phase2a.md.

Phase 4 (delta-rule primitive #3352, Qwen3-Next / Qwen3.5 #3353, Kimi-Linear #3354, RWKV7 #3355, RecurrentGemma #3356) is validated on ROCm. IREE-Metal is a separate lowering target without bf16.

Goal

Every Phase 4 gate passes on metal at f32 and f16.

Scope

  • Delta-rule probe first on metal, then each family's gates on --device metal at MLXCEL_XLA_PRECISION=f32 and =f16, same checkpoints and oracles as on ROCm.
  • Lowering fixes land here and must keep the ROCm gates green.
  • Metal section in spike/openxla/FINDINGS_ssm.md.

Acceptance Criteria

  • Delta probe within 5e-5 on metal at f32, both modes.
  • f32: each family's gates pass on metal.
  • f16: the same; every divergence is a near-tie (top-2 gap below 0.01), listed in FINDINGS_ssm.md.

Host and environment

Host: macOS on Apple Silicon only. bf16 cannot lower on IREE-Metal (src/lib/mlxcel-xla/src/emitter/builder.rs:166), so every gate runs twice, once with MLXCEL_XLA_PRECISION=f32 and once with MLXCEL_XLA_PRECISION=f16. The recurrent scan accumulation stays f32 on the f16 path; f16 runs pass when every divergence from the oracle is a near-tie (top-2 logit gap below 0.01, the epic's tolerance) and f32 runs are exact.

eval "$(scripts/iree/setup-macos.sh --env)"
export MLXCEL_XLA_DEVICE=metal
PY=spike/openxla/.venv/bin/python   # or $MLXCEL_ORACLE_PYTHON
cargo build --release --features xla-iree --bin mlxcel --bin mlxcel-server

Dependencies

Blocked by #3352, #3353, #3354, #3355, #3356. State ABI under test: the generic StateTensorSpec list (all F32) threaded after the optional KV in prefill, held in util.globals for single-sequence decode, and carried at [B, ...] in ragged decode.

Risks

  • f16 drift through matrix-valued delta state at long continuations.

User decisions that apply

  • Metal is a validation unit for macOS only; lowering fixes land in this PR.
  • Downloads are allowed. If spike/openxla/.venv is missing, create it with uv venv --python 3.12 spike/openxla/.venv and install CPU torch and transformers as pinned in spike/openxla/requirements.lock (torch==2.12.1+cpu from the PyTorch CPU wheel index, transformers==5.12.1). Small HF-format checkpoints go into models/hf/<name>; confirm the exact HF repo id on the model page before downloading. Gated-licence models are skipped and reported unless the licence is already accepted on this account.
  • Families whose HF modeling code cannot run on CPU (Kimi-Linear, RWKV7, and Plamo2 if its remote code needs mamba_ssm / causal_conv1d) use mlxcel's own MLX eager model as the oracle, following the pattern of the xla-reference-diagnostics feature examples (Cargo.toml:125, :570-575): run the MLX model greedily at temperature 0 on the same prompt and record its token ids in the oracle_continuation.py JSON format so xla_oracle_check and xla_batch_bench consume it unchanged.
主要语言
Rust
星标
505
派生
81
平均合并
14 小时 2 分钟
30 天内合并 PR
448

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

lablup/mlxcel 的其他 Issue

查看 lablup/mlxcel 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。