Repository navigation
tools: a container with no Q8 tiles no longer claims the Q8 code order was verified - #1045
Conversation
…order was checked
--against printed its success line ("...and the Q8 tiles hold the code order
npu/q4nx.cpp decodes") whenever the chunk-layout check passed, including for a
container with no Q8 tensor at all: the per-file line said "nothing to check"
and the closing line said the code order had been verified. The closing line now
depends on whether any Q8 tile was actually decoded and correlated, and says
plainly that no code order was checked when none was. Self-test gains a row that
drives main() on a no-Q8 container and fails if the claim comes back.
PR Reviewer Guide 🔍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 66336de7 — my nit on #1037 is closed, and the fix is keyed on the right thing (compared, not args.against).
Re-ran the three container cases on this box, plus the self-test:
# container with no Q8 tiles, --against passed
$ tools/check_q4nx_dir.py ~/models/npu/Qwen3-0.6B --against ~/models/zyphra-zr1/ZR1-1.5B-bf16.gguf
...: no Q8 tensors, nothing to check against the source weights
chunk layout verified; no Q8 tile was decoded, so no code order was checked against the source weights (rc 0)
# the misleading line is gone; the Q8 container is unchanged
$ tools/check_q4nx_dir.py ~/models/npu/ZR1-1.5B-npu-q4km-q8 --against ~/models/zyphra-zr1/ZR1-1.5B-bf16.gguf
A corr +0.9998 / B corr +0.0011 ... chunk layout verified, and the Q8 tiles hold the code order npu/q4nx.cpp decodes (rc 0)
# wrong source weights still refuse
$ tools/check_q4nx_dir.py ~/models/npu/ZR1-1.5B-npu-q4km-q8 --against ~/models/Qwen3-0.6B-Q4_K_M.gguf
FAIL ... not the layout npu/q4nx.cpp decodes ... chunk layout NOT verified (rc 1)
$ tools/check_q4nx_dir.py --self-test # passes, and the new row fails if the claim reappears
$ tools/copyright.py --check # rc 0
The self-test row is a real test rather than an assertion about the string: it drives main() on a synthetic no-Q8 container with --against, so it exercises the compared == 0 branch through the same control flow the tool uses.
One nit, pre-existing and not from this PR: --against a path that is not a GGUF dies with a raw traceback (ValueError: GGUF magic invalid from gguf_reader) instead of a one-line message, rc 1 either way. Worth a try around the reader the next time this file is open; not a blocker.
Follow-up to the review nit on #1037 (pi-prs: "the no-Q8 case still prints the 'Q8 tiles hold the code order' sentence").
Root cause
main()closed withi.e. the closing verdict was keyed on
--againstbeing passed, not on anything having been compared.check_q8_layout()returns([], [])for a container with no Q8 tensor (it prints "no Q8 tensors, nothing tocheck against the source weights" per file), so a Q4-only container exited 0 with a line claiming a code-order
verification that never happened — the same class of silent-success the previous commit in #1037 was about, one
level up in the control flow.
Fix
Count the Q8 tensors that were actually decoded and correlated (
compared += len(rows)over all files) and keythe closing line on that:
chunk layout verified, and the Q8 tiles hold the code order …chunk layout NOT verified, rc 1chunk layout verified, and the Q8 tiles hold the code order …, rc 0chunk layout verified; no Q8 tile was decoded, so no code order was checked against the source weights, rc 0--againstThe default path and the JSON summary are untouched.
Checked
tools/check_q4nx_dir.py ~/models/npu/Qwen3-0.6B --against …/ZR1-1.5B-bf16.gguf(no Q8 tensor)…/ZR1-1.5B-npu-q4km-q8 --against …/ZR1-1.5B-bf16.ggufA corr +0.9998, success line unchanged--againstQwen3-0.6B's GGUFchunk layout NOT verifiedtools/check_q4nx_dir.py --self-testmain()on a synthetic no-Q8 container and fails if the claim reappearstests/gguf_to_q4nx_test.py(the existing CI step)tools/copyright.py --checkNo issue to close: this is the review nit from #1037 (merged at
2fad106f), not a separate defect report.