Repository navigation
onnx EP: the designs for q/k/v and gate/up exist, so the device leg covers 196 of 197 QDQ groups - #848
Conversation
PR Reviewer Guide 🔍(Review updated until commit 5130416)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 e739699e on everything I can run here; the device leg is the lane's and I did not re-run it (the owner's
serve holds the NPU lock, and taking it to prove someone else's number is exactly what the lane rules forbid).
Run here (-DONEBIT_ORT=ON, ORT 1.23.2 from the box's pkg-config, Release/ninja/gcc-16,
ninja onebit_ep_qdq_proof rc 0), the proof with the plugin EP registered and no ONEBIT_EP_NPU_ELFS — so every case
takes the host path and the two new shapes have to be real cases, not decoration:
case quark-wide: 0 of 10240 int8 values differ, worst |d|=0 LSB, path=fused
case quark-o: 0 of 5120 …
case quark-d: 0 of 5120 …
case quark-kv: 0 of 5120 … worst |d|=0 LSB, path=fused <- new
case quark-gu: 0 of 15360 … worst |d|=0 LSB, path=fused <- new
PASS OneBitEp fused the A8W8 QDQ group: worst |d| = 0/0/0/0 LSB (per-tensor, per-axis, asymmetric, asymmetric per-axis), per-K scale refused, peak RSS -7060 kB
and the fused_cases < 10 threshold is met rather than tripped, which is the check that would have caught a case that is
added but never fused.
The arithmetic of "196 of 197" checks out against the model itself: ~/models/npu/Qwen3-0.6B/config.json is 28 layers,
hidden 1024, intermediate 3072, vocab 151936 — so 28 × 7 + 1 = 197 fused groups, the five shapes cover 7 projections per
layer (q 1024×2048, k/v 1024×1024, o 2048×1024, gate/up 1024×3072, down 3072×1024), and the one group left is exactly
lm_head at 1024×151936, which is the one shape that is not a projection. The per-case value counts in the body also
match the run to the digit (10,240 / 5,120 / 15,360).
What I cannot vouch for, and what the docs now say correctly: the five designs running on the array with worst |d| = 0
and device-busy=0, and the absence of npu_qdq_fallback per shape. That needs the NPU lock and the private ELFs; the
discriminator the body names (fallback lines, not qdq rows=) is the right one, and the "M=128 designs, so no tokens/s
claim" limit is stated in the same paragraph as the gate, which is the honest shape.
Two things worth keeping: the aiecc --full-elf-name trap (exits 0, writes nothing; --get-full-elf is the flag) is the
kind of note that saves a day, and "a shape with no design is a build, not a limit" is now documented next to the failure
message it explains. The correction to the old "56 of 197" text is right — that number was the state of the box, not of the
EP.
|
Heads-up on the red and the five other recent
Nothing in |
…overs 196 of 197 QDQ groups The device leg was correctness-only on two projections (o_proj 2048x1024, down_proj 3072x1024) because those were the only designs on the box. That was never a kernel limitation: the shapes are a build, and the iron-venv on this box has the whole MLIR-AIE/Peano/bootgen stack, so n1_core_i8_v26.py emits a design for any (K, N). Two new proof cases pin the shapes that had neither a case nor a design -- quark-kv (5x1024x1024, k_proj/v_proj) and quark-gu (5x1024x3072, gate_proj/up_proj) -- and the fused-case floor goes 8 -> 10. Together with quark-wide (q_proj) that makes all seven projection shapes gated, so a real Qwen3-0.6B A8W8 graph's 196 projection MatMuls can run on the array instead of 56 of 197; only lm_head (1024x151936, its own tiling) keeps the host kernel. Measured on strixhalo under npu-hold with five designs configured: worst |d| = 0 LSB against the CPU EP for 5x2048x1024 (5120 values), 5x3072x1024 (5120), 5x1024x1024 (5120), 5x1024x2048 (10240) and 5x1024x3072 (15360), with no npu_qdq_fallback line for any of those shapes in the trace -- the device ran all five. Still correctness, not speed: these are M=128 designs, so a decode step hands the kernel one real row.
e739699 to
b109af4
Compare
|
Rebased onto The red Case 3 of This PR touches no serve, backend or test-harness code — the fake backend binding a port another job on the runner still holds is a flake, and the re-run is the fix. Gates re-run from scratch on the rebased tree, no Device evidence is unchanged from the body (both tickets, |
|
Persistent review updated to latest commit b109af4 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at b109af4e81 (the main merge; the PR's own file is blob-identical at both heads — onnx/ep/onebit_ep_qdq_proof.cpp is b3c4d649 at e739699e8 and at this head — and no file on the ORT build path changed between them, so the build and the host-path run I reported at e739699e are the same tree this head will merge).
What that evidence was, restated so it is checkable from one place: the ORT lane built at -DONEBIT_ORT=ON with the box's ORT 1.23.2, and onebit_ep_qdq_proof ./libonebit_ep.so with no ONEBIT_EP_NPU_ELFS runs the five quark cases on the host path with the value counts the body quotes (10,240 / 5,120 / 5,120 / 5,120 / 15,360, worst |d| = 0 LSB), and the fused_cases < 10 threshold is met rather than tripped. The 196-of-197 arithmetic is the model's: ~/models/npu/Qwen3-0.6B/config.json is 28 layers, hidden 1024, intermediate 3072, vocab 151936 -> 28x7+1 = 197 groups, and the one left out is lm_head (1024x151936).
CI at this head, for the record rather than as a gate: build and the four Analyze jobs are running at the time of posting, CodeQL success, pr_agent cancelled, hw_gate skipped. The previous red build on this PR was the hybrid_route flake (#850) — the same content passed in the run six minutes earlier, and #851 is the fix for it; if this head's build lands red again on hybrid_route, that is #851's merge, not this PR.
The device leg (five designs on the array, device-busy=0, no npu_qdq_fallback per shape) is still the lane's to run — the owner's serve holds the NPU lock and taking it to prove someone else's number is not what this lane does.
|
Persistent review updated to latest commit 8503055 |
|
CI is green at |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 850305560 (re-verdict after the update-branch; content unchanged)
The PR's own patch at b109af4e (base 906f966a2) and at this head (base 40d963254) is identical — same
80 files, same +/- counts, same patch text — so this is a pure update-branch and the head merges exactly the
tree I verdicted.
Re-run at this head rather than carried: full host build -DONEBIT_ORT=ON rc 0, and
ctest -R "onebit_ep|qdq" -> 5/5 passed (the QDQ proofs incl. _unfused and _qdq_only);
tools/copyright.py --check rc 0.
|
Persistent review updated to latest commit 1d73b80 |
|
Persistent review updated to latest commit 5130416 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 513041652 (re-verdict after the update-branch onto 1f2dfe99f; own patch byte-identical to
1d73b80f1 and 850305560 — 80 files, same patch text)
Rebuilt at this head, not carried: -DONEBIT_ORT=ON full build rc 0, ctest -R "onebit_ep|qdq" -> 5/5 passed;
tools/copyright.py --check rc 0.
What this is
The QDQ device leg was correctness-only on two projections — o_proj (2048×1024) and down_proj
(3072×1024) — because those were the only NPU designs on this box, so a real A8W8 graph could put 56 of
its 197 fused groups on the array. That was recorded (twice, in
TQDQ-STATE.md) as blocked: "no AIEtoolchain on this box, kernels are closed source".
The blocker was a bad search.
~/mlir-aieis indeed empty, but~/amd-oss/iron-venvholds the wholeMLIR-AIE/Peano/bootgen stack (
aieccat mlir-aie20a9c2fb2dc,llvm-aie22.0,mlir_aie1.4.4) and~/Xilinx/2026.1/Vitis/aietoolsis present, so the shape is a build, not a missing capability: theiso-build design generator (
n1_core_i8_v26.py -M 128 -K <K> -N <N> -c 4 -b 5, the family thefull_i8_*xclbins belong to) emits a design for any (K, N) in about a minute.Kernel source is still private and not touched here. This PR is the EP side: two proof cases for the
shapes that had neither a case nor a design, and the docs corrected to what is now measurable.
Measured gate (strixhalo,
npu-hold, two tickets, quiet array)The discriminator is the absence of an
npu_qdq_fallbackline for a shape (qdq rows=is written bythe shared epilogue on both paths, so it proves nothing on its own): zero fallback lines exist for
2048×1024, 3072×1024, 1024×2048, 1024×1024 and 1024×3072 in either run, and
device-busy=0, so all fivedesigns ran on the array and their exact int32 accumulators, taken through the same epilogue the host path
uses, equal the CPU EP's float QDQ path to the byte.
That is 196 of the 197 fused groups a real Qwen3-0.6B A8W8 export has (28 layers × 7 projections +
lm_head), up from 56.
lm_head(1024×151936) keeps the host kernel: it needs a tiling of its own.Still not claimed: tokens/s
These are M=128 designs, so a decode step hands the kernel one real row and 127 zeroed ones. A speed
claim needs m16 variants of the same five shapes — the same generator,
-M 16— and a quiet box. The docssay that in the same paragraph as the gate, because a gate without its limit is a sales claim.
The artifacts (not in this repo)
Q_K1024_N2048/design.elf834b25fc25d6bb847a81b056ddece909KV_K1024_N1024/design.elf9c4ae1860ccfd434f7cf04bb3ae1e7fbGU_K1024_N3072/design.elf5f14afb085492f81aa078a1223df15cdThey live in
~/qdq-elfs/beside the other xclbins, like everyfull_i8_*design; nothing kernel-side iscarried by the engine, per the brief. Build recipe is
~/wt/qdq-elf-build.sh <K> <N> <cols> <M> <outdir>and is described in
docs/onnx.md.Two things learned the hard way and now written down: on this toolchain
aiecc --full-elf-nameexits 0and writes nothing (
--get-full-elfis the flag that emits the ELF), and control-building theknown-good shape (2048×1024, cols=4) gives a structurally identical design, so a pass on a new shape is a
statement about the shape and not about a different recipe.
Files
onnx/ep/onebit_ep_qdq_proof.cpp—quark-kv(5×1024×1024) andquark-gu(5×1024×3072) cases, samegate as
quark-o/quark-d; fused-case floor 8 → 10 so neither can silently stop fusing.docs/onnx-pack.md— the device-leg bullet says what is now measured: five shapes, 5120/5120/5120/10240/15360 values, no fallback for any of them, 196 of 197 groups, and the two limits (an ELF per
(K,N), which is a build; and M=128 → correctness only). The "not where the 1.5x lands" sentence follows.
docs/onnx.md— how a missing shape's design is generated, that the generator and ELFs live in theiso-build tree, and the
--full-elf-name/--get-full-elftrap.Gates
cmake -S onnx -B /tmp/qdq-main(noCMAKE_BUILD_TYPE→ unoptimised, the stricter one): ctest 6/6-DONEBIT_EP_NPU=ONbuilds (/tmp/qdq-npu2) with the private runtime at~/wt/release-rc/work/npu-runtime/engine/npu/npu_rt; its QDQ proof is the device run abovepython3 tools/copyright.py --check→ rc 0 (no new files)npu-hold -l qdqtickets,01793646706221490703.qdqand01793647065708242911.qdq,device-busy=0in both, traces/tmp/onebit_ep_trace.555044.logand/tmp/onebit_ep_trace.582368.log1bit forward-serve -p 18097was not touched and no~/npu.lockwas taken; this PR touchesno NPU kernel source