From 753716f1b75772cf12b38198b9a568446a5be6e7 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong <277547417+bong-water-water-bong@users.noreply.github.com> Date: Tue, 10 Nov 2026 17:17:47 -0400 Subject: [PATCH 1/4] tools/ci: a /tmp literal is RAM on this box, so the ratchet stops new ones `/tmp` is tmpfs on both boxes, so a debug dump, a staging copy or a benchmark log written there is anonymous memory: it cannot be reclaimed to disk under pressure, it goes to swap, and when swap fills every lane on the box stalls. Measured 2026-11-10 21:15Z: /tmp held 52 G of 62 G and swap was 71/71 GiB full; the two largest items were a stale 1bit-fconst19*.fconst scratch copy (3.5 G) and five q17-*.json dumps (9.2 G). engine#1907/#1952 bounded the fconst scratch. The *paths* are still literals: 14 of them across 8 files - 7 in C/C++ (a per-token dump hp file, a layer dump, two mkstemp probes, the device lock, a hybrid staging dir) and 7 in shell (a benchmark's own server log and two acceptance logs). The per-token one, q4nx_hidden_%d.bin, writes a file per token position, which is the shape that can fill tmpfs mid-run. This adds the check, not the fix: tools/ci/tmp_paths.txt baselines the 14 sites and may only shrink, and a new one fails. Both directions are arms, because a ratchet that only counts upward cannot see a rename (engine#1728): a new site is drift, and so is a baseline line whose site is gone. Verified: --check on this tree reports "14 baselined, none new, none stale"; --self-test's 9 arms pass, including "a commented-out path is not a site" (the engine#1983 substring trap), "/var/tmp is not /tmp", and "a renamed file leaves a stale baseline line". Registered through the cmake/tests-*.cmake glob (engine#1979), so it needs no CMakeLists.txt line: ctest -N lists tmp_path_check and tmp_path_check_self, and ci_targets_check still reports 9 with none new (a python test adds no ci.yml --target). The rewrite of the 14 sites wants the resolve order ONEBIT_DUMP_DIR -> $XDG_CACHE_HOME/1bit/scratch -> $HOME/.cache/1bit/scratch and a refusal instead of a /tmp fallback, which is the same chain shape as the fconst scratch order (engine#1801/#1818). That change touches npu/forward, which four lanes are editing, so it belongs to whoever owns it; this PR makes sure the count stops growing until then. --- cmake/tests-tmp-path.cmake | 24 ++++ tools/ci/tmp_path_check.py | 242 +++++++++++++++++++++++++++++++++++++ tools/ci/tmp_paths.txt | 20 +++ 3 files changed, 286 insertions(+) create mode 100644 cmake/tests-tmp-path.cmake create mode 100644 tools/ci/tmp_path_check.py create mode 100644 tools/ci/tmp_paths.txt diff --git a/cmake/tests-tmp-path.cmake b/cmake/tests-tmp-path.cmake new file mode 100644 index 000000000..588193410 --- /dev/null +++ b/cmake/tests-tmp-path.cmake @@ -0,0 +1,24 @@ +# Copyright 2026 bong-water-water-bong +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# engine#2021: a hardcoded `/tmp` path is RAM on this box, not disk. +# +# `/tmp` is tmpfs here, so a dump, a staging copy or a benchmark log written there is anonymous memory: swap fills +# and every lane on the box stalls (measured 2026-11-10 21:15Z: /tmp 52 G of 62 G, swap 71/71 GiB). engine#1907/#1952 +# bounded the fconst scratch; the literals themselves are still in the tree, 14 of them across 8 files. +# +# Both rows are cheap and device-free: the check is a grep over npu/ app/ tools/ scripts/ against +# tools/ci/tmp_paths.txt, and the ratchet may only shrink. +add_python_test(tmp_path_check ${CMAKE_SOURCE_DIR}/tools/ci/tmp_path_check.py --check --root ${CMAKE_SOURCE_DIR}) +add_python_test(tmp_path_check_self ${CMAKE_SOURCE_DIR}/tools/ci/tmp_path_check.py --self-test) diff --git a/tools/ci/tmp_path_check.py b/tools/ci/tmp_path_check.py new file mode 100644 index 000000000..f350156ac --- /dev/null +++ b/tools/ci/tmp_path_check.py @@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +# Copyright 2026 bong-water-water-bong +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""A hardcoded `/tmp` path is RAM on this box, not disk. + +`/tmp` is tmpfs on both development boxes, so a dump, a staging copy or a server log written there is +anonymous memory: it cannot be reclaimed to disk under pressure, it goes to swap, and when swap fills every +lane on the box stalls. Measured 2026-11-10 21:15Z, `/tmp` held 52 G of 62 G and swap was 71/71 GiB full; +the two largest items were a stale `1bit-fconst19*.fconst` scratch copy (3.5 G) and five `q17-*.json` dumps +(9.2 G). engine#1907/#1952 bounded the fconst scratch; the *paths* are still literals in the tree. + +This check keeps the literals from spreading. It is a ratchet, not a gate: `tools/ci/tmp_paths.txt` holds the +sites that exist today and may only shrink. A new site fails, and so does a baseline line whose site is gone - +that second arm matters because a file rename would otherwise move a site out of the baseline silently, which +is the `tools/ci/ci_targets_check.py` lesson from engine#1728 (a ratchet that only counts upward cannot see a +rename). + +Usage: + tools/ci/tmp_path_check.py --check [--root .] # rc 1 if a site was added or a baseline line went stale + tools/ci/tmp_path_check.py --self-test # rc 1 unless the arms below behave + tools/ci/tmp_path_check.py --write-baseline # rewrite tools/ci/tmp_paths.txt from the tree +""" +from __future__ import annotations + +import argparse +import os +import pathlib +import re +import sys + +# A literal `/tmp` path in C, C++ or shell, including its closing quote where there is one, so the baseline +# names the literal exactly as a reader finds it in the file. `["']` opens on either quote; a template literal +# with no closing quote on the same line (a shell `"${TMPDIR:-/tmp}/x"`) ends at what it matched. +LITERAL = re.compile(r"""["']/tmp/[^"'\s]*["']?""") + +# The paths this check owns. `npu/` and `app/` are where a dump lands; `tools/` and `scripts/` are where a +# benchmark log lands. Everything else is out of scope on purpose: a test may use a temp dir (and pytest's +# `tmp_path` is the right instrument there), and `docs/` quotes paths rather than writing them. +SCAN = ("npu", "app", "tools", "scripts") +SUFFIXES = (".c", ".cc", ".cpp", ".h", ".hpp", ".sh", ".py") + +# This checker's own fixture text is not a site: its self-test writes `"/tmp/..."` literals into a scratch tree to +# prove they are found. Excluded BY NAME rather than by pattern so the exclusion is one line a reader can check, and +# the run prints it (--check counts excluded files) so a second such file cannot appear unnoticed. +SELF = "tools/ci/tmp_path_check.py" + +# Test files are excluded: a test that writes to a temp dir it created is not the defect, and the fixtures would +# otherwise have to be baselined too. +def is_test(rel: str) -> bool: + parts = rel.split(os.sep) + if any(p in ("tests", "test") for p in parts[:-1]): + return True + name = parts[-1] + return name.endswith(("_test.c", "_test.cpp", "_test.py", "_test.sh")) or name.startswith("test_") + + +# A commented-out path is not a path. engine#1983's review took `# was include(cmake/...)` for an include and +# lost seven registrations with every gate green; the same substring trap applies here, so comments are removed +# before the match rather than filtered after it. +def strip_comments(text: str, suffix: str) -> str: + if suffix == ".py": + return re.sub(r"#[^\n]*", "", text) + if suffix == ".sh": + # A `#` starts a comment when it begins a word; `$#`, `${x#y}` and a `#` inside a string are not. + return re.sub(r"(? str: + """The baseline form: the literal as written, so a line stays recognisable next to its file.""" + return f"{rel}\t{lit}" + + +def scan(root: pathlib.Path) -> dict[str, list[str]]: + """{file: [literal, ...]} for every in-scope site, sorted and de-duplicated.""" + found: dict[str, list[str]] = {} + excluded_self: set[str] = set() + scan.excluded_self = excluded_self # read by --check so the exclusion is printed, not implicit + for top in SCAN: + base = root / top + if not base.is_dir(): + continue + for path in sorted(base.rglob("*")): + if not path.is_file() or path.suffix not in SUFFIXES: + continue + rel = path.relative_to(root).as_posix() + if rel == SELF: + excluded_self.add(rel) + if is_test(rel) or rel == SELF: + continue + try: + text = path.read_text(encoding="utf-8", errors="replace") + except OSError: + continue + hits = [m.group(0) for m in LITERAL.finditer(strip_comments(text, path.suffix))] + if hits: + found[rel] = sorted(set(hits)) + return found + + +def read_baseline(path: pathlib.Path) -> set[str]: + if not path.is_file(): + return set() + out = set() + for line in path.read_text(encoding="utf-8").splitlines(): + line = line.strip() + if line and not line.startswith("#"): + out.add(line) + return out + + +def write_baseline(path: pathlib.Path, found: dict[str, list[str]]) -> None: + lines = [ + "# Hardcoded /tmp paths under npu/, app/, tools/, scripts/ - the sites that exist today.", + "# A ram on this box is tmpfs, so each of these is anonymous memory when it is written.", + "# This list may only SHRINK: fix a site, then delete its line. A new site fails", + "# tools/ci/tmp_path_check.py --check, and so does a line whose site is gone.", + "# Regenerate with: tools/ci/tmp_path_check.py --write-baseline", + "", + ] + for rel in sorted(found): + for lit in found[rel]: + lines.append(rel_literal(lit, rel)) + path.write_text("\n".join(lines) + "\n", encoding="utf-8") + + +def main(argv: list[str]) -> int: + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + g = ap.add_mutually_exclusive_group(required=True) + g.add_argument("--check", action="store_true") + g.add_argument("--self-test", action="store_true") + g.add_argument("--write-baseline", action="store_true") + ap.add_argument("--root", default=".") + args = ap.parse_args(argv) + root = pathlib.Path(args.root).resolve() + baseline_path = root / "tools" / "ci" / "tmp_paths.txt" + + found = scan(root) + have = {rel_literal(lit, rel) for rel, lits in found.items() for lit in lits} + + if args.write_baseline: + write_baseline(baseline_path, found) + print(f"tmp_path_check: wrote {len(have)} site(s) to {baseline_path}") + return 0 + + if args.self_test: + return self_test() + + base = read_baseline(baseline_path) + new = sorted(have - base) + gone = sorted(base - have) + for line in new: + print(f"tmp_path_check: NEW hardcoded /tmp path: {line.replace(chr(9), ' ')}") + for line in gone: + print( + "tmp_path_check: baseline line has no site any more (fixed or renamed): " + f"{line.replace(chr(9), ' ')} - delete it if fixed" + ) + if new or gone: + print( + f"tmp_path_check: FAIL ({len(new)} new, {len(gone)} stale of {len(base)} baselined) - /tmp is tmpfs " + "on this box, so route the path through ONEBIT_DUMP_DIR, $XDG_CACHE_HOME/1bit/scratch or a " + "$TMPDIR the caller set, instead" + ) + return 1 + excluded = len(getattr(scan, "excluded_self", ())) + print(f"tmp_path_check: {len(base)} baselined site(s), none new, none stale " + f"({excluded} file(s) excluded: this checker's own fixtures)") + return 0 + + +def self_test() -> int: + import tempfile + + bad = 0 + + def check(ok: bool, what: str) -> None: + nonlocal bad + print((" ok " if ok else " FAIL ") + what) + if not ok: + bad += 1 + + with tempfile.TemporaryDirectory() as td: + root = pathlib.Path(td) + (root / "npu" / "forward").mkdir(parents=True) + (root / "tools" / "ci").mkdir(parents=True) + (root / "tests").mkdir() + # A live site, a site in a comment, a test file, and a path that merely contains "tmp". + (root / "npu" / "forward" / "dump.cpp").write_text( + 'void f() { open("/tmp/npu_layer.bin"); }\n' + "// was: open(\"/tmp/old.bin\");\n" + '/* open("/tmp/block.bin"); */\n' + 'const char* other = "/var/tmp/not_ours.bin";\n', + encoding="utf-8", + ) + (root / "tests" / "dump_test.cpp").write_text('void t() { open("/tmp/x.bin"); }\n', encoding="utf-8") + (root / "tools" / "run.sh").write_text( + 'LOG="${TMPDIR:-/tmp}/run.log"\n' "echo hi > /tmp/run2.log\n" "echo $# # a comment /tmp/nope\n", + encoding="utf-8", + ) + found = scan(root) + check(found.get("npu/forward/dump.cpp") == ['"/tmp/npu_layer.bin"'], + "a live literal is found and the two commented copies are not") + check('"/tmp/old.bin"' not in str(found), "a commented-out path is not a site") + check("tests/dump_test.cpp" not in found, "a test file is out of scope") + check('"/var/tmp/not_ours.bin"' not in str(found), "/var/tmp is not /tmp") + + # The ratchet: a new site fails, a stale baseline line fails, and an unchanged tree passes. + write_baseline(root / "tools" / "ci" / "tmp_paths.txt", found) + base = read_baseline(root / "tools" / "ci" / "tmp_paths.txt") + have = {rel_literal(lit, rel) for rel, lits in found.items() for lit in lits} + check(base == have, f"the baseline round-trips ({len(base)} site(s))") + check(not (have - base) and not (base - have), "an unchanged tree has no drift") + + (root / "npu" / "forward" / "added.cpp").write_text('void g() { open("/tmp/new.bin"); }\n', encoding="utf-8") + added = {rel_literal(lit, rel) for rel, lits in scan(root).items() for lit in lits} + check(bool(added - base), "a new site is drift") + check(not (base - added), "and adding one leaves no stale line") + + (root / "npu" / "forward" / "dump.cpp").unlink() + renamed = {rel_literal(lit, rel) for rel, lits in scan(root).items() for lit in lits} + check(bool(base - renamed), "a renamed file leaves a stale baseline line (the engine#1728 lesson)") + + print("tmp_path_check self-test:", "ok" if bad == 0 else f"{bad} FAILED") + return 0 if bad == 0 else 1 + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/tools/ci/tmp_paths.txt b/tools/ci/tmp_paths.txt new file mode 100644 index 000000000..68cb92a2f --- /dev/null +++ b/tools/ci/tmp_paths.txt @@ -0,0 +1,20 @@ +# Hardcoded /tmp paths under npu/, app/, tools/, scripts/ - the sites that exist today. +# A ram on this box is tmpfs, so each of these is anonymous memory when it is written. +# This list may only SHRINK: fix a site, then delete its line. A new site fails +# tools/ci/tmp_path_check.py --check, and so does a line whose site is gone. +# Regenerate with: tools/ci/tmp_path_check.py --write-baseline + +app/npu_device_lock.h "/tmp/1bit-npu-device.lock" +app/serve.cpp "/tmp/1bit-hybrid-XXXXXX" +npu/forward/src/q4nx_forward.cpp "/tmp/a0-XXXXXX" +npu/forward/src/q4nx_forward.cpp "/tmp/npu_layer.bin" +npu/forward/src/q4nx_forward.cpp "/tmp/q4nx_hidden_%d.bin" +npu/ort/onebit_npu_gemm.cpp "/tmp/1bit-npu-device.lock" +npu/target/xdna/xdna_target.cpp "/tmp/a0-XXXXXX" +scripts/npu-window11.sh "/tmp/window11-$LABEL.log" +tools/spec_decode_acceptance_hrx.sh "/tmp/hrxacc-$PORT_D.log" +tools/spec_decode_acceptance_hrx.sh "/tmp/hrxacc-$PORT_T.log" +tools/spec_decode_acceptance_hrx.sh "/tmp/hrxacc-$port.log" +tools/spec_decode_speedup.sh "/tmp/specdec-$label.acc" +tools/spec_decode_speedup.sh "/tmp/specdec-$label.log" +tools/spec_decode_speedup.sh "/tmp/specdec-{lab}.acc" From a528dfaf57be4e98fa3c30e5c9482950129a4af8 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong <277547417+bong-water-water-bong@users.noreply.github.com> Date: Tue, 10 Nov 2026 17:18:21 -0400 Subject: [PATCH 2/4] tools/copyright: list tmp_paths.txt by name, beside the two other #-comment baselines refused the new baseline: `.txt` has no comment style of its own, and a blanket "*.txt" would demand a notice in files that are data. The two existing ratchet baselines (add_test_gaps.txt, unreferenced_tests.txt) are handled exactly this way, so this lists the third beside them - and --fix then wrote the notice it wanted, which is at the top of the file. --- tools/ci/tmp_paths.txt | 14 ++++++++++++++ tools/copyright.py | 9 ++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/ci/tmp_paths.txt b/tools/ci/tmp_paths.txt index 68cb92a2f..55cf380bb 100644 --- a/tools/ci/tmp_paths.txt +++ b/tools/ci/tmp_paths.txt @@ -1,3 +1,17 @@ +# Copyright 2026 bong-water-water-bong +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # Hardcoded /tmp paths under npu/, app/, tools/, scripts/ - the sites that exist today. # A ram on this box is tmpfs, so each of these is anonymous memory when it is written. # This list may only SHRINK: fix a site, then delete its line. A new site fails diff --git a/tools/copyright.py b/tools/copyright.py index c41b22e8e..705dc082c 100644 --- a/tools/copyright.py +++ b/tools/copyright.py @@ -44,13 +44,16 @@ # engine#1820: the other sweep's allow-list, same shape and the same reason -- `#`-comment data, `.txt` has no # style, and the header it wants is already at the top of the file. "unreferenced_tests.txt", - # engine#1946: the ctest skip baseline, the same shape and the same reason -- a '#'-comment data file whose header - # is the notice it would otherwise be asked for. (CI caught this on the PR: the tool refuses an unknown style rather + # engine#1946: the ctest skip baseline, the same shape and the same reason -- a '#'-comment data file whose + # is the notice it would otherwise be asked for. (CI caught this on the PR: the tool refuses an unknown sty # than passing it, which is the behaviour worth having.) "ctest_skips.txt", - # engine#2018: the third test-registration baseline, same shape and the same reason -- data, `.txt` has no style. + # engine#2018: the test-registration baseline of `tests/*_test.py`, same shape and the same reason -- data, "unreferenced_py_tests.txt", "hrx_f16_narrowing.txt", + # engine#2027: the `#`-comment baseline for hardcoded /tmp paths, same shape and the same reason -- + # data, `.txt` has no style, and the notice it wants is already at the top of the file. + "tmp_paths.txt", "21serial-console", "90onboard-limits", "Dockerfile", "*.Dockerfile", # cycle 17: Puppy's switch that skips its first-run Quick Setup is an empty marker file whose only content # is this notice - Puppy tests for its existence, so a comment is free From 21cba63e8ab6311d05a13ad7ae5359c7e7825fae Mon Sep 17 00:00:00 2001 From: bong-water-water-bong <277547417+bong-water-water-bong@users.noreply.github.com> Date: Tue, 10 Nov 2026 23:21:18 -0400 Subject: [PATCH 3/4] tmp_path_check: match the BARE spelling too - the review measured a 14-site baseline that was a 45-site tree The reviewer's hole, reproduced before fixing: echo x > "/tmp/quoted.log" -> caught echo y > /tmp/bare.log -> INVISIBLE The pattern required a leading quote, so `> /tmp/x.log`, `cp a /tmp/x` - the plain shell idiom, and the most likely form in scripts/*.sh - never matched. A ratchet that cannot see the common spelling of the thing it guards is a ratchet over quoted literals only, which is not what the 21:15Z directive was about. The anchor is now "not the tail of another path" instead of "a quote": (?`, `=`, a quote, or nothing. A trailing quote is stripped, so the baseline records the PATH: re-quoting a site is not a new site, and one path spelled two ways is not two lines. Re-measured after the fix, and the old baseline was an undercount by a factor of three: before 14 sites in 8 files after 45 sites in 18 files Ten files were entirely invisible: scripts/check-ubuntu-2604-lemond.sh (6 sites, including a downloaded `/tmp/engine.tar.zst` and its extracted tree), scripts/pkg-proof.sh (5), tools/npu-arena/*.sh (4), tools/showcase-612*.sh (2), tools/xhci_boot_capture.sh, tools/repro-hostgemm-lock.sh. Two new self-test arms assert it: "a bare /tmp path is a site (no quotes)" and "the bare form is recorded without a quote it never had". Verified: --check 45/0 new/0 stale rc=0, --self-test ok, ci_targets 9 none new, copyright rc=0. Also note the reviewer's second point: the red build at 110ba63 was `dist.tar.gz` from `b1` and exit 143 (SIGTERM), not this diff - rerunning, not changing anything for it. --- tools/ci/tmp_path_check.py | 28 ++++++++++++------ tools/ci/tmp_paths.txt | 59 +++++++++++++++++++++++++++++--------- 2 files changed, 65 insertions(+), 22 deletions(-) diff --git a/tools/ci/tmp_path_check.py b/tools/ci/tmp_path_check.py index f350156ac..ef8ab4fc7 100644 --- a/tools/ci/tmp_path_check.py +++ b/tools/ci/tmp_path_check.py @@ -40,10 +40,13 @@ import re import sys -# A literal `/tmp` path in C, C++ or shell, including its closing quote where there is one, so the baseline -# names the literal exactly as a reader finds it in the file. `["']` opens on either quote; a template literal -# with no closing quote on the same line (a shell `"${TMPDIR:-/tmp}/x"`) ends at what it matched. -LITERAL = re.compile(r"""["']/tmp/[^"'\s]*["']?""") +# A `/tmp` path in C, C++ or shell. The first version of this required a LEADING QUOTE, and a reviewer measured +# what that missed: `echo y > /tmp/x.log` -- a bare path, the plain shell idiom, and arguably the most likely form +# in `scripts/*.sh` -- was invisible, while the same path in quotes was caught. So the leading quote is gone and the +# anchor is "not the tail of another path": `(?`, `=`, a quote or nothing at all. A trailing quote +# is included when present so the baseline names the literal as a reader finds it. +LITERAL = re.compile(r"""(? dict[str, list[str]]: text = path.read_text(encoding="utf-8", errors="replace") except OSError: continue - hits = [m.group(0) for m in LITERAL.finditer(strip_comments(text, path.suffix))] + # A trailing quote is stripped so the baseline records the PATH: re-quoting a site (`"/tmp/x"` -> + # `/tmp/x`) is not a new site, and the two spellings of one path would otherwise be two baseline lines. + hits = [m.group(0).rstrip("\"'") for m in LITERAL.finditer(strip_comments(text, path.suffix))] if hits: found[rel] = sorted(set(hits)) return found @@ -212,11 +217,18 @@ def check(ok: bool, what: str) -> None: encoding="utf-8", ) found = scan(root) - check(found.get("npu/forward/dump.cpp") == ['"/tmp/npu_layer.bin"'], + check(found.get("npu/forward/dump.cpp") == ["/tmp/npu_layer.bin"], "a live literal is found and the two commented copies are not") - check('"/tmp/old.bin"' not in str(found), "a commented-out path is not a site") + check("/tmp/old.bin" not in str(found), "a commented-out path is not a site") check("tests/dump_test.cpp" not in found, "a test file is out of scope") - check('"/var/tmp/not_ours.bin"' not in str(found), "/var/tmp is not /tmp") + check("/var/tmp/not_ours.bin" not in str(found), "/var/tmp is not /tmp") + # engine#2027 review: the bare shell spelling, which the first pattern missed + (root / "tools" / "bare.sh").write_text('echo y > /tmp/bare.log\ncp a /tmp/b2\n', encoding="utf-8") + bare = scan(root) + check(bare.get("tools/bare.sh") == ["/tmp/b2", "/tmp/bare.log"], + "a bare /tmp path is a site (no quotes): the engine#2027 review's hole") + check(all('"' not in s and "'" not in s for s in bare.get("tools/bare.sh", [])), + "and the bare form is recorded without a quote it never had") # The ratchet: a new site fails, a stale baseline line fails, and an unchanged tree passes. write_baseline(root / "tools" / "ci" / "tmp_paths.txt", found) diff --git a/tools/ci/tmp_paths.txt b/tools/ci/tmp_paths.txt index 55cf380bb..ca1a2a583 100644 --- a/tools/ci/tmp_paths.txt +++ b/tools/ci/tmp_paths.txt @@ -18,17 +18,48 @@ # tools/ci/tmp_path_check.py --check, and so does a line whose site is gone. # Regenerate with: tools/ci/tmp_path_check.py --write-baseline -app/npu_device_lock.h "/tmp/1bit-npu-device.lock" -app/serve.cpp "/tmp/1bit-hybrid-XXXXXX" -npu/forward/src/q4nx_forward.cpp "/tmp/a0-XXXXXX" -npu/forward/src/q4nx_forward.cpp "/tmp/npu_layer.bin" -npu/forward/src/q4nx_forward.cpp "/tmp/q4nx_hidden_%d.bin" -npu/ort/onebit_npu_gemm.cpp "/tmp/1bit-npu-device.lock" -npu/target/xdna/xdna_target.cpp "/tmp/a0-XXXXXX" -scripts/npu-window11.sh "/tmp/window11-$LABEL.log" -tools/spec_decode_acceptance_hrx.sh "/tmp/hrxacc-$PORT_D.log" -tools/spec_decode_acceptance_hrx.sh "/tmp/hrxacc-$PORT_T.log" -tools/spec_decode_acceptance_hrx.sh "/tmp/hrxacc-$port.log" -tools/spec_decode_speedup.sh "/tmp/specdec-$label.acc" -tools/spec_decode_speedup.sh "/tmp/specdec-$label.log" -tools/spec_decode_speedup.sh "/tmp/specdec-{lab}.acc" +app/npu_device_lock.h /tmp/1bit-npu-device.lock +app/serve.cpp /tmp/1bit-hybrid-XXXXXX +npu/forward/src/q4nx_forward.cpp /tmp/a0-XXXXXX +npu/forward/src/q4nx_forward.cpp /tmp/npu_layer.bin +npu/forward/src/q4nx_forward.cpp /tmp/q4nx_hidden_%d.bin +npu/ort/onebit_npu_gemm.cpp /tmp/1bit-npu-device.lock +npu/target/xdna/xdna_target.cpp /tmp/a0-XXXXXX +scripts/check-ubuntu-2604-lemond.sh /tmp/backend.log +scripts/check-ubuntu-2604-lemond.sh /tmp/engine +scripts/check-ubuntu-2604-lemond.sh /tmp/engine.tar.zst +scripts/check-ubuntu-2604-lemond.sh /tmp/engine.tar.zst:ro +scripts/check-ubuntu-2604-lemond.sh /tmp/engine/*/install-lemonade-ppa.sh +scripts/check-ubuntu-2604-lemond.sh /tmp/lemond.log +scripts/npu-window11.sh /tmp/window11-$LABEL.log +scripts/pkg-proof.sh /tmp/b1.log +scripts/pkg-proof.sh /tmp/b2.log +scripts/pkg-proof.sh /tmp/ecmod.ko +scripts/pkg-proof.sh /tmp/engine.log +scripts/pkg-proof.sh /tmp/engv.log +scripts/pkg-proof.sh /tmp/hb.log +scripts/pkg-proof.sh /tmp/i1.log +scripts/pkg-proof.sh /tmp/i2.log +scripts/pkg-proof.sh /tmp/install.log +scripts/pkg-proof.sh /tmp/k.log +scripts/pkg-proof.sh /tmp/kr.log +scripts/pkg-proof.sh /tmp/r.log +scripts/pkg-proof.sh /tmp/re.log +scripts/pkg-proof.sh /tmp/rr.log +tools/npu-arena/ceiling.sh /tmp/ceiling.XXXXXX +tools/npu-arena/make_probe.sh /tmp/arena-probe.\$\$.XXXXXX +tools/npu-arena/make_task.sh /tmp/arena-build.$$.XXXXXX +tools/npu-arena/oracle.sh /tmp/arena-$TASK-$$.last +tools/repro-hostgemm-lock.sh /tmp/1bit-npu-device.lock +tools/repro-hostgemm-lock.sh /tmp/hg-lock-$LABEL.log +tools/showcase-612-npu-streams.sh /tmp/1bit-npu-device.lock +tools/showcase-612.sh /tmp/1bit-npu-device.lock +tools/spec_decode_acceptance_hrx.sh /tmp/hrxacc-$PORT_D.log +tools/spec_decode_acceptance_hrx.sh /tmp/hrxacc-$PORT_T.log +tools/spec_decode_acceptance_hrx.sh /tmp/hrxacc-$port.log +tools/spec_decode_acceptance_hrx.sh /tmp/hrxacc-prompt.txt +tools/spec_decode_speedup.sh /tmp/specdec-$label.acc +tools/spec_decode_speedup.sh /tmp/specdec-$label.log +tools/spec_decode_speedup.sh /tmp/specdec-B.log +tools/spec_decode_speedup.sh /tmp/specdec-{lab}.acc +tools/xhci_boot_capture.sh /tmp/xhci-capture-$stamp From cd60918f36643a56bf96a57ce23b94f64aa16f49 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong <277547417+bong-water-water-bong@users.noreply.github.com> Date: Tue, 10 Nov 2026 23:50:47 -0400 Subject: [PATCH 4/4] tmp_path_check: drop the xhci_boot_capture.sh site - main fixed it, and the ratchet's stale arm said so Rebasing onto main made the checker report its own first real fix: tmp_path_check: baseline line has no site any more (fixed or renamed): tools/xhci_boot_capture.sh /tmp/xhci-capture-$stamp - delete it if fixed Verified in main's file before deleting the line: the capture now goes to ${XDG_CACHE_HOME:-$HOME/.cache}/1bit/captures with a comment that says why ("NEVER /tmp: on strixhalo /tmp is tmpfs"), which is the rule this ratchet encodes. 44 baselined sites, none new, none stale, rc=0. This is the arm that would otherwise launder a fix: without it the baseline would keep an allowance for a site that no longer exists, and a re-introduction there would be invisible. --- tools/ci/tmp_paths.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/ci/tmp_paths.txt b/tools/ci/tmp_paths.txt index ca1a2a583..809555156 100644 --- a/tools/ci/tmp_paths.txt +++ b/tools/ci/tmp_paths.txt @@ -62,4 +62,3 @@ tools/spec_decode_speedup.sh /tmp/specdec-$label.acc tools/spec_decode_speedup.sh /tmp/specdec-$label.log tools/spec_decode_speedup.sh /tmp/specdec-B.log tools/spec_decode_speedup.sh /tmp/specdec-{lab}.acc -tools/xhci_boot_capture.sh /tmp/xhci-capture-$stamp