You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sort/argsort/topk: index order among tied values differs from upstream #33
Found by #13. sort returns the same values as upstream, but the order of indices among exactly tied values differs. Top-p sampling sorts probabilities, so at the boundary a tie decides whether a token is in the nucleus. This changes which tokens can be sampled, not just display order.
Done when
Measure upstream's cpu tie order for sort (stable=False and stable=True, ascending and descending, along every dim, f32/bf16/int), and for topk and argsort.
Our cpu kernels reproduce it exactly, as golden cases with tie-heavy inputs (all-equal, two-valued, ±0.0, NaN).
Nullified (replace with an unstable sort and see red). Gate green.
Activity
golden self-test: _tie_order_check is blind to permute-all off libc++…
Merge pull request #82 from thisisthepy/feat/sort-ties
b-re-w commentedon Oct 16, 2026
Landed in develop via #82 (libc++ platforms); Linux/Windows order tracked in #81 (#92).
Merge origin/develop into feat/mps-index