From 759a9224295ee800741784b9aef2529157b759a9 Mon Sep 17 00:00:00 2001 From: pi-lane Date: Sun, 15 Nov 2026 20:54:21 -0400 Subject: [PATCH 1/2] kernel-set-check: refuse a set that carries two ELFs with the same content engine#2599: bonsai2-27b-NPU shipped prefill ELFs byte-identical to their _m16 twins, so a 128-row chunk computed 16 rows -- and every host-side check passed. The name was right, the per-tile widths were right (args_fit_elf cannot see a row count), and the AIE image carries no readable design M: e_shnum=0, no symtab, no design string (measured on this lane own packs). A hash of the file is therefore the only host-side instrument that can see the difference, and two identical ELFs inside one pack are either a packaging accident or a design that was never widened -- both refusals. Verified: this lane five packs (46 ELFs) pass with 0 duplicate groups; a synthetic twin pair fails and names both files. --- scripts/kernel-set-check.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/kernel-set-check.sh b/scripts/kernel-set-check.sh index 242862275..a5d703463 100755 --- a/scripts/kernel-set-check.sh +++ b/scripts/kernel-set-check.sh @@ -18,6 +18,13 @@ # # scripts/kernel-set-check.sh [--pack ] [ ...] # +# +# engine#2599: ALSO refuses a set that carries two ELFs with the SAME CONTENT under different names. The +# bonsai2 pack shipped prefill ELFs byte-identical to their _m16 twins, so a 128-row chunk computed 16 rows +# and every host-side check passed: the loaded file had the right NAME and the right per-tile widths, and the +# AIE image carries no readable design M (e_shnum=0, no symtab, no design string -- measured on this lane's +# packs), so nothing but a hash of the file can tell the two designs apart. A twin inside one pack is either +# a packaging accident or a design that was never widened; both are refusals, not warnings. # Why this exists: the release candidate serves small models at 87-101 tok/s with the set that ships beside it, and a # build of current main refused that same set with "layer ELFs: the NB 2 and 3 builds differ in size". Neither the set # nor the kernels were wrong — the two sides came from different revisions of the private repository, one on each side of @@ -219,9 +226,24 @@ if [ $# -eq 0 ]; then exit 2 fi +# engine#2599: two ELFs with the same content under different names is a refusal. See the header for why a +# hash is the only host-side instrument that can see it. +check_twins() { + local dir=$1 dup + dup=$(find "$dir" -maxdepth 2 -name '*.elf' -type f -print0 2>/dev/null | + xargs -0 -r md5sum 2>/dev/null | sort | awk '{h=$1; $1=""; if (h==prev) print prevname " and" $0; prev=h; prevname=$0}') + if [ -n "$dup" ]; then + printf 'FAIL %s: ELFs with identical content under different names (a copied twin computes the wrong M):\n%s\n' \ + "$(basename "$dir")" "$dup" + return 1 + fi + return 0 +} + rc=0 for dir in "$@"; do check_set "$dir" || { rc=$?; [ "$rc" -gt 1 ] && rc=2; } + check_twins "$dir" || rc=1 done if [ -n "$pack" ]; then From 2e725f30183795c8fdf19a8bbd72ac7d8be87eb7 Mon Sep 17 00:00:00 2001 From: pi-lane Date: Sun, 15 Nov 2026 21:15:11 -0400 Subject: [PATCH 2/2] kernel_set_check_test: arms for the ELF-twin refusal, in both directions The twin check added with engine#2599 had only been verified by hand against this lane packs and a throwaway directory. It now has a ctest arm: distinct ELFs are not reported as twins, two ELFs with the same content are refused, and both paths are named in the refusal. --- tests/kernel_set_check_test.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/kernel_set_check_test.sh b/tests/kernel_set_check_test.sh index 3b3a24ad1..c5a8aa73e 100755 --- a/tests/kernel_set_check_test.sh +++ b/tests/kernel_set_check_test.sh @@ -231,6 +231,21 @@ check $([ $? -eq 0 ] && echo ok || echo fail) "layer directories with a suffix: check $(has "$tmp/out20" "3 layer-indexed" && ! has "$tmp/out20" "other" && echo ok || echo fail) \ "... all three counted as layer-indexed, none as other" +# engine#2599: two ELFs with identical content under different names must fail, and a clean set must not. +mkdir -p "$tmp/twin/good" "$tmp/twin/dup" +printf 'A' > "$tmp/twin/good/full_i8_O_K768_N768_b8.elf" +printf 'B' > "$tmp/twin/good/full_i8_O_K768_N768_b8_m16.elf" +printf 'A' > "$tmp/twin/dup/full_i8_O_K768_N768_b8.elf" +printf 'A' > "$tmp/twin/dup/full_i8_O_K768_N768_b8_m16.elf" +"$script" "$tmp/twin/good" > "$tmp/out21" 2>&1 +check $([ $? -ne 0 ] || ! has "$tmp/out21" "identical content" && echo ok || echo fail) \ + "distinct ELFs are not reported as twins" +"$script" "$tmp/twin/dup" > "$tmp/out22" 2>&1 +check $(has "$tmp/out22" "identical content" && echo ok || echo fail) \ + "two ELFs with the same content are refused" +check $(has "$tmp/out22" "full_i8_O_K768_N768_b8.elf" && has "$tmp/out22" "_m16.elf" && echo ok || echo fail) \ + "... and both paths are named" + if [ "$fails" -ne 0 ]; then printf 'kernel_set_check: %d failure(s)\n' "$fails" exit 1