Repository navigation
onnx: exercise down_proj's device design in the QDQ proof (and the docs on the device leg match main) - #731
Conversation
…e docs say the device leg is done Two things #702 left behind, found while answering pi-ortep's question about which designs our |d| = 0 gate actually covers. The proof configured `full_i8_D_K3072_N1024.elf` in every device gate and no case ever used it, so a defect in that design could only have surfaced on a real model run. New case `quark-d`, 5x3072x1024 -- down_proj's own shape, next to the o_proj one that has had a case since the device leg landed: host: case quark-d: 0 of 5120 int8 values differ, worst |d|=0 LSB, path=fused device: case quark-d: 0 of 5120 int8 values differ, worst |d|=0 LSB, path=fused (ONEBIT_EP_NPU_ELFS=128x2048x1024=…O_K2048_N1024.elf,128x3072x1024=…D_K3072_N1024.elf, no `npu_qdq_fallback k=3072 n=1024` in the trace, so the array ran it) The fused-case floor goes 7 -> 8 so the new case cannot silently stop fusing. docs/onnx-pack.md said "Not done: the device leg of the fused path ... runs on the host today", which stopped being true when #702 merged. It is now a "Works" bullet with its measured gate (0 LSB on both shapes, no fallback line) and its two limits: an ELF is needed per (K, N) and only two Qwen3-0.6B projections have one (56 of 197 MatMuls on a real graph run on the array), and it is a correctness result, not a speed one -- the designs are M=128, so a decode step hands the kernel one real row. The two sentences downstream that leaned on the old bullet are corrected the same way. docs/onnx.md gains the paragraph the QDQ device path was missing: `gemm_q8` beside `gemm_f32`, `ONEBIT_EP_NPU_ELFS`, no `packB`/`amax/127`, the shared epilogue, and the fact that `qdq rows=` is written by both paths so the absence of a fallback line is what makes a run a device run.
PR Reviewer Guide 🔍(Review updated until commit 5fb00d1)Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
At 9f7ef749 (docs/onnx-pack.md +40 −10, 3 files). A docs update replacing "Not done: the device leg" with a measured result, and it is written with the limits attached, which is the part I care about most.
Everything it cites exists on main, so the text is describing real machinery rather than intent:
gemm_q8(a, w, y, rows, k, n, epilogue)—onnx/ep/onebit_ep_kernel.cpp:119, called fromonebit_ep.cpp:828;- the device path
onebit::npu::gemm_q8_raw(...)atonebit_ep_kernel.cpp:167and, one line later, thetrace_fallback("npu_qdq_fallback k=%lld n=%lld why=%s")that the new text says is absent for the two shapes — i.e. the claim "the device ran both" is stated in terms of a log line that really is the right discriminator; - the ELF naming convention the doc quotes (
full_i8_O_K2048_N1024.elf) matchesnpu/forward/include/q4qx_pack.h'sfull_i8_<ROLE>_K<K>_N<N>[_m16].elf, andonebit_ep_qdq_proof.cpp:732already refers to that same artifact.
The limits are stated as limits, which is why I am comfortable with the numbers being the author's: "an ELF per (K, N)" and only two of Qwen3-0.6B's projections have one, so "the device share of a real graph is 56 of 197 MatMuls and everything else keeps the host kernel"; and "it is a correctness result so far, not a speed one: the ELFs are M=128 designs, so a decode step hands the kernel one real row and 127 zeroed ones — measure before quoting tokens/s". That last sentence is exactly the caveat that stops this paragraph being quoted as a throughput claim, and the same restraint is applied to the 1.46x/0.67x host numbers below it.
Not verified: worst |d| = 0 LSB over 5120 int8 values for o_proj (5×2048×1024) and down_proj (5×3072×1024) with ONEBIT_EP_NPU_ELFS set under npu-hold. That needs the array, the two ELFs and a window, and the NPU belongs to the owner's serve; it stays the author's measurement, stated with its conditions (both shapes, no fallback line in the trace).
tprs-ready applied.
|
Persistent review updated to latest commit 5fb00d1 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
At 5fb00d1, rebased after the merges ahead of it. The author patch is byte-identical to the head I reviewed (9f7ef749) — patch-id from the merge base is the same before and after — so my review stands without re-reading: only main arrived in the rebase.
Nothing new to verify. Everything in my earlier verdict on this PR applies at this head unchanged, including what I noted as not-verified-by-me there.
Two things #702 left behind. Both came out of pi-ortep's question about which designs the
|d| = 0gate actually covered — the answer was "one", because the down_proj ELF was configured and never exercised.The proof now exercises
full_i8_D_K3072_N1024.elfONEBIT_EP_NPU_ELFShas named that ELF since the first device run, and no case used its shape, so a defect in that design could only have appeared on a real model run. New casequark-d, 5×3072×1024 — down_proj's own shape — beside the o_proj case:The device run is
ONEBIT_EP_NPU_ELFS=128x2048x1024=…/full_i8_O_K2048_N1024.elf,128x3072x1024=…/full_i8_D_K3072_N1024.elfundernpu-hold, and the trace contains nonpu_qdq_fallback k=3072 n=1024— that absence, not thePASS, is what makes it a device result (qdq rows=is written by the shared epilogue on both paths).The fused-case floor goes 7 → 8, so the new case cannot silently stop fusing.
docs/onnx-pack.md: the device leg is not "not done" any moreThe bullet still read "Not done: the device leg of the fused path. The fused node's int8 GEMM runs on the host today." — false since #702 merged. It is now a Works bullet carrying its measured gate (0 LSB on both shapes, no fallback line) and, because a gate without its limits is a sales claim, its two limits:
The two downstream sentences that leaned on the old bullet ("the device leg is where the 1.5x argument lands", "leaves the one documented gap above") are corrected the same way.
docs/onnx.md: the paragraph the QDQ device path was missingBeside the float
gemm_f32description:gemm_q8,ONEBIT_EP_NPU_ELFS, nopackB/amax/127(the int8 bytes already carry the graph's scales), the shared epilogue, and the discriminator above.Gates
cteston the host build 6/6;ONEBIT_EP_NPU=ONbuild compiles;tools/copyright.py --checkrc 0; the device run above was taken throughnpu-holdon a quiet array, with the trace read back. Diff is three files (onnx/ep/onebit_ep_qdq_proof.cpp,docs/onnx-pack.md,docs/onnx.md).