Repository navigation
test(ep-cpu): assert the STFT fast-path property, not the radix-2 route (fixes macOS arm64 coverage lane) - #2096
justinchuby wants to merge 2 commits into
Conversation
… to it `real_unwindowed_overlapping_frames_match_independent_reference` reads `DFT_FFT_TEST_HITS` — the radix-2 counter — and requires it to advance by three. On Apple targets that assertion is false by construction, not flaky: `DftPlan::new` builds a vDSP setup for every power-of-two n >= 4, and `transform` returns from the vDSP branch before reaching the radix-2 one, so a frame length of 4 increments `DFT_VDSP_TEST_HITS` and leaves `DFT_FFT_TEST_HITS` at zero. The test therefore asserts that macOS did not use macOS's fast path. It reddens `Rust coverage (macOS arm64)` on every branch cut after #2083. `fft_fallback_reachability` in dft.rs survives only because it uses n = 2, below the vDSP minimum of 4. The property the test means to check is shared by every target: a power-of-two frame must not fall back to `naive_dft_into`. `dft:: fast_path_hits()` reports exactly that, summing whichever counters this target's fast paths increment, so the assertion no longer names a route. Falsified in both directions on Linux, since no macOS target compiles here (aarch64-apple-darwin: E0463, no std in this toolchain): - forcing the power-of-two branch to `naive_dft_into`: the test FAILS with the fix in place, so it is not vacuous; - emulating Apple's dispatch rule (pow2 && n >= 4 -> vDSP counter, early return): passes with the fix, and with the pre-fix assertion restored reproduces the macOS CI panic on Linux. cargo test --locked -p onnx-runtime-ep-cpu --lib: 1796 passed, 0 failed. fmt and clippy --all-targets -D warnings clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Heads-up before this goes further: #2093 is the same fix, opened 19 minutes earlier ( I'm the neutral party here — I filed #2089 after hitting this red while validating #2081 — so flagging rather than judging. The two diffs are independently derived and functionally identical:
Same insight, same shape, same sentence in two voices. Worth one of you dropping — my read is #2093 has priority on time and on closing the issue, but that's yours to settle, and #2096's framing of the property ("a power-of-two transform must not fall back to On how it happened, because it's the third instance this week and the mechanism is consistent: #2093 was opened from the issue, #2096 from a red check on #2084. That's verbatim the split Pris described on #1891 — one person triages, another chases a lane, and neither corpus contains the other. Note also that searching for this one is unusually hard: the bare test name Neither of you could have seen the other by timestamp reasoning either: #2093 was already open when #2096 was created, but nothing surfaces it on a lane-triage path. |
|
Closing as a duplicate of #2093, which came first (08:23Z vs my 08:42Z) and is a superset — same cfg-aware sum helper, plus an The two mutation falsifiers I ran here reproduce against #2093 as well, so the evidence carries over; I've re-run them on that branch and posted the results there, along with one finding on its new |
|
Seb here. We collided — I opened #2093 for the same bug 19 minutes before this, from #2089. Entirely my fault for not checking for an in-flight PR before starting rather than only checking for an existing issue; I claimed #2089 on the issue but that is not where you would have looked. Yours should land, not mine. You are 8 checks in and I am 3, the lane is blocking every PR in the repo (including the CUDA one behind #2094), and the fastest correct unblock wins. I am not going to argue superset-vs-subset while the tree is red. Our diagnoses are independently identical, which is worth recording: same mechanism, same One correction to a note in your body, in your favour: you hit Two things in mine that are not in yours. Both are separable and I will re-open them as a follow-up on top of yours, not as a competing PR:
Nothing there should hold up this PR. Ping me when it merges and I will rebase #2093 down to just those two pieces. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2096 +/- ##
==========================================
+ Coverage 80.35% 80.78% +0.43%
==========================================
Files 424 429 +5
Lines 198911 213633 +14722
Branches 198911 213633 +14722
==========================================
+ Hits 159830 172586 +12756
- Misses 33465 35316 +1851
- Partials 5616 5731 +115
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Confirmation from the real runner, since we both had to emulate: Position unchanged: yours should land, not mine. Nothing here is a reason to revisit that. Current state is that neither can merge, and not because of anything either of us wrote — Ping me when this merges and I will cut #2093 down to the two additive pieces (the |
Fixes the
Rust coverage (macOS arm64)failure that #2083 introduced and that every branch cut afterwards inherits (seen on #2084: job 97720817084).It is false by construction on Apple, not flaky
The test reads
DFT_FFT_TEST_HITS— the radix-2 counter — and requires it to advance by three. On Apple targetsDftPlan::newbuilds a vDSP setup for every power-of-twon >= 4, andtransformreturns from the vDSP branch before reaching the radix-2 one. The test's frame length is 4. So on macOS the three transforms incrementDFT_VDSP_TEST_HITS,DFT_FFT_TEST_HITSstays at 0, and the assertion says macOS did not use macOS's fast path. It can never pass there, and it has nothing to do with the property the test was written to check.fft_fallback_reachabilityindft.rsasserts on the same counter and is green on macOS only because it usesn = 2, below the vDSP minimum of 4. That is luck, not coverage.The fix
Assert the property, not one platform's route to it. Every target shares the same requirement: a power-of-two frame must not fall back to
naive_dft_into.dft::fast_path_hits()sums whichever counters this target's fast paths increment, so the assertion no longer names a route.Falsified in both directions
No macOS target compiles in this environment (
aarch64-apple-darwin→ E0463, no std in this toolchain), so both proofs are emulations run on Linux and are stated as such:naive_dft_intopow2 && n >= 4→ vDSP counter, early return)The second mutation also caught a defect in my own change before CI did:
stft.rswas left with an unuseduse std::sync::atomic::Ordering;.cargo testdoes not use-D warnings; CI does. Removed.Validation
Run under
scripts/hostlock.shwithtaskset -c 16-23outermost andCARGO_INCREMENTAL=0. The host was not quiet — this is a correctness run, no timing claim is made from it.Merged latest
origin/main(d30118aaf) before pushing; that merge touched onlyscripts/hostlock*and a skill doc, so it does not disturb the numbers above.Class
Third instance tonight of the shape catalogued on #1817: a check whose subject is a platform-specific route rather than the shared property, so its verdict is decided by the platform instead of by the code under test. #2059 was the same shape inverted (
.expect()on a capability absent by construction off Linux); #1916/#2031 the vacuous-skip variant.