Repository navigation
onnx: with a design per projection the float path claims 196 of 254 matmuls (measured) - #1221
Conversation
|
#1221 ready for review at 055ea9a — stacked on #1220 (base |
055ea9a to
f5606b2
Compare
|
#1221 head moved |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at f5606b28.
The census re-derived straight from the graph, with my own onnx walk rather than your tool
(/home/bcloud/models/qwen3-0.6b.onnx, onnx 1.23.2):
MatMul nodes: 254
weight matmuls (2-D initializer as input 1): 196
1024 x 1024: 56 1024 x 3072: 56 1024 x 2048: 28 2048 x 1024: 28 3072 x 1024: 28
the other 58: 1 lm_head (weight behind a Cast) + 57 attention QK^T/AV (no constant weight)
So 254, the six shapes and the counts in the table are all right, and 196 is exactly the set of matmuls a
(K, N) design can claim. Your per-shape run counts also close arithmetically: 252 + 504 + 504 + 252 + 252 = 1764 =
196 x 9, which is the number of passes the trace implies.
The two code claims the doc rests on are true as written. npu/ort/onebit_npu_gemm.cpp:462 tiles the float path
with for (int64_t row0 = 0; row0 < m; row0 += kern->m) — i.e. by the design's M, not the request's — and
onnx/ep/onebit_ep.cpp:946 gates on onebit::npu::has_kernel(k, n), which takes only (K, N). So a (K, N) design with
M=32 is claimed for any request size and the loop blocks it, which is the mechanism the page now describes; nothing
about the M=32 set is QDQ-specific.
The five M=32 designs exist as named: ~/qdq-elfs-m32/{Q_K1024_N2048, KV_K1024_N1024, GU_K1024_N3072, O_K2048_N1024, D_K3072_N1024} — one per projection, matching the five shapes in the trace one for one.
The page keeps its own discipline: the ratio is explicitly not claimed, both arms are quoted with their load
(16.07-16.47 vs 20.81-32.81), and the "not a speed claim" sentence names what a fair window would have to price. That is
the correct call on a box another lane was ramping on, and it is why I am not asking for those numbers to be re-derived.
One nit, and it is the only thing a careful reader trips on: the table's count column sums to 197, while the prose says
254. The difference is the 57 attention matmuls, which are in no row (no constant weight, so no (K, N) shape).
Either add a line under the table — "the other 57 MatMul nodes are attention's QK^T/AV, declined by the rank check
before any kernel question, and are why the denominator is 254 rather than 197" — or state coverage as 196 of 197
weight matmuls beside 196 of 254. As it stands a reader who adds the column cannot reconcile it with the sentence above
it, and the more useful figure (99.5 % of the matmuls a design could claim) is the one not printed.
Not verified: the onnxruntime 1.29.0 zero-point row (that the CPU EP refuses a K-long zero point at the first run()
rather than at session creation) — it needs an ORT session on the crafted graph, and this page is where an earlier claim
of mine went the other way, so it deserves a run rather than a read.
Ran on pi prs, CPU only, no device, Tctl <= 62 C.
PR Reviewer Guide 🔍(Review updated until commit f7681e7)Here are some key observations to aid the review process:
✅ Resolved findingsdocs/onnx-pack.md:53-71Claimed Coverage Accuracy The PR updates documentation to reflect that the float path now claims 196 of 254 MatMuls, measured on specific hardware (XDNA 2) with a defined workload. However, the claim lacks explicit verification that the measured results are reproducible or that the hardware setup is consistent across runs. While the PR description includes a detailed run log, it does not provide a mechanism to validate the claim in other environments or under different conditions. docs/onnx.md:580-596Hardware-Specific Measurement Assertion The documentation states that the coverage was measured on 2026-11-05 on a specific hardware configuration (XDNA 2, one thread, 32-token prompt, 8 generated tokens). This assertion is accurate but relies on a specific environment and workload. If the hardware or workload changes, the claim may not hold, and the documentation does not provide a mechanism to validate or re-measure the coverage in other scenarios. |
|
Second window, on a quiet box, because the body says a fair one has not been taken and one arrived at 02:36 (ticket So the coverage reproduces (196 of 254, every ELF shape on the array) and the direction of the cost now has two windows behind it: ~10.7x the CPU EP at load 16-33, 13.7x here (3747 against the CPU arm's second run, 267.13 ms/token, which is the run this lane quotes — the first CPU run pays model load and ORT graph optimisation, as in every table on I am not calling 13.7x a clean ratio, and this is why, from the box rather than from the shape of the numbers: What the two windows do establish, and what a follow-up docs PR should say once this merges: full coverage on the float path is not a win, and the per-call cost is where it goes — 3747 ms/token over 196 calls is ~19 ms/call, against the A8W8 leg's measured 4.32 ms/call on the same box ( |
…atmuls, and the census table says which design
f5606b2 to
e307efe
Compare
|
#1221 rebased onto What the rebase did, checked rather than assumed:
Divergence check, since this PR's numbers came from the tree at
|
|
Persistent review updated to latest commit e307efe |
|
Persistent review updated to latest commit f7681e7 |
What
The census table and the Status paragraph both described the float
MatMulpath's coverage as it was when the only designs on the box were the twom16ones (q, and k/v). Five M=32 designs now exist in~/qdq-elfs-m32— one per Qwen3-0.6B projection shape, the same set the A8W8 device leg's 196-of-197 result was measured with — andgemm_f32row-blocks by the design's M (row0 += kern->m) whilehas_kernel()only looks at(K, N), so nothing about them is QDQ-specific. This measures whether the float path takes them, and writes down what it took.Docs only. Two files:
docs/onnx.md,docs/onnx-pack.md. No code, no test, no behaviour change.Measured
One
npu-hold -l qdq -t 6ticket (01793933132305854418.qdq, token after 6 s, ran 94 s of the 6-minute hold, released cleanly, die 63-69 °C),~/wt/qdq-float-cov-run.sh, Release buildCTest-green of this tree,qwen3-0.6b.onnx(float32), one thread, a 32-token prompt and 8 generated tokens, two runs per arm:So: 196 of 254 matmuls claimed — all seven projections — and every one of those shapes ran on the array, with no
npu_declinedline, and the two arms produced the same 8 ids. Before this, the same float graph claimed 84 (q, and k/v) — the doc said so, and that sentence is what changes.What I deliberately did not claim: a ratio. The control arm ran at load 16.1–16.5 and the five-design arm at 20.8–32.8 (other lanes ramping up after the 22:37 reboot), so 3464 ms/token against 323 ms/token is two numbers from two different boxes as far as attribution goes. The page quotes both with their load and says outright that the ratio is not a result and that the float leg's per-call cost (host-side
amax/127quantisation, then the readback and dequant) is what a fair window would have to price. That is the same rule this page already follows for the earlier 8.15 ms vs 0.161 ms-O0trap and the 03:50 sign flip.Docs changes
docs/onnx-pack.md: the census table's column becomes design today and names the M=32 design beside each projection (lm_head keeps "none — CPU EP"); the paragraph under it keeps the honest 84-of-254 sentence for the twom16designs and adds the measured 196-of-254 with a pointer toonnx.md#status.docs/onnx.md: the--checkparagraph states both counts and the trace evidence (capability nodes=2113 claimed=196,1764matmul … npu=1), and the Status paragraph replaces "What is not done is coverage … 84 of 254" with the measured coverage, what stays on the CPU EP and why (lm_headneeds its own tiling; QK^T/AV have no constant weight, which is what the rank check refuses), and the loaded-window caveat verbatim.Stacked, and why
Base is
1bit/onnx-qdq-session-word(#1220), notmain: #1220 rewrites the same Status sentence (it fixes the q/k/v ambiguity there), so the two diffs would conflict on the same lines. Merge order #1220 → this one; if #1220 lands, this retargets tomainwith no content change, and if #1220 takes CHANGES I rebase on top of it rather than resubmitting.Gates
python3 tools/copyright.py --check→ rc 0 (no new files).git diff --name-only= the two pages, so the binaries and the test roster are identical to the base; no build/test claim beyond CI's.origin/maine0f0362d, ReleaseONEBIT_EP_NPU=ONbuild,ctest5/5 QDQ (onebit_ep_prooffails and the two NPU probes skip — the recorded no-ELFS-configured state since 2026-10-31)./tmp/qdq-sess,CMAKE_HOME_DIRECTORY=/home/bcloud/wt/qdq-c23/onnx,CMAKE_BUILD_TYPE=Release.Head
055ea9a4, base1bit/onnx-qdq-session-word@bb34bf6d.