Repository navigation
fix(xla): repair the OpenXLA feature compile job after #2819 - #2837
Merged
Merged
Conversation
safetensors 0.8 returns `&str` from `SafeTensors::names()`, so the `name.as_str()` left in the Youtu-VL runtime resolved to the unstable `str_as_str` library feature and broke `cargo check --features cuda,xla-iree`, the first of the OpenXLA job's two steps. `required` is a `BTreeSet<&str>`, so it takes the borrowed name directly.
The second step, `xla-diagnostics`, then failed on four `format!("{:x}", Sha256::digest(..))` sites: sha2 0.11 returns a `hybrid_array::Array` that no longer implements `LowerHex`. Three are reachable in that job (Gemma3n diagnostics, the Molmo diagnostics support module) and one sits behind `xla-reference-diagnostics`, which CI does not compile; all now call the `sha256_hex` helper #2819 added for exactly this reason.
Validation: `cargo check --features cuda,xla-iree --all-targets`, `cargo check --no-default-features --features xla-diagnostics --all-targets`, and `cargo check --features xla-reference-diagnostics --all-targets` against the provisioned IREE runtime on spark-102, all exit 0.
Closes #2820
inureyes
force-pushed
the
fix/issue-2820-safetensors-name-as-str
branch
from
November 2, 2026 16:23
20f0904 to
4488fd4
Compare
This was referenced Nov 2, 2026
This was referenced Nov 23, 2026
inureyes
added a commit
that referenced
this pull request
Nov 24, 2026
## Summary - The Molmo and Gemma3n diagnostic digests were hashed twice since #2837 (`sha256_hex(digest.finalize())`). A new `hex_lower` encodes the finished digest at the three sites, so the pinned values (`0a1bef50...`) match again and none changed. A unit test pins `digest_f32` and `digest_i32` to a single SHA-256. - The Molmo gate now reaches its vision stages and fails 2 of 14: `vision.selected_layer_21` on 4 of 1,181,696 elements (max_abs 2.80) and `vision.selected_layer_14` on 2 elements (max_abs 2.69), identical on local-task and cuda. No tolerance is relaxed. This is tracked separately. - The Gemma3n canonical lib test now clears its checkpoint hashes and reaches its numerics, then fails the pinned prefix-decode top1 (854 pinned, 236798 observed on this GB10). Tracked separately. - `llava_cli_server_check.py`: strips the CLI's leading newline, and expects the server's `usage.prompt_tokens` to be the expanded sequence (743), not the unexpanded prompt (15). Passes on cuda. - Oracle venv: `requirements.lock` gains `torchvision`; the new `requirements-youtu.lock` pins transformers 4.57.1 for the Youtu-VL oracle. Both resolve from a clean venv. - Docs: `xla_qwen25_vl_window_check` needs non-uniform multi-image input. The `mlxcel-xla` `iree` lib tests fail to link under `test-fast` because the IREE runtime link recipe lives only in the root `build.rs`; release links only because fat LTO drops the unreferenced shim calls. The README records this and the working `--release` command. ## Test plan - [x] new unit tests `digest_helpers_hash_the_little_endian_bytes_once` and `hex_lower_encodes_a_finished_digest_without_rehashing` - [x] `llava_cli_server_check.py` on cuda: RESULT PASS - [x] `cargo test --release -p mlxcel-xla --lib --features iree --no-run` links - [x] `cargo fmt --check`, `cargo check --features cuda,xla-iree --all-targets`, `cargo check --no-default-features --features xla-diagnostics --all-targets`, `python3 scripts/insert_apache_header.py --check` - [ ] Molmo v1 gate 14/14: currently 12/14 (see above) - [ ] Gemma3n canonical lib test passes: reaches numerics, fails the pinned top1 Closes #3365
4 of 5 tasks
inureyes
added a commit
that referenced
this pull request
Nov 25, 2026
…3399) ## Summary The XLA Molmo v1 vision graph now rounds to F16 wherever eager MLX stores an F16 tensor for the F16 checkpoint, instead of running the CLIP tower in f32. The `xla_molmo_reference_check` gate passes 14/14 on `local-task` and `cuda` with the `VISION` bound (atol 0.25, rtol 0.05) unchanged. ## Root cause - Not a regression on CUDA. With the gate built at the #870 merge commit (`3ba57b30`, no digest patch needed: the double hash came in with #2837), `vision.selected_layer_21` already fails on this GB10 (4 elements, max_abs 1.56) and layer 14 passes (max_abs 1.59). #870 was qualified with eager on ROCm (`gfx1151`). Intermediate commits were not bisected further once the base itself failed. - Precision contract gap. The failing elements sit in channel 650, the tower's outlier channel (|x| up to about 200), plus channel 363 (the next-largest) in layer 21, at rows 68/117/309 and their duplicate-crop rows 645/694/886: e.g. layer 14 row 117, IREE 41.68 against eager 44.38. That is about 90 F16 steps at that size, so the error builds up across blocks rather than coming from one output rounding. - Rounding points (`emitter/molmo_vision_f16.rs`): dequantized weight; linear product and bias add (two roundings, as `quantized_matmul` then `add`); pixels, patch product and position add; LayerNorm with f32 statistics, F16 normalized value, then `w*n+b` rounded once (the CUDA kernel's half FMA; rounding the product and the sum separately measured worse, layer 21 max_abs 2.81 against 2.50); quick_gelu with the F16 coefficient and three roundings; the attention context; both residual adds. Ablations on `local-task`: dropping any one of linear, attention context, residual, quick_gelu or the pre-tower roundings fails the gate again (2 to 12 elements per stage); dequant was ablated against the two-rounding LayerNorm and also fails without it. - The Molmo operator numeric contract declares F16 output rounding on those operators, so the contract digest and the artifact identity change, and cached Molmo vision artifacts recompile once. Molmo2's contract and graph are unchanged. ## Results (GB10, eager MLX on CUDA) | stage max_abs (failures) | main local-task | fix local-task | fix cuda | |---|---|---|---| | vision.patch_embedding | 1.34e-3 | 4.88e-4 | 4.88e-4 | | vision.selected_layer_21 | 2.80 (8) | 2.50 (0) | 1.81 (0) | | vision.selected_layer_14 | 2.69 (4) | 2.47 (0) | 1.78 (0) | | vision.projector | 0.334 | 0.188 | 0.094 | | prepared.sparse_add_visual_rows | 0.334 | 0.188 | 0.094 | | decoder.prefill_logits | 2.07e-2 | 1.01e-2 | 1.10e-2 | The issue reported identical failures on `cuda` before the fix (layer 21 max_abs 2.80, layer 14 2.69). After the fix the worst selected-layer element is 0.12 inside the bound on `local-task` (it was 0.69 over); the projector went from 0.004 inside the bound to 0.22 inside. `compare_stage` now also prints the first failing elements (index, observed, reference). ## Test plan - [x] `xla_molmo_reference_check`, pinned revision `5c04b3a4`, `test_image.png`: 14/14 on `local-task` and on `cuda` - [x] `mlxcel generate` on molmo-7b-d-0924-4bit, `--image tests/fixtures/test_image.png -n 16 --temp 0`, eager (`MLXCEL_SDPA_DETERMINISTIC=1`) and `MLXCEL_BACKEND=xla MLXCEL_XLA_DEVICE=cuda` without a pinned capacity: identical 16 token ids - [x] `cargo test -p mlxcel-xla --lib -- molmo operator_numeric_contract` (new emitter tests and the updated Molmo pins fail on main), `cargo clippy -p mlxcel-xla --lib --tests -- -D warnings` - [x] `cargo check --features cuda,xla-iree --all-targets`, `cargo check --no-default-features --features xla-diagnostics --all-targets`, `cargo fmt --check`, `python3 scripts/insert_apache_header.py --check` - [ ] ROCm (`hip`) eager and IREE not run: no AMD host here Closes #3390
This was referenced Nov 28, 2026
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
The OpenXLA feature compile job has been red on
mainsince #2819 (the safetensors 0.8 and sha2 0.11 upgrades). It hid two independent breaks, because cargo stops at the first one.SafeTensors::names()returns&strin safetensors 0.8, so thename.as_str()left in the Youtu-VL runtime resolved to the unstablestr_as_strfeature in thecuda,xla-ireestep.hybrid_array::ArraywithoutLowerHex, so fourformat!("{:x}", digest)sites fail in thexla-diagnosticsstep. A fifth copy sits behindxla-reference-diagnostics, which this job does not compile; it is fixed too.Both now use the forms the rest of the crate already uses: a borrowed name for the set lookup, and the existing
sha256_hexhelper for digests.Validation
cargo check --all-targetswithRUSTFLAGS=-D warningsforcuda,xla-iree,xla-diagnostics, andxla-reference-diagnosticsagainst the provisioned IREE runtime on spark-102, all exit 0. CI runs the first two.Closes #2820