The NPU sources (npu/lane.cpp, npu/forward, app/forward_serve.cpp) now include npu/rt.h instead of
XRT headers. With the default -DONEBIT_NPU_RUNTIME=xrt it includes XRT as before. With
-DONEBIT_NPU_RUNTIME=own -DONEBIT_NPU_RT_DIR=<dir> it includes a private add-on's npu_rt.h (an
XRT-compatible runtime over the amdxdna ioctls) and aliases namespace xrt = npu_rt; <dir>/npu_rt.cpp
is built into onebit_npu_rt and 1bit links no XRT. No runtime code is in this repository.
Tests: npu_runtime_option (CI, no XRT: a bad value or own without a runtime directory stops the
configure with a message) and npu_rt_shim (NPU builds: every runtime call the engine makes
compiles against the selected runtime). docs/npu.md, "XRT or the own runtime".
Measured on Strix Halo (fast lane, Qwen3-0.6B, same session): ldd 1bit lists no libxrt with own;
npu-run logits bit-identical to the xrt build at 32/32 greedy steps in 3 of 3 runs; serve: 3 prompts
x 32 greedy tokens identical; tests/serve_e2e.sh PASS on both; decode median of 3 npu-run 86.2 (xrt)
vs 83.7 (own) tok/s, serve timings median 80.3 (xrt) vs 82.7 (own) tok/s. Default build: all 26
ctests pass.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
What
A build option that selects which runtime the engine's NPU code compiles against:
-DONEBIT_NPU_RUNTIME=own -DONEBIT_NPU_RT_DIR=<dir>: our own runtime from a private add-on directory (npu_rt.h,npu_rt.cpp), built here into the static libraryonebit_npu_rt.1bitthen links no external runtime library.The NPU sources include one new shim header,
npu/rt.h, which pulls in the runtime header plusnamespace xrt = npu_rt;, sonpu/lane.cpp,npu/forward/*andapp/forward_serve.cppbuild unchanged against both. This repository holds no runtime code: the option, the shim, two tests and a docs section.Tests:
npu_runtime_option(runs in CI: a bad value, orownwithout a runtime directory, must stop the configure with a message) andnpu_rt_shim(NPU builds only: every runtime call the engine makes must compile against the selected runtime). Default build: all 26 ctests pass.ONEBIT_NPU_PRIVATEtogether withownprints a CMake warning (the private 35B add-on links prebuilt XRT libraries and cannot build againstownyet).Proof on strixhalo (fast-lane route, Qwen3-0.6B full ELFs, performance mode, each NPU run under a device lock and the thermal wrapper)
ldd build-own/1bit: pcre2, gomp, libstdc++, libm, libgcc_s, libc.build-xrt/1bit: addsthe external runtime library.so.2andlibuuid. strace of anownrun: 0 opens matching "xrt".1bit npu-run ... -n 32 --dump-logits: everyownrun (6) and every repeat XRT run gave logits bit-identical (cmp) to the first XRT run at 32/32 steps; tokens identical.1bit serve --device npu, 3 fixed prompts, temperature 0, 32 tokens, streamed: 32/32 tokens identical per prompt on both builds; all 33 streamed chunks identical.tests/serve_e2e.sh <1bit> <model> npu: PASS on both builds ("Paris").own: 40 runlists, 11.7 ms execute-to-done each (28 layer runs + lm head), host work about 0.9 ms per token and overlapped; decode step 12.4 ms. There is no per-token reconfiguration cost on this route.Not covered
ownbut was not run.own(prebuilt XRT-linked libraries).🤖 Generated with Claude Code