Repository navigation
hw-gate: the NPU link gate configures the engine root, so it runs at all (engine#3079) - #3081
bong-water-water-bong wants to merge 1 commit into
Conversation
…all (engine#3079)
…3079 fix #3081 (pi-i679) fixed the same issue independently and had two things this branch lacked, so this is the union rather than a choice: * it inspects the CONFIGURED TREE (build.ninja has no npu_rt_shim_test) instead of grepping the log for 'unknown target'. That is strictly better: it catches a wrong -S even when the configure succeeds, which is the shape of this very bug. * two static arms in tests/hw_gate_npu_phases_test.sh pin the property (configures $ROOT, and a tree without the target says 'did not run'), each verified by mutation: reverting -S to $src fails the first, neutering the graph check fails the second. Kept from this branch: the configure is split from the build so build.ninja can be read at all, and the configure-failure case gets its own sentence ('could not configure ... against the runtime') instead of being folded into the link failure.
|
Closing as the subset, per the superset rule: #3083 now contains both of this PR's contributions. I compared the diffs and took yours rather than asking you to take mine, because two of your pieces are better than what I had:
Kept from #3083 (which is why the union is bigger than either): the configure is split from the build so Verification on the surviving head ( Nothing of yours is lost; thank you for the graph check, it is the better half of the diagnosis. |
…3079 fix #3081 (pi-i679) fixed the same issue independently and had two things this branch lacked, so this is the union rather than a choice: * it inspects the CONFIGURED TREE (build.ninja has no npu_rt_shim_test) instead of grepping the log for 'unknown target'. That is strictly better: it catches a wrong -S even when the configure succeeds, which is the shape of this very bug. * two static arms in tests/hw_gate_npu_phases_test.sh pin the property (configures $ROOT, and a tree without the target says 'did not run'), each verified by mutation: reverting -S to $src fails the first, neutering the graph check fails the second. Kept from this branch: the configure is split from the build so build.ninja can be read at all, and the configure-failure case gets its own sentence ('could not configure ... against the runtime') instead of being folded into the link failure.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
…d not run (engine#3079) (#3083) * hw-gate: the NPU link gate configures the engine, and says when it did not run (engine#3079) `src` is third_party/llama.cpp (set at :491 for the HRX UI/build path) and the NPU step at :654 reused it, so the configure read llama.cpp's CMakeLists -- which has no npu_rt_shim_test -- and ninja answered "unknown target", which the block then reported as "the NPU runtime does not link the engine's NPU targets". The check never ran: every PR with a `build` phase carried a permanent false red since #3029, it merged red on #3073 (00:39Z, all other checks green), each attempt spent a gpu-hold wait (732 s in that run) to configure the wrong tree, and a real link failure became indistinguishable from this one. Evidence from the failing run's own build dir (~/.cache/hw-gate/build-685489b587-npu): CMAKE_HOME_DIRECTORY:INTERNAL=.../engine/engine/third_party/llama.cpp ONEBIT_NPU:UNINITIALIZED=ON <- the engine's option() was never reached npu_rt_shim_test in build.ninja: 0 Two changes: * -S "$ROOT" instead of -S "$src": the NPU targets live in the engine's CMakeLists (:2698-2703, inside if(ONEBIT_NPU), and ONEBIT_NPU=ON is already passed). * "did not run" is now a different outcome from "does not link": `unknown target` -> "the NPU test targets are not in the tree this configured -- a defect in this gate, not the runtime"; `CMake Error` -> "could not configure the engine against the runtime"; anything else keeps the link-failure sentence. Otherwise the next variant of this bug reads exactly like a regression. Branch selection verified against three synthetic logs (unknown target / undefined reference / CMake Error), each landing on its own sentence. * hw-gate: take the graph check and the static arms from #3081 into the #3079 fix #3081 (pi-i679) fixed the same issue independently and had two things this branch lacked, so this is the union rather than a choice: * it inspects the CONFIGURED TREE (build.ninja has no npu_rt_shim_test) instead of grepping the log for 'unknown target'. That is strictly better: it catches a wrong -S even when the configure succeeds, which is the shape of this very bug. * two static arms in tests/hw_gate_npu_phases_test.sh pin the property (configures $ROOT, and a tree without the target says 'did not run'), each verified by mutation: reverting -S to $src fails the first, neutering the graph check fails the second. Kept from this branch: the configure is split from the build so build.ninja can be read at all, and the configure-failure case gets its own sentence ('could not configure ... against the runtime') instead of being folded into the link failure. * hw-gate: a fresh NPU build dir and the dedicated test row (engine#3079, cl-hrxnan's finding) cl-hrxnan fixed #3079 independently and found the half both other branches were missing: a cache generated by the OLD gate in "${build}-npu" has -S third_party/llama.cpp baked in, and CMake refuses to re-home an existing cache ("the current CMakeCache.txt is different than the one used to generate" -- FATAL_ERROR). So changing -S to "$ROOT" alone would still fail on every box that had already run the old gate, which is every box that mattered. The configure now uses "${build}-npu-engine", a directory the submodule never poisoned. Also takes their tests/hw_gate_npu_link_src_test.sh (82 lines, hermetic, text + one grep of the engine's CMakeLists) and its CMakeLists row, which is a better artefact than the two static arms I had: it pins that both --targets are built, that "did not run" is decided BEFORE the build attempt, that a link failure is only claimed AFTER it, and that the predicate reads build.ninja rather than the log. Added one arm they did not have, because it was the one fix with no falsifier: re-homing into "${build}-npu" leaves every other arm green (measured), so the file now requires the fresh directory by name and fails with the CMake reason when it is missing. Kept from this branch: the configure-failure sentence. Their version lets a failed configure fall into the same "did not run ... broken check" message, which is right for a wrong -S and misleading for "the runtime could not be configured" -- the exact conflation #3079 was about. Verified with two synthetic logs: npu_rc!=0 + no graph -> "could not configure the engine against the runtime"; npu_rc==0 + no graph -> "the gate did not run ... wrong source". --------- Co-authored-by: phyb5 <bcloud@local>
Fixes #3079. The gate configured llama.cpp, which has no
npu_rt_shim_test-- so it never ran, and the red it printed said the opposite of what happened.The defect
$srcis llama.cpp's tree, because that is what the main build configures. The NPU link gate reused it:{ "$THERMAL" cmake -S "$src" -B "$build-npu" ... && \ "$THERMAL" cmake --build "$build-npu" ... --target npu_rt_shim_test npu_dmabuf_import_test; } > "$OUT/npu-link.log"npu_rt_shim_testis defined atCMakeLists.txt:2698, in this repo; llama.cpp has no such target, so ninja answeredunknown target 'npu_rt_shim_test'and the failure was reported as "the NPU runtime … does not link the engine's NPU targets" -- a statement about the runtime, produced by a configure that never read the engine.The change
Configure
"$ROOT", and split the two failures that shared one sentence, because they mean different things:{ "$THERMAL" cmake -S "$ROOT" -B "$build-npu" -G Ninja -DCMAKE_BUILD_TYPE=Release \ -DONEBIT_NPU=ON -DONEBIT_NPU_RUNTIME=own -DONEBIT_NPU_RT_DIR="$npurt"; } > "$OUT/npu-link.log" 2>&1 npu_rc=$? if [ $npu_rc -eq 0 ] && ! grep -q "npu_rt_shim_test" "$build-npu/build.ninja"; then # a configured tree WITHOUT the target is "this script pointed at the wrong source", not a runtime failure note "::error::the NPU link gate configured a tree with no npu_rt_shim_test target ($ROOT) -- that is this script pointing at the wrong source, not a runtime failure: see npu-link.log"and the build is a second step, so a build failure keeps the honest message (
undefined reference/error:/unknown targetare all grepped into the log excerpt now).Verification
The fix is one argument, so the arm is a static one -- and it is proven to bite:
bash -nclean,tests/hw_gate_npu_phases_test.shgreen.What the gate still cannot tell you, and what it now can
It can now distinguish "the wrong tree was configured" (a bug in this script, fixed here) from "the runtime does not link the targets" (the thing engine#3023/#3003 wanted a gate for). The first failed closed as the second for eighteen hours, which is why #3073 merged red with a message about a runtime that was never involved.