Skip to content

style: restore rustfmt cleanliness on main - #1089

Merged
justinchuby merged 1 commit into
mainfrom
squad/roy-fmt-main-repair
Aug 16, 2026
Merged

justinchuby merged 1 commit into
mainfrom
squad/roy-fmt-main-repair

Conversation

@justinchuby

Copy link
Copy Markdown
Owner

What

cargo fmt --all -- --check currently fails on origin/main (bce03cabb) in five
places across crates/onnx-runtime-ep-cpu/src/kernels/gemm.rs and
crates/onnx-runtime-ep-cpu/src/kernels/matmul.rs. This is the cargo fmt --all output
and nothing else.

Why it happened

Nobody wrote badly-formatted code. #1073, #1079 and #1080 each touched these two files and
each was fmt-clean against its own base. Squash-merging them produced a combined text that
rustfmt formats differently:

  • TRANSPOSE_TEST_LOCK.lock().unwrap_or_else(|e| e.into_inner()) is 61 characters, which
    exceeds rustfmt's default chain_width of 60 once it sits at test-body indentation (two
    sites).
  • The onnx_runtime_ir import list grew past max_width and now wants braces on their own
    lines.
  • One Gemm/transB attribute chain became short enough to fit on a single line after a
    neighbouring edit.
  • One stray double blank line at end of a mod tests.

main is unprotected, so no required check re-ran fmt on the merge result and the breakage
landed silently.

How it was found

It blocked #1086: that PR's Fast (Linux x86_64) and Rust quality jobs failed on the
PR merge ref with diffs in files #1086 does not touch. Reproduced independently by
checking out origin/main into a clean worktree and running cargo fmt --all -- --check.

Verification

  • cargo fmt --all -- --check -> clean (was: 5 diffs).
  • Diff is whitespace/line-breaking only; git diff -w on the two files is empty apart from
    the import-brace move. No logic, no behaviour, no test changes.

Risk

None. Mechanical formatter output.

`cargo fmt --all -- --check` currently fails on `origin/main` in five places
across `kernels/gemm.rs` and `kernels/matmul.rs`.

Nobody wrote badly-formatted code. #1073, #1079 and #1080 each touched these two
files, and each was fmt-clean against its own base. Squash-merging them produced
a combined text that rustfmt formats differently: `TRANSPOSE_TEST_LOCK.lock()
.unwrap_or_else(...)` is 61 characters and so exceeds the default `chain_width`
of 60 once it sits at test-body indentation, the `onnx_runtime_ir` import list
grew past `max_width`, and one `Gemm`/`transB` chain became short enough to fit
on a single line after a neighbouring edit. `main` is unprotected, so no
required check re-ran fmt on the merge result.

This is `cargo fmt --all` output and nothing else -- no logic changes.

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

codecov Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.80%. Comparing base (bce03ca) to head (904d15e).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
crates/onnx-runtime-ep-cpu/src/kernels/gemm.rs 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main    #1089    +/-   ##
========================================
  Coverage   79.79%   79.80%            
========================================
  Files         369      369            
  Lines      161558   161732   +174     
  Branches   161558   161732   +174     
