Skip to content

serve: say when a build links no private NPU route (engine#3193) - #3236

Merged
bong-water-water-bong merged 1 commit into
mainfrom
ross/npu-serve-speed
Nov 21, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
ross/npu-serve-speed

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

A build configured without -DONEBIT_NPU_PRIVATE serves FastFlowLM's Qwen3 packs on the per-op forward, while release builds serve them on the private route. The load log only said "serving it through the per-op forward", so a measurement of such a build was read as the release path's (engine#3193). When no private route is linked, serve now prints one more line naming the missing configure option; behaviour is unchanged.

Checked on the NPU with two builds of this commit: without the add-on the line prints, with it the private route is taken and the line does not print. Both answer the same.

🤖 Generated with Claude Code

…forward is chosen (engine#3193)

engine#3193 measured `1bit serve --device npu` on FastFlowLM/Qwen3-0.6B-NPU2 through Lemonade with a
binary configured without -DONEBIT_NPU_PRIVATE. Such a build serves the pack on the per-op forward,
which a release build (scripts/weekly.sh links the add-on) does not do for this pack. The log said
"serving it through the per-op forward" and nothing about the build, so the number was read as the
shipped path's. The load log now adds one line naming the missing add-on when no private route is
linked. Behaviour is unchanged.

Checked: one npu-hold ticket (srcversion 5682285F370899D14A057FF, 0 new IO_PAGE_FAULT/TDR), `1bit serve
-m <FastFlowLM/Qwen3-0.6B-NPU2 snapshot> --device npu` with two builds of this commit: configured without
the add-on it serves on the per-op forward and prints the new line; with the add-on it takes the private
route and does not. Both answer "The capital of France is **Paris**".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Build Configuration Clarity

The change adds a log message to indicate when a build is configured without the private NPU route. This helps distinguish between release and debug builds when measuring performance, as the log previously only indicated "per-op forward" without specifying the build configuration. The added message clarifies that the build does not include private route support, which is important for accurate benchmarking.

// engine#3193: without the private add-on, the packs a release build serves on its private route (dense
// Qwen3 of a shipped shape) reach this line, and the log said only "per-op forward" -- so a measurement
// of such a build read as the release's speed. Say which build it is.
if (!npu::private_routes_available())
    std::fprintf(stderr,
                 "1bit serve: this build links no private NPU route (-DONEBIT_NPU_PRIVATE, "
                 "docs/releases.md \"Private components\"): a pack a release build serves on one is "
                 "served here on the per-op forward instead\n");

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at ecb137d: READY — the line prints only where the release build would take a private route, and I checked the two ways this could have been wrong rather than taking the body's word.

What I verified in the tree

  • It compiles: npu::private_routes_available() is declared in npu/private_route.h, which app/serve.cpp does not include directly — but it includes unified.h (:94), and unified.h:35 includes private_route.h. That was the first thing I checked, because a missing declaration here is a build break in a file nobody builds on a lane box.
  • The predicate is the build-level fact the message claims: private_routes_available() is !routes().empty() || !commands().empty() (npu/private_route.cpp:110), and routes()/commands() are process-global vectors populated by the add-on's own registration calls — so it is false exactly when the private add-on is not linked, which is what "this build links no private NPU route (-DONEBIT_NPU_PRIVATE …)" says.
  • Behaviour is unchanged: the fprintf sits between the existing per-op-forward line and the fargs vector, and the branch that builds fargs is untouched — the serve path is the same one, with one more sentence on stderr.

Two notes, neither an ask

  1. Two messages now describe the same absence. npu::private_route_missing(model_type) (app/unified.cpp:420) already says "the NPU route is not part of this build; build with -DONEBIT_NPU_PRIVATE=", per model. The new line is build-level and the old one is model-level, which is a real distinction — but if both can fire in one run, a reader gets two sentences with different wording for one fact. Worth a look the next time either is touched.
  2. The device half is the author's: "two builds of this commit, without the add-on the line prints, with it the private route is taken and the line does not print" — I hold no npu-hold ticket, so that is reported, not verified. It is also the half that could not be faked by reading: the line printing is observable in exactly one configure.

Nothing else: one file, one branch, no control flow moved.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at ecb137d: READY

The change is right and small: 8 lines in the per-op-forward branch, gated on npu::private_routes_available() (which already exists at npu/private_route.cpp:110 and is exercised by npu_private_route), no behaviour touched, and the ledger it fixes is the one engine#3193 is about — a build without the add-on measured as if it were the release. merge-tree origin/main rc 0.

Two notes, both about the same thing and both cheap, because a message whose whole purpose is "do this to get the route" should not send an operator two different ways:

  1. Our two messages now point at different documentation, and the older one points at a section that does not exist. The new line says docs/releases.md "Private components" — which is real (docs/releases.md:418). The existing private_route_missing() (npu/private_route.cpp:104) says docs/npu.md, "Private routes", and docs/npu.md has no such section: the docs call it "add-on routes" (docs/npu.md#add-on-routes, cited that way by docs/serve.md:452 and docs/PORTING.md:28). So the same operator, hitting two different paths in the same binary, is sent to one good pointer and one broken one. Worth aligning them here, since this PR is the one touching the operator-facing text.

  2. The flag is spelled -DONEBIT_NPU_PRIVATE here and -DONEBIT_NPU_PRIVATE=<add-on checkout> everywhere else. CMakeLists.txt:3204 is set(ONEBIT_NPU_PRIVATE "" CACHE PATH …) and :3209 fatals with "has no addons/CMakeLists.txt" when it is set to something that is not a checkout — so a bare -DONEBIT_NPU_PRIVATE is either empty (a no-op that leaves the operator exactly where they started) or, if they pass =ON, a FATAL_ERROR. Every doc line that shows the flag shows a value (docs/npu.md:3855, docs/laya.md:268, docs/hybrid.md:26). Copy-pasting the new message's spelling gets a build that still has no private route, and the next measurement would be misread the same way this PR is fixing.

Neither blocks: the log line is the fix and it works. If you would rather not touch the second message in this PR, then a sentence in the body saying the two pointers are deliberately different is enough for a reviewer to accept it knowingly — I would just not leave the "Private routes" pointer unmentioned, since that one is already wrong on main.

@bong-water-water-bong
bong-water-water-bong merged commit 6284e03 into main Nov 21, 2026
12 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the ross/npu-serve-speed branch November 21, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant