Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,38 @@ jobs:
g++-16 -std=c++26 -fsyntax-only -DONEBIT_NPU_RUNTIME_OWN \
-Inpu -Inpu/forward/include -Ibuild/_deps/json-src/include \
tools/mtp_acceptance.cpp
- name: The forward defines every step_batch_embeds overload the header declares
# `embeds_equiv_probe` cannot be built in this job: it lives under `if(ONEBIT_NPU)` (CMakeLists.txt), and
# this workflow configures without it because the NPU runtime is private. Naming a target the configuration
# does not define is a hard ninja error that stops the whole step (tools/ci/ci_targets_check.py guards that
# now), so the probe is guarded by its symbol instead. What this job DOES build is
# `onebit_npu_forward_syntax`, an OBJECT library that compiles q4nx_forward.cpp and links nothing -- so the
# object can be built here, and the invariant that broke on 2026-11-08 (the three-argument
# `step_batch_embeds` was declared in the header and never defined, so `embeds_equiv_probe` failed to link
# while every CI job stayed green) is checkable against it without the NPU configuration.
run: |
# Built explicitly rather than relied on transitively: it IS built by the step above, because
# CMakeLists.txt:542 has `add_dependencies(onebit onebit_npu_forward_syntax)` -- but a check that
# depends on the order of another step's target list is the kind that goes quiet when that list is
# edited. One line here makes the object's existence this step's own precondition.
cmake --build build --target onebit_npu_forward_syntax
OBJ=$(find build -name 'q4nx_forward.cpp.o' -path '*onebit_npu_forward_syntax*' | head -1)
test -n "$OBJ" || { echo "the forward syntax object was not built"; exit 1; }
decl=$(grep -c 'bool step_batch_embeds(' npu/forward/include/q4nx_forward.h)
def=$(nm -C "$OBJ" | grep -c ' T Q4nxNpuForward::step_batch_embeds')
echo "$OBJ: $def definition(s) of Q4nxNpuForward::step_batch_embeds, $decl declared"
if [ "$def" -lt "$decl" ]; then
echo "a declared overload has no definition: anything that calls it fails to link, and this job's"
echo "own targets never do (that is how a red main survived). Counted above."
exit 1
fi
- name: The embedding probe still compiles against the in-tree headers
# The probe itself cannot be built here (see above), but it must keep compiling: this catches the probe
# drifting from the forward's interface, which the symbol check above would not.
run: |
g++-16 -std=c++26 -fsyntax-only -DONEBIT_NPU_RUNTIME_OWN \
-Inpu -Inpu/forward/include -Ibuild/_deps/json-src/include \
npu/forward/embeds_equiv_probe.cpp
- name: Build
# Every target a ctest test invokes must be listed here: `ctest` runs whatever
# binaries exist, so a test whose target is missing reports "Not Run" and never
Expand Down
10 changes: 10 additions & 0 deletions npu/forward/src/q4nx_forward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3023,6 +3023,16 @@ void Q4nxNpuForward::npu_gemm_rows(int role, const float* A, int M, int K, int N

// The folded container's sign table: magic "HAD1", u32 count, count x (u32 width, u32 offset),
// then the f32 signs those offsets index (the GGUF's prism.hadamard.sign_widths/sign_values).
// The plain-text overload. It is declared in q4nx_forward.h and used by npu/forward/embeds_equiv_probe.cpp, but only the
// HybridInputs-taking definition existed, so every full build stopped at `undefined reference to
// Q4nxNpuForward::step_batch_embeds(std::vector<float>, int, std::vector<float>&)` — the onebit target links because it
// does not pull the probe in, which is why the breakage survived a release-ish build. Defaulting `in` is exactly the
// documented meaning of the three-argument form: no position planes, no deepstack sets, nothing vision-conditioned.
bool Q4nxNpuForward::step_batch_embeds(const std::vector<float>& embeds, int start_pos,
std::vector<float>& logits) {
return step_batch_embeds(embeds, start_pos, logits, HybridInputs{});
}

bool Q4nxNpuForward::step_batch_embeds(const std::vector<float>& embeds, int start_pos,
std::vector<float>& logits, const HybridInputs& in) {
if (!ready_) { err_ = "not initialised"; return false; }
Expand Down
Loading