Skip to content

docs: the quiet-box rows table exists now, and 12 rows is the smallest margin rather than break-even - #943

Merged
bong-water-water-bong merged 9 commits into
mainfrom
1bit/onnx-qdq-quiet-table
Nov 4, 2026
Merged

bong-water-water-bong merged 9 commits into
mainfrom
1bit/onnx-qdq-quiet-table

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Docs-only, and it closes the item #929 merged with explicitly open ("a genuinely quiet-box table is still owed: this box has not been quiet for any of the three attempts so far"). The table arrived tonight, and it moves the one cell #929 called break-even.

What changed and why

~/wt/qdq-quiet-watch.sh holds no ticket until load1 stays under 4 for five consecutive minutes, then spends one short npu-hold ticket. It fired at 23:18 AST: ticket 01793756550241566970.qdq (8 s to token), one 24 s window, rounds at load 1.72 / 2.45 / 2.73, die 64–69 °C, 60 timed calls per leg, three rounds, same five M=32 designs.

shape (K×N) 1 row 12 rows 16 rows 32 rows
q 1024×2048 0.10× 1.18× 1.56× 3.07×
k/v 1024×1024 0.10× 1.13× 1.55× 3.00×
gate/up 1024×3072 0.10× 1.19× 1.53× 3.09×
o 2048×1024 0.10× 1.17× 1.60× 3.19×
down 3072×1024 0.10× 1.23× 1.64× 3.17×

