Repository navigation
test(models): measure and falsify the #2852 default-device lead - #2866
Merged
Merged
Conversation
The single #2852 miss never reproduced. The last unmeasured candidate was a process-global MLX default device left on the CPU by an earlier test, which would move the quantized gather off the backend where the 1e-3 bound was measured. Forcing the default device to the CPU for the whole case, the nvfp4 quantize and the f32 dequantize reference included, measures 5.7e-6 max absolute error at 40 tokens against 7.6e-6 on the GPU, and the arm after the CPU span reproduces the GPU baseline exactly. The lead is falsified, so no leaked device can produce the observed miss. The new test pins the device independence so a future CPU-path divergence fails there. The failure message now also reports the out-of-bound and non-finite element counts, the default device, and the GPU backend. The 1e-3 bound and both arms are unchanged. Refs #2852
inureyes
marked this pull request as ready for review
November 6, 2026 01:48
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
Test-only change. The last unmeasured candidate for the single #2852 miss, a process-global MLX default device left on the CPU by an earlier test, is measured and falsified. The failure message now also names the device, the backend, and how many elements actually missed the bound.
What changed
src/models/nemotron_h_tests.rs: newnemotron_h_nvfp4_experts_parity_is_independent_of_the_default_deviceruns both routing arms on the ambient device, again with the default device forced to the CPU, and again after the CPU span is restored. At 40 tokens the CPU arm's max absolute error is 5.7e-6 against 7.6e-6 on the GPU, and the restored arm reproduces the GPU baseline's measured errors exactly, so neither the device nor a cross-device cache explains the miss.run_nvfp4_expert_armsandExpertParityError::measure, so the parity assertion and the device test share one definition and the message can reportmax_abs,max_rel, out-of-bound count, non-finite count, default device, and GPU backend.Test plan
cargo test --profile test-fast --features metal,accelerate -p mlxcel --lib models::nemotron_h::tests:: -- --test-threads=1cargo test --profile test-fast --features metal,accelerate -p mlxcel --lib -- --test-threads=1)cargo fmt --all -- --checkcargo clippy --profile test-fast --features metal,accelerate -p mlxcel --lib --tests -- -D warningsThe issue stays open: no leaking global was demonstrated, so there is no failing-first regression test for the numeric miss itself. This PR closes the default-device lead with a measurement and leaves the diagnostic in place for the next occurrence.
Refs #2852