Repository navigation
cpu compare narrows Python floats; 0-dim tensors follow c10 promotion (#93, stacked on #83) - #94
Merged
Merged
Conversation
…l; cpu min/max signed zero (#49) - amax on Metal: max_keepdim, then the first index equal to it (or the first NaN) and a gather, so all -inf rows answer -inf and NaN propagates. - compare ops off the cpu keep their common dtype instead of widening to f64 (candle has no Metal F32->F64 cast); scalars narrow to the operand's dtype as upstream does. to(bool) on mps uses ne(0) in its own dtype. - cpu min()/max() return upstream's zero sign (-0 for min, +0 for max when present); min.dim/max.dim keep the first equal element. - golden: opt-in signed_zero cases and a zero-sign fault mode. - randn/normal_ on mps already compute on the device; a test pins it. Red before: amax all -inf gave -FLT_MAX; eq.Tensor raised Metal to_dtype F32 F64; min([0,-0,0,-0]) gave 0.0. Nullified: each of the three fixes removed turns its test red.
…#49) PR #83's x86_64 CI: upstream's max() zero sign differs from the shim's there, so the signed-zero case fails clean and flipping the shim's zero lands on upstream's answer, read as a MISS of zero-sign. A corruption of a case that already fails says nothing about the comparator; the golden run reports the failing case itself. Here (arm64) zero-sign is still CAUGHT and the self-test PASSes.
…r no longer outranks a dimensioned one in promotion (#93) Measured on upstream torch 2.13.0 cpu: - float32/float16/bfloat16([0.1]) == 0.1 is True: the scalar is narrowed to the tensor's dtype first (c10 rounding for half types); 65520 -> inf in f16. The cpu compare_scalar widened both to f64 and answered False. - float32[2] + tensor(0.1, float64) is float32 (c10 ResultTypeState: within a category the dimensioned operand wins); the shim promoted to float64, for every binary op. promote_operands now applies combine_categories when exactly one operand is 0-dim. Tests: golden comparison cases at deciding values (60 failed before, 0 after: 12265/12265); tests/ops/test_cmpscalar.py (5) incl. a 64-row dim x 0-dim promotion table re-asked of upstream live. Nullified: disabling the 0-dim rule turns 10 of 64 rows and the 0-dim compare test red. Complex rows are not exercised (aten.ones cannot build complex here). Gate (worktree): suites=125/125 ok=2021 FAIL=2, both worktree environment.
Contributor
Gate on CI (issue #24)Full gate: 127 suites = 119 run on at least one CI runner + 8 local-only. The local gate (
Local-only: verified by no CI runner (8)
Suites that verified nothing, or failed, on a runner
Every suite, every runner
A SKIP is unverified on that runner, never passed. UNVERIFIED means the suite ran and every one of its tests skipped by name. |
2 tasks
b-re-w
added a commit
that referenced
this pull request
Oct 16, 2026
Conflicts in aten.rs with #94 (#93): - promote_operands: kept #80's result_type_of (dimensioned > 0-d > wrapped number, c10 ResultTypeState), which covers #94's narrower dim-vs-0-d combine_categories; that second combine_categories is removed (it also clashed by name with #80's). - compare_scalar: kept develop's narrowing (#83 device path, #93 cpu path with the default-float case for integral tensors), which #94's golden cases and test_cmpscalar pin. Rebuilt: test_promote0d, test_cmpscalar, test_mpsextreme, test_x86pins ok; golden 12363/12363; self-test PASS.
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.
Closes #93. Stacked on #83 (#49): merge it first.
Defect fixed
eq/ne/lt/le/gt/gewith a Python float: narrowed to the tensor dtype as upstream (float32([0.1]) == 0.1True; f16 65520 == inf).float32[2] + tensor(0.1, float64)is float32 upstream, was float64 here. c10combine_categoriesapplied when exactly one operand is 0-dim.Test added: golden comparison cases at deciding values;
tests/ops/test_cmpscalar.py(5), incl. a 64-row dim x 0-dim promotion table re-checked against live upstream.Evidence (local, worktree): golden 60 failed before -> 12265/12265 after. Nullifying the 0-dim rule: 10 of 64 promotion rows and the 0-dim compare test red. Gate: suites=125/125 ok=2021 FAIL=2 (worktree environment only).
Not exercised: the complex branch of combine_categories (
aten.onescannot build complex tensors here).