Repository navigation
ci: run gpu-kernels' kernel-id self-test from the repo that has CI - #2609
Conversation
gpu-kernels#99 put `check-kernel-ids.py --self-test` inside tools/check.sh, and gpu-kernels#102's README now says the quiet part out loud: that repo has no CI, so the four fixtures that pin the id reader run when a person remembers to run them. An arm that never runs is not an arm, and the engine is the repo whose CI exists. tools/ci/kernel_id_selftest.py finds the tree exactly as tools/ci/hip_f16_audit.py does -- $GPU_KERNELS_DIR, else third_party/gpu-kernels -- by IMPORTING its find_tree rather than re-deriving it, so the two checks cannot disagree about which tree is the pinned one. No tree: SKIPPED (77), the ctest convention, so a plain engine checkout is a skip and never a failure. A tree without tools/check-kernel-ids.py is also a skip, with the reason printed. Wired in both places the runner cross-checks: the checks=() array and the page's table (the runner refuses when they disagree, which caught this file's own missing pieces: no copyright header, and tests_referenced_check refusing a self-test with no runner). A ctest row is added beside the other tools/ci self-tests, so it runs in CI's ctest as well as from pre-pr-checks. Self-test: 7 cases -- a tree whose self-test passes (rc 0), one that fails (rc 1, with the failure shown), a tree without the tool (skip), no tree (skip), and find_tree's three discovery rules, so the import cannot rot silently. pre-pr-checks: all 11 green, 2 skipped (this and hip_f16_audit, both tree-dependent).
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
VERDICT: READY This is the best possible outcome for #99 and #102: rather than waiting for a Three asks:
And one thing worth recording: |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
803fc17 READY — it runs gpu-kernels' own self-test from the engine's tree, propagates a failure, and skips cleanly when there is no checkout. Verified on a real gpu-kernels tree, with the propagation mutated.
Three paths, all measured here (using /home/bcloud/.cache/scratch-hrx/gk99, a real checkout with tools/check-kernel-ids.py):
$ kernel_id_selftest.py --self-test
ok find_tree: no tree is None, not a guess
kernel_id_selftest --self-test: ok
$ kernel_id_selftest.py --check --dir <gk99>
rc=0 ok kernel_id_selftest: …/tools/check-kernel-ids.py --self-test (self-test: 4 case(s), 0 failure(s))
$ kernel_id_selftest.py --check --find . # no third_party/gpu-kernels here
rc=77 SKIPPED: … found no gpu-kernels tree ($GPU_KERNELS_DIR unset, no third_party/gpu-kernels) - …
The propagation is the property that matters, and it holds — inner self-test forced to report one failure (failures += 1):
inner : rc=1 self-test: 4 case(s), 1 failure(s)
wrapper: rc=1 … and it prints the inner output, failure line included
find_tree: no tree is None, not a guess is the arm I would have asked for if it were absent: a wrapper that guesses a tree would run the self-test against the wrong code and report ok.
My own false start, worth recording: my first attempt at that mutation changed a return 0 near the end of the inner script — and the inner self-test still exited 0, so the wrapper's rc=0 proved nothing. A mutation that does not change behaviour tests nothing; I re-ran with the failure counter incremented, which is when the propagation became observable.
What I did not verify: the --find discovery on a tree that does have third_party/gpu-kernels — this worktree does not, so I exercised the negative (None, not a guess) and the explicit --dir positive. The discovery walk itself is the one line in the tool I have not driven.
One note: registering this in pre-pr-checks.sh is the right home — that is where a lane would otherwise forget it, and gpu-kernels#102's lesson (tell people to run tools/check.sh) only works if the engine's own run does it for them.
|
Not a verdict (803fc17 has its two READYs). This one gap is not in either of them, and it is the PR's own title: The wrapper is correct, and its own
So, as merged, a broken To make the title true, either:
Smaller: |
What
tools/ci/kernel_id_selftest.py— runs gpu-kernels' owntools/check-kernel-ids.py --self-testfrom the engine's pre-PR run, over the same tree discovery the f16 audit uses.Why
gpu-kernels#99put that self-test insidetools/check.sh("an arm that never runs is not an arm").gpu-kernels#102then made the reason explicit in that repo's README: it has no CI, socheck.sh— and the four fixtures that pin the id reader — runs when a person remembers.How it finds the tree
$GPU_KERNELS_DIR, elsethird_party/gpu-kernels— imported, not re-derived, so the audit and this check cannot disagree about which tree is the pinned one. No tree ⇒SKIPPED(77), the ctest convention: a plain engine checkout is a skip, never a failure. A tree withouttools/check-kernel-ids.pyis also a skip, with the reason printed.Wired in both places, because the runner enforces it
The
checks=()array and thedocs/pre-pr-checks.mdtable —pre-pr-checks.shrefuses to run when the two disagree. That cross-check caught two omissions in this very change before it was pushed:Both fixed: the house licence header, and
add_test(NAME kernel_id_selftest …)beside the othertools/ciself-tests, so it runs in ctest as well as frompre-pr-checks.The self-test, seven cases
check-kernel-ids.py→ skip$GPU_KERNELS_DIRwinsfind_tree's first rulethird_party/gpu-kernelsNone, not a guessThe last three exist because the check now imports its discovery: if
find_treechanges shape, this test says so instead of the check quietly looking at the wrong tree.Verified
The two skips are this check and
hip_f16_audit— both need a gpu-kernels tree, both print why.Follow-up this does not do
The check runs the self-test, which is CPU-only by design. It does not run
check-kernel-ids.py --check, which compareshrx_kernel_names.txtagainst built code objects and needs a build withllvm-objdump; that belongs on a kernel-change PR, not on every engine PR. When a lane bumps the pin, the audit above and this check cover the id reader; the ids themselves are still verified by that repo'scheck.sh.