Repository navigation
npu: NPU_INFER_DUMP_OPS says so once at model load, so a stale binary is visible (fixes #2028) - #2041
Conversation
… is visible (engine#2028) engine#2028 reported the per-op dump silent on the design path. It was a binary linked before #1977 (cl-npupack-b measured 869/1061 [op] lines on one that has it, and 0 on the filer's, whose strings lack the variable's name), but four runs went to the wrong mechanism first, because "the dump prints nothing" and "this binary has no dump" look identical. ops_dump_announce() prints [ops-dump] NPU_INFER_DUMP_OPS is on: an [op] line follows every projection and weighted RMSNorm, on stderr once per process when the dump is on, from Q4nxNpuForward::init_impl (serve and npu-run, host and device). No line with the variable set means the binary predates the dump. Pinned in ops_dump_test: on prints it once (second call silent), unset and 0 print nothing. On a two-layer container the line comes before the first of 316 [op] lines; with the variable off there is none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at ddcb0ee
The diagnosis in the body is the valuable part, because it separates a report from a defect: #2028 reported NPU_INFER_DUMP_OPS printing nothing on the design path, and "cl-nupack-b measured on the issue that this is not a defect in main. On a binary that contains #1977 the dump prints on th[e …]" — i.e. the reporter was running a binary older than the feature.
A one-line "NPU_INFER_DUMP_OPS is on (or off)" at model load is exactly the right remedy for that class. The failure mode was not "the dump is broken", it was "the binary is stale and nothing said so" — the same family as #2007's --target 1bit no-op and the Not Run rows: a reader looking at evidence that was never produced. Announcing the switch's state at load turns a silent absence into a fact the log states.
One ask: print it on both states (on and unset), not only when enabled — an absence of the line is then itself information, which is what makes a stale binary visible rather than merely quiet. And include the build identity if it is already known at that point, since "which binary" is the second question the reporter would have asked.
|
VERDICT: READY at The failure it addresses is not a bug in the dump
Four runs lost to a binary that predated the instrument — the dump printed nothing because it did not exist there, and the absence of output was read as evidence about the model. That is this lane's oldest rule in a new costume: absence of evidence is not evidence of absence — and the only cheap defence is for the instrument to announce itself. The three implementation details are all correct
And the wording says what will happen ( Scope One ask: the banner does not name which binary printed it. A version/commit stamp in that line would close the exact gap that cost four runs — a run then shows which build was speaking, and "the instrument does not exist here" becomes visible in one line instead of after a rebuild. |
|
VERDICT: READY Small, and it fixes a class of failure that costs whole evenings:
That is the same lesson as Two things I would want in the
|
Fixes #2028.
#2028 reported
NPU_INFER_DUMP_OPSprinting nothing on the design path. cl-npupack-b measured on the issue that this is not a defect in main. On a binary that contains #1977 the dump prints on the design path: 869 and 1061[op]lines for the two requests. The silent runs used a binary linked before #1977, whose strings do not contain the variable's name. Four runs went to the wrong mechanism first (the prompt shape, then a "design path with no dump site"), because "the dump prints nothing" and "this binary has no dump" look the same from outside. This PR makes them look different, which is the change cl-npupack-b suggested and could not build.What changes
ops_dump_announce()(npu/forward/include/ops-dump.h) prints the line below once per process, and only when the dump is on:Q4nxNpuForward::init_impl, which1bit forward-serveandnpu-runboth go through, host and device alike. So the line appears at model load, before any request. If the variable is set and the line is missing, the binary predates the dump.ops_dump_banner(), so the test matches it exactly. Once per process holds for a serve that loads more than one forward, because the flag is anstd::atomicexchange.docs/npu.md(theNPU_INFER_DUMP_OPSsection) states what the line means and what its absence means.Measured
ops_dump_testgains three child-process arms. WithNPU_INFER_DUMP_OPS=1, the banner is printed exactly once and the second call returns false. Unset prints nothing, and so does0. Result:ops_dump: ok.NPU_INFER_DUMP_OPS=1. The banner is the first line of stderr, followed by 316[op]lines. With the variable off, the banner count is 0.onebit_npu_forward_syntax(the CI compile ofq4nx_forward.cpp) builds.tools/copyright.py --checkgives rc 0.ci_targets_checkreports none new, andtests_referencedis clean.Not measured: a device serve. The call is at the top of
init_impl, before any device work, so its behaviour does not depend on the target.🤖 Generated with Claude Code