diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 023739756..d4da5be53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/npu/forward/src/q4nx_forward.cpp b/npu/forward/src/q4nx_forward.cpp index 49203e9c7..a0af1fb3e 100644 --- a/npu/forward/src/q4nx_forward.cpp +++ b/npu/forward/src/q4nx_forward.cpp @@ -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, int, std::vector&)` — 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& embeds, int start_pos, + std::vector& logits) { + return step_batch_embeds(embeds, start_pos, logits, HybridInputs{}); +} + bool Q4nxNpuForward::step_batch_embeds(const std::vector& embeds, int start_pos, std::vector& logits, const HybridInputs& in) { if (!ready_) { err_ = "not initialised"; return false; }