========================================
+ Hits       128915   129068   +153     
- Misses      27898    27916    +18     
- Partials     4745     4748     +3     
Flag Coverage Δ
cli-ort-linux 83.79% <ø> (ø)
cli-ort-windows ?
mlas 83.28% <ø> (+0.03%) ⬆️
offline 79.60% <71.42%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
crates/onnx-runtime-ep-cpu/src/kernels/matmul.rs 84.16% <100.00%> (-0.04%) ⬇️
crates/onnx-runtime-ep-cpu/src/kernels/gemm.rs 88.80% <66.66%> (+0.06%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

🔴 Benchmark Regression Detected

Comparison of criterion micro-benchmarks: PR head vs merge-base, measured on the same runner in the same job (base first → PR second).

ℹ️ Absolute times are informational only — they vary with runner load. The % change column is the reliable signal because both sides ran under identical conditions.

Status Scenario Base PR Change
🔴 matmul/small_generic_bf16_threads=8/1x256x256 29.91 µs 86.16 µs +188.0%
🔴 matmul/medium_generic_f16_threads=8/32x512x512 33.79 µs 80.36 µs +137.8%
🔴 matmul/small_generic_f16_threads=8/1x256x256 30.73 µs 72.27 µs +135.2%
🔴 matmul/medium_generic_bf16_threads=8/32x512x512 434.75 µs 951.14 µs +118.8%
🔴 matmul/small_generic_f32_threads=8/1x256x256 37.64 µs 75.23 µs +99.9%
🔴 sampling_latency/top_k_per_token 51.88 µs 75.37 µs +45.3%
🔴 gather/large_f32_threads=1-internal/131072 24.32 µs 34.66 µs +42.5%
🔴 matmul/small_generic_bf16_threads=1/1x256x256 32.03 µs 41.81 µs +30.5%
⚠️ matmul/medium_generic_f32_threads=1/32x512x512 2.32 ms 2.96 ms +27.6%
⚠️ sampling_latency/greedy_per_token 3.21 µs 4.04 µs +25.7%
⚠️ sampling_latency/top_p_per_token 383.21 µs 474.42 µs +23.8%
⚠️ matmul/small_generic_f16_threads=1/1x256x256 31.46 µs 37.07 µs +17.8%
⚠️ matmul/medium_generic_bf16_threads=1/32x512x512 566.13 µs 662.84 µs +17.1%
⚠️ tokenization/decode_tokens_per_second 6.86 ms 7.92 ms +15.4%
✅ sampling_latency/min_p_per_token 216.23 µs 248.13 µs +14.8%
✅ qwen3_sampling_processors/top_k_full_sort_baseline 2.25 ms 2.55 ms +13.4%
✅ add/medium_bf16_threads=1-internal/262144 101.12 µs 113.69 µs +12.4%
✅ gather/medium_f32_threads=1-internal/32768 3.73 µs 4.15 µs +11.3%
✅ grammar_masking/llguidance_compute_mask/32 81.65 µs 90.70 µs +11.1%
✅ qwen3_sampling_processors/top_k_top_p_fast 688.67 µs 746.75 µs +8.4%
✅ add/small_bf16_threads=1-internal/1024 433.0 ns 466.1 ns +7.7%
✅ add/medium_f32_threads=1-internal/262144 24.93 µs 26.80 µs +7.5%
✅ add/large_f32_threads=1-internal/4194304 668.14 µs 711.32 µs +6.5%
✅ add/large_f16_threads=1-internal/4194304 1.67 ms 1.76 ms +5.7%
✅ logit_processing/seven_processor_chain_per_step 347.89 µs 367.41 µs +5.6%
✅ matmul/large_generic_bf16_threads=8/32x1024x1024 1.43 ms 1.51 ms +5.3%
✅ matmul/large_generic_f32_threads=1/32x1024x1024 9.69 ms 10.15 ms +4.8%
✅ add/medium_f16_threads=1-internal/262144 105.66 µs 110.44 µs +4.5%
✅ add/small_f16_threads=1-internal/1024 460.5 ns 481.0 ns +4.5%
✅ matmul/medium_generic_f16_threads=1/32x512x512 32.67 µs 34.13 µs +4.5%
✅ kv_cache/alloc_dealloc_pages 41.57 µs 43.32 µs +4.2%
✅ reduce_mean/large_f32_threads=1-internal/262144 980.30 µs 1.02 ms +4.0%
✅ gather/small_f32_threads=1-internal/4096 678.2 ns 698.2 ns +3.0%
✅ gather/small_f16_threads=1-internal/4096 476.1 ns 489.6 ns +2.8%
✅ gather/medium_f16_threads=1-internal/32768 2.50 µs 2.57 µs +2.8%
✅ gather/medium_bf16_threads=1-internal/32768 2.53 µs 2.60 µs +2.7%
✅ reduce_mean/medium_f32_threads=1-internal/65536 254.05 µs 260.37 µs +2.5%
✅ tokenization/encode_tokens_per_second 394.79 µs 404.45 µs +2.4%
✅ qwen3_sampling_processors/top_p_full_sort_after_top_k_baseline 3.98 ms 4.07 ms +2.3%
✅ matmul/medium_generic_f32_threads=8/32x512x512 1.07 ms 1.08 ms +1.5%
✅ matmul/large_generic_bf16_threads=1/32x1024x1024 2.07 ms 2.08 ms +0.4%
✅ qwen3_sampling_processors/top_p_fast_after_top_k 544.82 µs 544.44 µs -0.1%
✅ add/small_f32_threads=1-internal/1024 203.7 ns 203.5 ns -0.1%
✅ qwen3_sampling_processors/top_k_top_p_full_sort_baseline 6.21 ms 6.16 ms -0.7%
✅ matmul/small_generic_f32_threads=1/1x256x256 39.94 µs 39.62 µs -0.8%
✅ gather/small_bf16_threads=1-internal/4096 494.9 ns 488.0 ns -1.4%
✅ add/large_bf16_threads=1-internal/4194304 1.71 ms 1.69 ms -1.5%
✅ reduce_mean/small_f32_threads=1-internal/4096 16.13 µs 15.74 µs -2.5%
✅ matmul/large_generic_f16_threads=1/32x1024x1024 85.95 µs 82.29 µs -4.3%
✅ matmul/large_generic_f16_threads=8/32x1024x1024 92.05 µs 88.12 µs -4.3%
✅ block_quantized_matmul_cached_dense/mxfp4_uncached_dequant_each_call/1x1024x1024 740.92 µs 698.89 µs -5.7%
✅ matmul/large_generic_f32_threads=8/32x1024x1024 4.31 ms 3.98 ms -7.7%
✅ qwen3_sampling_processors/top_k_partial_selection 186.91 µs 161.77 µs -13.5%
✅ gather/large_bf16_threads=1-internal/131072 14.53 µs 12.47 µs -14.2%
🟢 gather/large_f16_threads=1-internal/131072 16.08 µs 12.56 µs -21.9%
🟢 block_quantized_moe_cached_dense/mxfp4_cached_dense_expert_repeated_call/rows=1,H=256,I=256,E=4,top_k=1 228.69 µs 167.24 µs -26.9%
🟢 block_quantized_moe_cached_dense/mxfp4_uncached_expert_dequant_each_call/rows=1,H=256,I=256,E=4,top_k=1 823.65 µs 492.13 µs -40.3%
🟢 block_quantized_matmul_cached_dense/mxfp4_preexpanded_dense_oncelock_like_proxy/1x1024x1024 120.34 µs 61.42 µs -49.0%
🟢 block_quantized_matmul_cached_dense/mxfp4_cached_dense_repeated_call/1x1024x1024 146.92 µs 59.07 µs -59.8%

Visual flags: ⚠️ ≥ 15% slower, 🔴 ≥ 30% slower — calibrated against measured runner noise (~27% worst-case on multi-threaded matmul)

Host info
CPU: Apple M1 (Virtual)
Cores: 3
OS: Darwin 25.5.0 arm64
Rust: rustc 1.97.1 (8bab26f4f 2026-07-14)
Load avg: { 2.53 3.40 4.84 }
What this cannot catch
  • Regressions in code paths not covered by these benchmarks (e.g., end-to-end decode with a real model)
  • Sub-threshold regressions that compound over multiple PRs
  • Performance changes that only manifest under GPU execution
  • Latency changes in the ORT integration path (these benchmarks exercise the native Rust kernels)

@justinchuby
justinchuby marked this pull request as ready for review August 16, 2026 21:16
@justinchuby
justinchuby merged commit 7a29dc7 into main Aug 16, 2026
13 of 17 checks passed
@justinchuby
justinchuby deleted the squad/roy-fmt-main-repair branch August 16, 2026 21:17
justinchuby added a commit that referenced this pull request Aug 17, 2026
`cargo fmt --all -- --check` fails on `main` at 9b7a458 (#1104), in
`crates/onnx-runtime-ep-cpu/src/kernels/matmul_nbits.rs:6239`. Every
open PR's `Rust quality` job therefore fails for a reason unrelated to
the PR.

This is the third time (see #1089, #1102): the merge queue does not
re-run formatting against the merge result, so an individually-green PR
can still land unformatted `main`.

Pure `cargo fmt -p onnx-runtime-ep-cpu` output, two lines, no behaviour
change.

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