Skip to content

fix(cpu): signed-integer Neg + Int32 bench inputs (audio-model op coverage) - #115

Merged
justinchuby merged 2 commits into
mainfrom
perf/audio-op-coverage
Jul 24, 2026
Merged

justinchuby merged 2 commits into
mainfrom
perf/audio-op-coverage

Conversation

@justinchuby

Copy link
Copy Markdown
Owner

Native CPU EP op-coverage fixes surfaced by audio models

While bringing up Whisper and Nemotron ASR (Foundry Local) on the native CPU EP, two general, well-scoped correctness/harness gaps surfaced. This PR lands those; the audio models themselves remain blocked on unimplemented com.microsoft::Attention / MHA / LSTM kernels (tracked separately).

Fixes

  1. Signed-integer Neg (onnx-runtime-ep-cpu unary_math): Neg on Int32/Int64 now routes through wrapping_neg (matches ONNX two's-complement overflow semantics, incl. Neg(INT_MIN) == INT_MIN); float path unchanged. Non-vacuous regression test covers the MIN wrap for both widths.
  2. Int32 bench inputs (onnx-genai-bench bench_generic): the generic native-vs-ORT harness can now synthesize Int32 model inputs, so integer-input graphs benchmark and parity-check instead of erroring.

Scope note

A third commit from the audio bring-up (a com.microsoft::MultiHeadAttention shape-inference rule) was rejected in review for mishandling differing value head_size and is being reworked separately — deliberately excluded here.

Review

Non-author review by Hicks: commits 1+2 🟢 APPROVED (the rejection applied only to the excluded MHA commit).

Gates: ep-cpu tests incl. neg_supports_signed_integer_tensors, ep-cpu clippy (mlas), fmt (only pre-existing mlas-sys:1211 artifact) — green. (Pre-existing onnx-genai-engine clippy nits under the bench-native feature are outside CI's path and untouched here.)

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@codecov

codecov Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.49%. Comparing base (7d5ad92) to head (08021ff).

Files with missing lines Patch % Lines
...ates/onnx-runtime-ep-cpu/src/kernels/unary_math.rs 92.68% 0 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #115   +/-   ##
=======================================
  Coverage   82.49%   82.49%           
=======================================
  Files         231      231           
  Lines       99760    99799   +39     
  Branches    99760    99799   +39     
=======================================
+ Hits        82296    82333   +37     
  Misses      14074    14074           
- Partials     3390     3392    +2     
Files with missing lines Coverage Δ
...ates/onnx-runtime-ep-cpu/src/kernels/unary_math.rs 88.93% <92.68%> (+1.23%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

justinchuby added a commit that referenced this pull request Jul 24, 2026
…ws ARM64 flaky (#117)

## Summary
Fixes a Windows ARM64 CI flaky (hard subprocess crash,
`STATUS_ACCESS_VIOLATION` / empty stderr) in the persistent-pool
affinity tests. Same class as #111.

## Root cause
`run_affinity_defer_child` (test harness in `matmul_nbits.rs`)
hard-coded `ONNX_GENAI_CPU_DECODE_THREADS=8` and `RAYON_NUM_THREADS=8`
for its subprocess children. The `forced_off` scenario forces the
persistent SPMD pool, which spins up ~8 busy-waiting SPMD workers (plus
a Rayon pool) **inside an already-spawned child test binary**. On the
low-core native Windows ARM64 runner this oversubscribes CPUs and
hard-aborts the child before it can print — surfacing as
`forced_persistent_pool_ignores_explicit_affinity` failing with
truncated stdout and empty stderr. It intermittently fails any ep-cpu PR
(hit #115 twice in a row).

## Fix
Replace the hard-coded `"8"` with the existing `parity_worker_count()`
helper (largest odd ≤ `available_parallelism()`, capped at 15, always ≥
1) — the exact remedy #111 applied to a sibling test. **Test-harness
only; no product/kernel code changed.**

## Why the test stays meaningful
- `forced_off` still forces the pool (`PERSISTENT_POOL=1`) and still
asserts `pools().is_some()` (`parity_worker_count() ≥ 1` ⇒ a real pool
is built).
- `auto_*` children still set explicit affinity and assert
`pools().is_none()`.
- No `#[ignore]`, no weakened assertion, no OS/arch skip — only the
thread count is bounded to a runner-safe value.

## Sibling tests
Two other forced-pool subprocess tests use small hard-coded counts
(MLAS-shard 3/3, MLAS-prefill 3/6) — below the oversubscription
threshold and not reported flaky; left unchanged to preserve the prefill
test's deliberate `RAYON > workers` row-block invariant.

## Gates (Linux x86_64)
- `cargo test -p onnx-runtime-ep-cpu --features mlas` — 903 pass;
no-mlas pass; clippy clean both; `cargo fmt --check` clean (only known
`mlas-sys:1211` false positive); aarch64 cross-check clean.

Reviewed independently 🟡 APPROVE-WITH-NITS (non-author).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
justinchuby and others added 2 commits July 24, 2026 20:35
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@justinchuby
justinchuby force-pushed the perf/audio-op-coverage branch from 2300f56 to 08021ff Compare July 24, 2026 20:35
@justinchuby
justinchuby merged commit f31c175 into main Jul 24, 2026
10 checks passed
@justinchuby
justinchuby deleted the perf/audio-op-coverage branch July 24, 2026 20:43
justinchuby added a commit that referenced this pull request Jul 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant