Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/pre-pr-checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
-->
# Before you ask for a merge

Ten commands, all host-side, none needing a device or a build. Every one of them answers a question that
Eleven commands, all host-side, none needing a device or a build. Every one of them answers a question that
`mergeable=true`, a green CI tick and a careful read of your own diff do not.

Run them from the repository root on the branch you are about to hand over.
Expand All @@ -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 --dir ../gpu-kernels --skip-if-absent` | an f16 narrowing in the **gpu-kernels add-on**, which the Loom ratchet cannot see; audits the tree the pin names, and skips with a reason when that checkout is absent (`GPU_KERNELS_DIR` says where yours is) |
| `git grep -l -F "$(basename <your new page>)" -- '*.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:
Expand Down
9 changes: 9 additions & 0 deletions scripts/pre-pr-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ 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 audit #2406 asks for on the ratchet's green line had no runner at all -- the tool
# existed, a gate existed (#2411), and nothing invoked either. It audits the gpu-kernels tree the pin names,
# so it needs that checkout; GPU_KERNELS_DIR says where a lane keeps it, and --skip-if-absent makes a lane
# without one report a skip WITH the reason instead of failing. Set GPU_KERNELS_REQUIRE=1 (a release build)
# to turn the skip into a failure.
"tools/ci/hip_f16_audit.py --dir ${GPU_KERNELS_DIR:-../gpu-kernels} --skip-if-absent"
)

# The page and this list drift apart, and it has happened twice in one night: the page said the runner "runs the first six"
Expand Down Expand Up @@ -117,6 +123,9 @@ for c in "${checks[@]}"; do
# a pass`, exits 2 and is left to fail: the tool already refuses to call that a pass.
# `--require-initialised` is where a release build turns this one into a failure.
case "$last" in
"hip_f16_audit: no gpu-kernels checkout at "*)
printf 'skip %-42s nothing audited: %s\n' "$name" "${last#hip_f16_audit: }"
skipped=$((skipped + 1)); continue ;;
"submodule_pin: 0 submodule(s) at their pinned commit, "*)
printf 'skip %-42s nothing compared: %s\n' "$name" "${last#submodule_pin: }"
skipped=$((skipped + 1)); continue ;;
Expand Down
11 changes: 11 additions & 0 deletions tools/ci/hip_f16_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ def chk(want, got, what):
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)")
# engine#2416: a lane without a gpu-kernels checkout next to its engine should SKIP, not fail -- a pre-PR
# check that fails for want of a second repository is one people learn to skip. The tool says it in its own
# voice and exits 0 so scripts/pre-pr-checks.sh can report the skip and its reason.
ap.add_argument("--skip-if-absent", action="store_true",
help="when --dir does not exist, say so and exit 0 (a skip, for a check runner)")
ap.add_argument("--json", action="store_true")
ap.add_argument("--config-root", help="an engine checkout: audit the tree the gpu-kernels pin names, and refuse "
"a tree at any other commit (an audit of the wrong tree reads as clean)")
Expand All @@ -248,6 +253,12 @@ def main(argv):
if not a.dir:
print("hip_f16_audit: --dir is required (the gpu-kernels checkout to audit)", file=sys.stderr)
return 2
if a.skip_if_absent and not Path(a.dir).is_dir():
# "cannot tell" is not a pass: the message says so, and the exit code tells a runner to count it skipped.
# stdout, not stderr: a check runner classifies by the tool's last line on stdout, and a skip is a
# result rather than an error.
print(f"hip_f16_audit: no gpu-kernels checkout at {a.dir} - cannot tell, and that is not a pass")
return 0
if a.expect_sha or a.config_root:
# engine#2406's instruction is "audit those on a pin bump": the audit is of THE PINNED TREE, and a checkout
# at another commit is exactly the false clean this tool exists to prevent.
Expand Down
Loading