Repository navigation
fix: make the Gemma3n xla-diagnostics probe pass on CUDA - #2810
Merged
Merged
Conversation
inureyes
marked this pull request as ready for review
November 1, 2026 05:51
…e stage could run on a real checkpoint (issue #2808, both failures recorded in the PR #2801 body). The weight-carrier check pinned MLX CPU dequant semantics while the probe executes MLX on GPU, so every 4-bit weight failed with about 51% 1-ulp mismatches and the probe never reached the stages; the AltUp chain, once reachable, drifted by f32 reduction noise that a strict bit comparison cannot tell from a formula error. The weight carrier is now built with the rounding the default device applies: dequantize_affine_bf16_single_round matches MLX's GPU mx.dequantize (q * scale + bias in f32, one round to BF16; verified bit-exact for the pinned E2B checkpoint, 4194304/4194304, and synthetic wide-magnitude weights), while the CPU path keeps dequantize_affine_bf16_sequential. The strict comparison itself is unchanged and still rejects any wrong scale, bias, group layout, or nibble order, which move carriers far beyond one ulp. The AltUp coefficient chain now compares under the #932 per-op rule with the measured noise recorded: coefficients at max_abs 1e-4 (measured 1.514e-5 prediction / 5.603e-6 correction), and the bf16 stages that consume them at max_abs 3.2e-3 plus two bf16 ulps at the operand's binade, the measured shapes of the compiled TF32 reduction noise (absolute 1.5e-4 on near-zero values, three ulps mid-binade, one ulp at [2, 8)). The layer0_sparse_* stages and manual_vs_compiled keep their bit-exact comparison and reported 0 mismatches in the final probe run. Closes #2808
inureyes
force-pushed
the
fix/issue-2808-gemma3n-probe-cuda
branch
from
November 1, 2026 06:30
5bb90d5 to
5849bcf
Compare
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
pinned_e2b_real_projection_qmv_probeaborted on CUDA before any sparse stage could run on a real checkpoint (issue fix: make the Gemma3n xla-diagnostics probe pass on CUDA past the weight-carrier and AltUp stages #2808, both failures recorded in the PR fix: align Gemma3n gelu_topk bf16 rounding across eager, XLA and mlx-lm #2801 body). The weight-carrier check pinned MLX CPU dequant semantics while the probe executes MLX on GPU: every 4-bit weight failed with about 51% 1-ulp mismatches, and the probe never reached the sparse stages. The AltUp chain, once reachable, drifted by f32 reduction noise that a strict bit comparison cannot tell from a formula error.dequantize_affine_bf16_single_roundmatches MLX's GPUmx.dequantize(q * scale + biasin f32, one round to BF16; verified bit-exact for the pinned E2B checkpoint, 4194304/4194304, and synthetic wide-magnitude weights), while the CPU path keepsdequantize_affine_bf16_sequential. The strict comparison itself is unchanged and still rejects any wrong scale, bias, group layout, or nibble order, which move carriers far beyond one ulp.Test plan
pinned_e2b_real_projection_qmv_probe(--features xla-diagnostics, IREE CUDA tree~/.cache/mlxcel/iree-cuda-3.12.0rc20260721,GEMMA3N_MODEL_DIR=models/gemma3n-e2b-4bit, GB10 undergpu-lock,--test-threads=1): runs to completion,test result: ok. 1 passedin 22.45slayer0_sparse_*stage andlayer0_sparse_activation_manual_vs_compiledstill reports bit_mismatches=0 (the fix: align Gemma3n gelu_topk bf16 rounding across eager, XLA and mlx-lm #2801 result is not weakened)Closes #2808