From 0c895f980add6c462cf5d92ff9945a4437680104 Mon Sep 17 00:00:00 2001 From: pi-zha Date: Sun, 8 Nov 2026 18:53:00 -0400 Subject: [PATCH] npu: define the three-argument step_batch_embeds, so a full build links (fixes #1573) q4nx_forward.h declares both overloads - the plain-text one and the HybridInputs one (position planes + deepstack) - but only the four-argument form was defined, so every full `cmake --build` on main stopped at 92% with undefined reference to Q4nxNpuForward::step_batch_embeds(std::vector const&, int, std::vector&) from npu/forward/embeds_equiv_probe.cpp, which is the file that exercises the plain-text path. The onebit target links because it does not pull the probe in, which is why this survived until a full build was run. The definition is a forwarder with a default HybridInputs: no position planes, no deepstack sets, image span unset - which is exactly what the three-argument form is documented to mean. Verified: embeds_equiv_probe now builds and, under NPU_INFER_HOST_GEMM=1 against the Qwen2.5-0.5B hybrid container and kernels-05b-hyb-b8, prints 'PASS (3/3 prompts identical)' - i.e. the overload that was missing actually works, it was only absent. --- npu/forward/src/q4nx_forward.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; }