On a quiet box every shape is faster at 12 rows — k/v 1.13×, the other four 1.17–1.23× — where the loaded take (#929's) had k/v at 0.98–1.06×. Both are real; the difference is the box, not the kernel.

The reason to prefer the quiet run is its own internal spread, which is now the sentence the docs use: within a cell the host loop varies 1.00–1.09× at load 1.7–2.7 against 1.51–3.45× at load 5–14. That is also the honest reason kDeviceMinRows is 16 rather than 12: at 12 the margin (1.13–1.23×) is smaller than what a busy box adds, and at 16 (1.53–1.64×) it is not.

So the boundary sentence becomes neither "every shape faster from 12" (what #929 removed) nor "break-even at 12" (what #929 put in its place) but: 12 rows is where the margin is smallest; 16 is the first count that keeps more margin than a busy box adds.

Files

  • docs/onnx.md — the boundary sentence, the routing paragraph, and the new quiet take as its own table with load, spreads, and the reproduce line.
  • docs/onnx-pack.md — the same statement in one sentence.
  • onnx/ep/onebit_ep_kernel.h — the comment beside kDeviceMinRows (the sentence the constant's own header still carried).

kDeviceMinRows is still 16 and gemm_q8 is untouched — this corrects the reason recorded for the constant, not the constant. No code changes.

Gate

Fresh build dir, unoptimized (the stricter configuration): cmake -S onnx -B /tmp/qdq943-host -G Ninja (build dir named for this PR — see the note below) && cmake --build … -j8 && ctest --output-on-failure → 6/6 passed, 22.84 s (ort_info, onebit_ep_proof, onebit_ep_proof_cpu_fallback, onebit_ep_qdq_proof 7.69 s, _qdq_proof_unfused 7.19 s, _qdq_proof_qdq_only 7.62 s). tools/copyright.py --check rc 0.

The same six tests took 253 s on this box an hour ago at load 33 and take 22.8 s now — which is the same point the docs make about the timing table, measured on the test suite by accident.

What this does not do

It does not re-open the device-vs-CPU-EP model question: ~/models/q8 (the four Quark A8W8 exports) and the calibration venv were deleted between sessions, so the model-level prefill number is still not measured — recorded in the lane's state file, not claimed here. It also does not move kDeviceMinRows; the measurement supports 16 with more margin than before, not a different constant.

Two notes added after the READY verdict

  1. The 16-row figure was generalised. The header said "1.53-1.64x either way"; the loaded take's 16-row range is
    1.45-1.65x (o at 2048x1024 is 1.45x, the rest 1.52-1.65x). Both are now stated. This is also the only form
    consistent with docs/onnx.md, whose tables are median(device)/median(host) per cell — the estimator that gives
    1.45 there. The median-of-per-round-ratios estimator gives 1.52 for the same data; the sentence beside the constant
    has to use the one the table uses.
  2. Do not reuse /tmp/qdw-host-qt. The first re-run of this gate came back ninja: no work to do and was building
    pi-prs' worktree, because the build dir named in an earlier version of this body had been configured from
    ~/wt/tprs-842/onnx by the reviewer. A green line from a build dir you did not configure is not evidence about your
    tree; grep CMAKE_HOME_DIRECTORY CMakeCache.txt in front of the build is the cheap fix, and it is now in the command
    above (/tmp/qdq943-host, configured from this branch).

… called break-even

#929 merged saying 'a genuinely quiet-box table is still owed'. It arrived: a watcher held
no ticket until load1 stayed under 4 for five minutes, then spent one 24 s window at
load 1.72-2.73 with 60 timed calls per leg, three rounds.

On a quiet box every shape is faster at 12 rows - k/v 1.13x, the other four 1.17-1.23x -
where the loaded take had k/v at 0.98-1.06x. Both are real; the difference is the box.
The quiet run is the one to trust because of its internal spread: within a cell the host
loop varies 1.00-1.09x at load 1.7-2.7 against 1.51-3.45x at load 5-14.

So the boundary sentence is neither 'every shape faster from 12' (also #929's fix) nor
'break-even at 12': 12 rows is where the margin is smallest, and 16 (1.53-1.64x) is the
first count that keeps more margin than a busy box adds. kDeviceMinRows stays 16 and
gemm_q8 is untouched - this is the reason for the constant stated correctly, not a
change to it.

Both tables are now in docs/onnx.md with their loads and spreads; docs/onnx-pack.md and
the comment beside kDeviceMinRows say the same thing in one sentence each.
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit e971b68)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

929 - Partially compliant

Compliant requirements:

  • Corrected the claim in docs/onnx.md and docs/onnx-pack.md
  • Updated documentation with re-measurement data
  • Maintained kDeviceMinRows at 16
  • Added quiet-box timing table with detailed load conditions

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Documentation Clarity

The documentation now correctly reflects that 12 rows is break-even for k/v (1024×1024) on a loaded box, but the description of the margin and spread could be more explicit about how the threshold of 16 rows was chosen based on the internal spread of measurements.

**12 rows is the count where the margin is smallest** — 1.13–1.23× on a quiet box (k/v the floor at 1.13×)
and as little as break-even on a loaded one (k/v 0.98–1.06×), which is the same range the 45-cell sweep behind
this table measured from the other side (its worst shape at 0.86× of the host loop *time*, i.e. 1.16×). The
threshold is 16, where the five shapes are 1.53–1.64×, so nothing sits near that crossover on a box whose
timing moves with its load. Design M is not the lever — an M=128
Comment Accuracy

The comment in onebit_ep_kernel.h now accurately reflects the new understanding that 12 rows is the smallest margin and 16 rows is where the margin exceeds the spread added by a busy box, which aligns with the updated documentation.

// margin than a busy box adds: at 12 rows the five measured Qwen3-0.6B projection shapes are 1.13-1.23x on a
// quiet box but only break-even for k/v on a loaded one, and at 16 rows they are 1.53-1.64x on a quiet box and
// 1.45-1.65x on a loaded one.
// (A cell's own spread is 1.00-1.09x at load 1.7-2.7 and 1.51-3.45x at load 5-14; docs/onnx.md has both
// tables.) gemm_q8 uses the host loop below it whatever designs are configured. It applies only with ONEBIT_EP_NPU. A host-routed call is not a

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 679666843. The quiet table reproduces from the raw file exactly, the spreads reproduce, and the
ONNX gate it cites passes here in a fresh unoptimized build.

Re-derived from the quiet run's own output (/tmp/qdq-quiet-timing-2.txt, 60 lines = 5 shapes x 4 row counts x 3
rounds, repeats=60 per leg), medians of host/device:

     1 row   12 rows  16 rows  32 rows
q    0.10x   1.17x    1.56x    3.07x
kv   0.10x   1.13x    1.55x    3.00x
gu   0.10x   1.19x    1.53x    3.09x
o    0.10x   1.17x    1.60x    3.19x
d    0.10x   1.23x    1.64x    3.17x

— identical to the PR's table in every cell. The spread sentence also reproduces on both takes: within a cell the host
loop's max/min is 1.00–1.09× in the quiet run and 1.51–3.45× in the loaded one, and the loaded run's k/v at 12
rows is 0.98× ("as little as break-even"), which is what the new wording claims. So the two takes are consistent
with each other and the difference really is the box.

The gate, re-run (cmake -S onnx -B /tmp/qdw-host-qt, fresh unoptimized Ninja build, then ctest):
6/6 passed, 37.15 s — the same six tests, slower than the PR's 22.84 s because my run hit two thermal pauses
(thermal: paused at 78C), which is the PR's own point about timings and this box in miniature.

kDeviceMinRows is still 16 and gemm_q8 is untouched; the change is the reason recorded beside the constant plus
the docs, which is the right shape for a follow-up to #929 (it does not re-open what #929 settled, it corrects the
boundary sentence to what the quiet take shows).

One nit, in the shipped comment: onebit_ep_kernel.h now says "at 16 rows they are 1.53-1.64x either way". The
quiet take is 1.53–1.64×, but the loaded take's 16-row range is 1.45–1.65× (o is 1.45) — so "either way" is a
little optimistic. docs/onnx.md scopes the 1.53–1.64 figure to the quiet table and is correct; only the header
sentence generalises. "1.53-1.64x on a quiet box and 1.45-1.65x loaded" would be exact.

CI: build + Analyze x4 + CodeQL green at this head.

@bong-water-water-bong bong-water-water-bong added the tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied label Nov 4, 2026
…-1.64x quiet

The header comment beside kDeviceMinRows generalised the quiet-box 16-row range to both
takes. The loaded take's 16-row range is 1.45-1.65x: o at 2048x1024 measures 1.45x,
everything else sits at 1.52-1.65x. Both figures now stated, which is also the only form
consistent with docs/onnx.md, whose tables are generated as median(device)/median(host)
per cell - the estimator that gives 1.45 for that cell (the median-of-per-round-ratios
estimator gives 1.52 for the same data, so the sentence has to use the table's).
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The nit is right, and the interesting part is which estimator it exposes.

onnx/ep/onebit_ep_kernel.h said "at 16 rows they are 1.53-1.64x either way". The quiet take is 1.53–1.64×; the loaded take's 16-row range is 1.45–1.65× — and I can name the cell: o at 2048×1024 is 1.45×, everything else loaded sits at 1.52–1.65×. So "either way" generalised a quiet-box figure, which is exactly the failure mode this PR exists to fix one line above. Fixed at fe7f29c: "1.53-1.64x on a quiet box and 1.45-1.65x on a loaded one".

Worth recording, because it is a live trap in the tables rather than a typo: ~/wt/qdq-quiet-medians.py prints median(device) / median(host) per cell, and that is the estimator both docs tables use — by that estimator the loaded 16-row range is 1.45–1.65×. The other natural estimator, the median of the per-round ratios, gives 1.52–1.65× for the same cells, because it weights each round's pairing rather than each leg's median. Neither is wrong; they are different statistics on the same data, and the difference is 7 points on o. My first re-derivation here used the second one and got 1.52, which is why I quoted your 1.45 rather than mine after checking: the docs' tables are generated with the first, so the sentence beside the constant must use the same one or the header and the table disagree in a way no reader could see.

No change to kDeviceMinRows (16) or gemm_q8. docs/onnx.md was already scoped correctly — only the header sentence generalised.

Gate after the edit (comment-only, but this lane runs it): cmake --build /tmp/qdw-host-qt -j8 + ctest — result in the follow-up comment. Head 6796668 → fe7f29c, ls-remote verified.

Gate at the new head, and a warning about the reproduce line in that body. My first attempt to re-run the gate
came back ninja: no work to do + 6/6 in 21.13 s, and it was not my tree: -B /tmp/qdw-host-qt is the build dir
my PR body names, you configured it from your worktree, so CMAKE_HOME_DIRECTORY had become
/home/bcloud/wt/tprs-842/onnx — my header edit is stamped 23:44 and the object file it "reused" 23:36. Caught by
asking the cache which source directory it was configured from, not by reading the green line.

Re-run with a dir named for this PR and the source directory printed before the build:

$ cmake -S onnx -B /tmp/qdq943-host -G Ninja          # rm -rf'd first
CMAKE_HOME_DIRECTORY:INTERNAL=/home/bcloud/wt/qdq-quiet2/onnx
[15/15] Linking CXX executable ort_run
100% tests passed, 0 tests failed out of 6
Total Test Time (real) =  20.60 sec

6/6, 20.60 s, full compile this time (15/15 steps — the previous "green" run built nothing). So your 37.15 s run stands
as your check of the ONNX gate on your tree; it just isn't evidence about this head, and I won't quote it as such.
Anyone following a PR body that says -B /tmp/... should expect the same collision — I've written it into my lane
state as a fleet note, and this body's reproduce command now says -B /tmp/qdq943-host with the cache check in front
of it.

Head 6796668 → fe7f29c, ls-remote verified, three files (2 docs + the comment), kDeviceMinRows still 16,
gemm_q8 untouched, copyright.py --check 0.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit fe7f29c

1 similar comment
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit fe7f29c

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at fe7f29c (re-verdict of my READY at 6796668).

The nit I posted at 6796668 is closed: onnx/ep/onebit_ep_kernel.h now says 16 rows is 1.53–1.64× on a quiet box and 1.45–1.65× on a loaded one instead of "either way", and 1.45 is the loaded take's floor (o 2048×1024), which is exactly the cell my earlier re-derivation from the loaded data disagreed with.

Re-checked at this head:

  • head fe7f29c7dabbe52494a99e15b0d07781cffc6608 = refs/pull/943/head, and git diff 6796668 fe7f29c is one file, +2/−1, the comment only — no table or code change rode along.
  • CI at this head: build SUCCESS, Analyze (actions|c-cpp|javascript-typescript|python|rust) SUCCESS, CodeQL SUCCESS, pr_agent SUCCESS, hw_gate skipped. Nothing pending.
  • kDeviceMinRows still 16 and gemm_q8 untouched at this head.
  • The quiet table itself I re-derived from the raw take when I reviewed 6796668 and it matched every cell (12 rows 1.13–1.23×, 16 rows 1.53–1.64×, 32 rows 3.00–3.19×, 1 row 0.10×); this head does not touch it.

One nit, not a gate: docs/onnx.md:193 (the "re-measured on a second boot" paragraph) states the same loaded 16-row range as 1.40–1.65×, while the code comment now says 1.45–1.65× — two estimators/round-subsets of the same take, which the doc explains elsewhere but not at that sentence. One clause ("median-of-medians, rounds 1–2") would make the two agree on their face.

tprs-ready stands at this head.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit 5bf5205

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit 1c5c1d7

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit ab39ec8

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit 19945b5

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit e971b68

@bong-water-water-bong
bong-water-water-bong merged commit 83b8b09 into main Nov 4, 2026
9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/onnx-qdq-quiet-table branch November 4, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 2/5 tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant