From ca73f0b0982a883491e8a9a37393918771bc69db Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Sat, 14 Nov 2026 05:48:02 -0400 Subject: [PATCH 1/2] ci: a hip_f16_audit ctest row audits the pinned gpu-kernels tree, or says it did not run (engine#2416) hip_f16_audit.py had a --self-test row and nothing that ran the audit. The engine has no gpu-kernels submodule, so --find ENGINE_ROOT looks for $GPU_KERNELS_DIR or third_party/gpu-kernels, audits it against config/gpu-kernels.config's pin (the #2411 gate refuses any other commit), and with no tree prints "the add-on f16 audit did NOT run" and exits 77, which the new hip_f16_audit row reports as skipped, not passed. Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 6 +++++ tools/ci/hip_f16_audit.py | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 669ccbe27..9673301f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -452,6 +452,12 @@ add_python_test(registry_loss_check_test ${CMAKE_SOURCE_DIR}/tests/registry_loss # engine#2406 puts "audit those on a pin bump" on the f16 ratchet's green line; this is that audit # for the HIP add-on's kernels, which the ratchet cannot see (it walks *.loom). add_python_test(hip_f16_audit_self ${CMAKE_SOURCE_DIR}/tools/ci/hip_f16_audit.py --self-test) +# engine#2416: the audit itself, not just its --self-test. The engine has no gpu-kernels submodule, so the row audits +# $GPU_KERNELS_DIR (or third_party/gpu-kernels) against config/gpu-kernels.config's pin, refuses a tree at any other +# commit, and with no tree prints "the add-on f16 audit did NOT run" and is reported as skipped (77), not passed. +add_test(NAME hip_f16_audit COMMAND ${Python3_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/tools/ci/hip_f16_audit.py --find ${CMAKE_SOURCE_DIR}) +set_tests_properties(hip_f16_audit PROPERTIES SKIP_RETURN_CODE 77) # engine#2398: the stale-branch test, which `tests_referenced` refuses to leave unregistered -- a test no # runner names is a test nobody runs. add_python_test(branch_stale_check_test ${CMAKE_SOURCE_DIR}/tests/branch_stale_check_test.py) diff --git a/tools/ci/hip_f16_audit.py b/tools/ci/hip_f16_audit.py index 6afde46b1..2699b6328 100644 --- a/tools/ci/hip_f16_audit.py +++ b/tools/ci/hip_f16_audit.py @@ -45,6 +45,7 @@ import argparse import json +import os import re import sys from pathlib import Path @@ -224,6 +225,29 @@ def chk(want, got, what): chk(False, sha_matches(None, at), "a tree with no commit never matches, not even a guess") chk(False, sha_matches(at, ""), "an empty expectation is not a wildcard") + # --find (engine#2416): where the ctest row looks, and that "nothing found" is a skip, never a clean pass + with tempfile.TemporaryDirectory() as tmp: + engine = Path(tmp) / "engine" + (engine / "third_party").mkdir(parents=True) + explicit = Path(tmp) / "gk" + explicit.mkdir() + chk(None, find_tree(engine, env={}), "no $GPU_KERNELS_DIR and no submodule: nothing found") + chk(str(explicit), find_tree(engine, env={"GPU_KERNELS_DIR": str(explicit)}), "$GPU_KERNELS_DIR is used") + chk(None, find_tree(engine, env={"GPU_KERNELS_DIR": str(Path(tmp) / "missing")}), + "a $GPU_KERNELS_DIR that is not a directory is not a tree") + (engine / "third_party" / "gpu-kernels").mkdir() + chk(str(engine / "third_party" / "gpu-kernels"), find_tree(engine, env={}), "the submodule path is used") + chk(str(explicit), find_tree(engine, env={"GPU_KERNELS_DIR": str(explicit)}), + "$GPU_KERNELS_DIR wins over the submodule") + empty = Path(tmp) / "empty-engine" + empty.mkdir() + saved = os.environ.pop("GPU_KERNELS_DIR", None) + try: + chk(SKIPPED, main(["--find", str(empty)]), "--find with no tree exits 77 (skipped), not 0") + finally: + if saved is not None: + os.environ["GPU_KERNELS_DIR"] = saved + if problems: for problem in problems: print("FAIL " + problem) @@ -232,6 +256,19 @@ def chk(want, got, what): return 0 +SKIPPED = 77 # ctest SKIP_RETURN_CODE: the same convention as hrx_f16_narrowing's "skip: no .loom corpus" + + +def find_tree(engine_root, env=None): + """The gpu-kernels checkout --find audits: $GPU_KERNELS_DIR, else /third_party/gpu-kernels. None when + neither is a directory -- the engine has no gpu-kernels submodule, so a plain checkout has none (engine#2416).""" + env = os.environ if env is None else env + for candidate in (env.get("GPU_KERNELS_DIR"), str(Path(engine_root) / "third_party" / "gpu-kernels")): + if candidate and Path(candidate).is_dir(): + return candidate + return None + + def main(argv): ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) ap.add_argument("--dir", help="a gpu-kernels checkout (must contain addons/hip-hrx/kernels)") @@ -241,10 +278,22 @@ def main(argv): ap.add_argument("--expect-sha", help="audit THIS commit (7..40 hex characters), for a candidate pin that has not " "merged yet; overrides --config-root. An audit of the wrong tree reads as " "clean, so the commit audited has to be asserted, not remembered") + ap.add_argument("--find", metavar="ENGINE_ROOT", + help="the ctest row (engine#2416): audit $GPU_KERNELS_DIR or ENGINE_ROOT/third_party/gpu-kernels " + "against ENGINE_ROOT's pin; with neither, say the audit did NOT run and exit 77 (skipped)") ap.add_argument("--self-test", action="store_true") a = ap.parse_args(argv) if a.self_test: return self_test() + if a.find: + tree = find_tree(a.find) + if tree is None: + print("SKIPPED: hip_f16_audit found no gpu-kernels tree ($GPU_KERNELS_DIR unset, no " + f"{Path(a.find) / 'third_party' / 'gpu-kernels'}) - the add-on f16 audit did NOT run") + return SKIPPED + a.dir = tree + if not a.expect_sha: + a.config_root = a.find if not a.dir: print("hip_f16_audit: --dir is required (the gpu-kernels checkout to audit)", file=sys.stderr) return 2 From 75ad5e69884083540ada45137fb1029b8fb86e87 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Sat, 14 Nov 2026 06:07:43 -0400 Subject: [PATCH 2/2] ci: pre-pr-checks runs the add-on f16 audit, and its skip says how to make it run (engine#2416 review) Both review notes on #2420: the audit is in scripts/pre-pr-checks.sh (and its page, which the runner cross-checks), with exit 77 counted as `skip` rather than FAIL; and the skip line names the setting that turns it into an audit. The page's count sentences are corrected (ten in the runner; the author's check is the eleventh row, not the eighth). Co-Authored-By: Claude Opus 5.5 --- docs/pre-pr-checks.md | 5 +++-- scripts/pre-pr-checks.sh | 9 +++++++++ tools/ci/hip_f16_audit.py | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/pre-pr-checks.md b/docs/pre-pr-checks.md index 6b3d544b9..56dc2af55 100644 --- a/docs/pre-pr-checks.md +++ b/docs/pre-pr-checks.md @@ -21,9 +21,9 @@ Ten commands, all host-side, none needing a device or a build. Every one of them Run them from the repository root on the branch you are about to hand over. -**`scripts/pre-pr-checks.sh` runs the first nine**, one line each (`--base ` for the registration check, `--list` to see the +**`scripts/pre-pr-checks.sh` runs the first ten**, one line each (`--base ` for the registration check, `--list` to see the commands; a check that cannot run says `skip` and why, and an unresolvable `--base` is a usage error rather than a skip). The -eighth is an **author's check**, true or false exactly once — when you add a page — so it is not in the runner, and the section +eleventh is an **author's check**, true or false exactly once — when you add a page — so it is not in the runner, and the section below says why. The table's order is the runner's order: cheapest and most common first, and the check that needs a revision (`registration_loss_check --base`) last. @@ -38,6 +38,7 @@ below says why. The table's order is the runner's order: cheapest and most commo | `python3 tools/ci/registration_loss_check.py --check --base origin/main` | your branch would drop rows `main` has | | `python3 tools/ci/registry_loss_check.py --base origin/main` | a reviewed class, a `coverage` counter or a test's mention of a class that the base has is gone at the merge, not only at the endpoint (engine#2385, #2391) | | `python3 tools/ci/branch_stale_check.py --base origin/main` | the merge with the base conflicts, or would not keep a base change the branch never touched; a branch that is only behind gets a note (the merge keeps the base's copy, but the branch's tests ran on the older one) (engine#2398, #2410) | +| `python3 tools/ci/hip_f16_audit.py --find .` | a HIP add-on kernel accumulates in f16, or the gpu-kernels tree is not at the pinned commit; `skip` (the audit did NOT run) when there is no tree: set `GPU_KERNELS_DIR` to a checkout at the pin | | `git grep -l -F "$(basename )" -- '*.md'` | nothing links to the page you just added — measured tonight: 45 docs, one with no inbound link, and it was the page whose whole subject is pre-merge checks | Two more, for the moments they are for: diff --git a/scripts/pre-pr-checks.sh b/scripts/pre-pr-checks.sh index 3cf383e1e..9b746a454 100755 --- a/scripts/pre-pr-checks.sh +++ b/scripts/pre-pr-checks.sh @@ -67,6 +67,9 @@ checks=( "tools/ci/registration_loss_check.py --check --base $base" "tools/ci/registry_loss_check.py --base $base" "tools/ci/branch_stale_check.py --base $base" + # engine#2416: the HIP add-on's f16 audit over $GPU_KERNELS_DIR (or third_party/gpu-kernels) at the pin; with no + # tree it exits 77 and is listed as `skip`, never `ok` + "tools/ci/hip_f16_audit.py --find ." ) # The page and this list drift apart, and it has happened twice in one night: the page said the runner "runs the first six" @@ -108,6 +111,12 @@ for c in "${checks[@]}"; do name=${c%% *} out=$(python3 $c 2>&1); rc=$? last=$(printf '%s\n' "$out" | grep -v '^$' | tail -1) + if [ $rc -eq 77 ]; then + # 77 is the repo's "cannot run here" (ctest SKIP_RETURN_CODE): counted as a skip with the tool's own + # reason, so the summary still says something did not run + printf 'skip %-42s %s\n' "$name" "$last" + skipped=$((skipped + 1)); continue + fi if [ $rc -eq 0 ]; then # `submodule_pin_check --check` exits 0 having compared NOTHING when submodules are declared but # none is checked out -- `0 submodule(s) at their pinned commit, N not initialised` -- which would diff --git a/tools/ci/hip_f16_audit.py b/tools/ci/hip_f16_audit.py index 2699b6328..3f65ab1af 100644 --- a/tools/ci/hip_f16_audit.py +++ b/tools/ci/hip_f16_audit.py @@ -289,7 +289,8 @@ def main(argv): tree = find_tree(a.find) if tree is None: print("SKIPPED: hip_f16_audit found no gpu-kernels tree ($GPU_KERNELS_DIR unset, no " - f"{Path(a.find) / 'third_party' / 'gpu-kernels'}) - the add-on f16 audit did NOT run") + f"{Path(a.find) / 'third_party' / 'gpu-kernels'}) - the add-on f16 audit did NOT run; set " + "GPU_KERNELS_DIR to a gpu-kernels checkout at the pin in config/gpu-kernels.config to run it") return SKIPPED a.dir = tree if not a.expect_sha: