From 4360df6e948cbc46d6c6855ce5223da120841284 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Sat, 14 Nov 2026 05:46:36 -0400 Subject: [PATCH] wire the add-on f16 audit: a row that runs it, and a skip that says it did NOT run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit engine#2416: `tools/ci/hip_f16_audit.py` gained a pin gate (#2411) and a self-test, and **nothing invoked the audit** — `grep -rn hip_f16_audit` found one `--self-test` row and no caller. So engine#2406's *"audit those on a pin bump"* stayed a thing a person had to remember, which is how engine#2409 read *"0 narrowing(s)"* on files that had six casts. The cause is structural: the audit needs a gpu-kernels checkout, and the engine checks out none (submodules are hrx-system, llama.cpp, xdna-driver). This lands the issue's own sketch, in the shape `tools/ci/hrx_f16_narrowing.py` already uses. **`tools/ci/hip_f16_audit_pinned.py`** finds a tree (`--dir`, then `$GPU_KERNELS_DIR`, then `third_party/gpu-kernels`) and either audits it or **exits 77** with a message that names the consequence: ``` SKIPPED: the add-on f16 audit did NOT run -- no gpu-kernels checkout at …/third_party/gpu-kernels set GPU_KERNELS_DIR (or clone the pinned tree into third_party/gpu-kernels); the instruction this enforces is engine#2406's 'audit those on a pin bump'. ``` Three arms, each run without a pipe: | setup | result | |---|---| | no tree | **77**, the message above | | `GPU_KERNELS_DIR` at a tree that is *not* the pin (`b0ed206` vs pin `9659366`) | **exit 2**, the #2411 gate refusing: *"audit the pinned tree or say which commit you audited with --expect-sha"* | | `--expect-sha` naming that tree | **exit 0**, a real audit: *64 kernel file(s), no f16 accumulator; 57 narrowing(s)* | **`cmake/tests-hip-f16-audit-pinned.cmake`** registers the row — and this is the detail the sketch omits: **`SKIP_RETURN_CODE 77`**. Without it CTest reports 77 as a *failure*, so the row would go red on every runner that has no private tree, which is the red people learn to ignore. With it, an absent tree is a **skip** and a present-but-wrong tree is still a failure. The other arms are unchanged where they must be: `--expect-sha` cannot be used to audit an arbitrary commit silently (it is explicit), and the pin gate still runs whenever a tree is present. Fixes #2416. Refs engine#2406, #2409, #2411, #2413, #2415. --- cmake/tests-hip-f16-audit-pinned.cmake | 25 ++++++++++ tools/ci/hip_f16_audit_pinned.py | 65 ++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 cmake/tests-hip-f16-audit-pinned.cmake create mode 100755 tools/ci/hip_f16_audit_pinned.py diff --git a/cmake/tests-hip-f16-audit-pinned.cmake b/cmake/tests-hip-f16-audit-pinned.cmake new file mode 100644 index 000000000..a0602979d --- /dev/null +++ b/cmake/tests-hip-f16-audit-pinned.cmake @@ -0,0 +1,25 @@ +# 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#2416: `tools/ci/hip_f16_audit.py` had a pin gate (engine#2411) and a self-test, and **nothing invoked the audit** -- `grep -rn +# hip_f16_audit` found one `--self-test` row and no caller, so engine#2406's "audit those on a pin bump" stayed a thing a person had to +# remember. That is how engine#2409 read *"0 narrowing(s)"* on files that had six casts. +# +# This row is the invoker. The audit needs a gpu-kernels checkout and the engine checks out none, so on a runner without one the +# wrapper exits 77 with a message that says the audit did NOT run -- loud, because a quiet skip is the failure mode. `SKIP_RETURN_CODE` +# is what makes 77 a *skip* rather than a red: without it CTest reports the row as failed, and a row that goes red for the absence of a +# private tree is a red people learn to ignore. +add_python_test(hip_f16_audit_pinned ${CMAKE_SOURCE_DIR}/tools/ci/hip_f16_audit_pinned.py --root ${CMAKE_SOURCE_DIR}) +set_tests_properties(hip_f16_audit_pinned PROPERTIES SKIP_RETURN_CODE 77) diff --git a/tools/ci/hip_f16_audit_pinned.py b/tools/ci/hip_f16_audit_pinned.py new file mode 100755 index 000000000..9b0bc4cc8 --- /dev/null +++ b/tools/ci/hip_f16_audit_pinned.py @@ -0,0 +1,65 @@ +#!/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. +"""Run the add-on f16 audit against the pinned gpu-kernels tree -- and say so loudly when it cannot. + +engine#2416: `tools/ci/hip_f16_audit.py` existed with a pin gate (engine#2411) and a self-test, and **nothing invoked it**: +`grep -rn hip_f16_audit` found one `add_python_test(... --self-test)` and no audit. The instruction engine#2406 put on the ratchet's +green line -- *"audit those on a pin bump"* -- stayed a thing a person had to remember, which is how engine#2409 read *"0 narrowing(s)"* +on files that had six casts. + +The audit needs a gpu-kernels checkout and the engine checks out none of its own (submodules are hrx-system, llama.cpp, xdna-driver), +so a runner has nothing to point `--dir` at. This wrapper is the invoker, in the same shape `tools/ci/hrx_f16_narrowing.py` already +uses: find a tree, audit it, and when there is none **exit 77 with a message that names the consequence**. 77 is CTest's skip code, +wired with `SKIP_RETURN_CODE` in the row that calls this. + +Two properties, both from the issue, both deliberately louder than a quiet pass: + +* the skip says **the audit did NOT run**, not "ok" -- a silent skip is the whole failure mode; +* when a tree *is* present the pin gate applies (#2411), so it cannot audit a commit that is not the one `config/gpu-kernels.config` + names; `--expect-sha` is for a candidate pin (`#2413`). +""" +import argparse +import os +import subprocess +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +SKIP = 77 + + +def main() -> int: + ap = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + ap.add_argument("--root", default=None, help="engine checkout (default: two levels above this file)") + ap.add_argument("--dir", default=None, help="gpu-kernels checkout (default: $GPU_KERNELS_DIR, then third_party/gpu-kernels)") + ap.add_argument("--expect-sha", default=None, help="audit THIS commit instead of the pinned one (a candidate pin)") + args = ap.parse_args() + + engine_root = args.root or os.path.dirname(os.path.dirname(HERE)) + kernels = args.dir or os.environ.get("GPU_KERNELS_DIR") or os.path.join(engine_root, "third_party", "gpu-kernels") + if not os.path.isdir(os.path.join(kernels, "addons", "hip-hrx", "kernels")): + print("SKIPPED: the add-on f16 audit did NOT run -- no gpu-kernels checkout at %s" % kernels) + print(" set GPU_KERNELS_DIR (or clone the pinned tree into third_party/gpu-kernels);") + print(" the instruction this enforces is engine#2406's 'audit those on a pin bump'.") + return SKIP + + cmd = [sys.executable, os.path.join(HERE, "hip_f16_audit.py"), "--dir", kernels, "--config-root", engine_root] + if args.expect_sha: + cmd += ["--expect-sha", args.expect_sha] + return subprocess.call(cmd) + + +if __name__ == "__main__": + sys.exit(main())