Skip to content

hrx_build_scope: the repo's own add_python_test wrapper is not recognised, so a registration-only PR still pays the full HRX compile (measured on #3219 and #3217) #3228

Closed

Description

@bong-water-water-bong

hrx_build_scope.py does not recognise this repo's own registration wrapper, so a PR whose only change is a add_python_test(...) row pays the full ONEBIT_HRX compile — the commonest registration-only PR there is.

REGISTRATION (tools/ci/hrx_build_scope.py:86) matches add_test(, set_tests_properties( and set_property(TEST. It does not match add_python_test(, the single wrapper at CMakeLists.txt:552 that every new python row in this repo uses:

function(add_python_test name)
    if(Python3_Interpreter_FOUND)
        add_test(NAME ${name} COMMAND ${Python3_EXECUTABLE} ${ARGN})
        set_tests_properties(${name} PROPERTIES WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

It calls add_test and creates no target — a registration by the tool's own definition (rule 2 of its docstring), just spelled through the wrapper.

Measured on tonight's merged commits

git log replay, hrx_build_scope.py --base <sha>^1 --head <sha>:

6f124c74  #3219  tool_selftest_wired_check row tightening
          reason: added line is not a ctest registration: 'add_python_test(census_counters_self ${CMAKE_SOURCE_DIR}/tools/ci/census_counter'
          → full
b299efbc  #3217  registry_build --from-tarball, adds `add_python_test(registry_build_self …)`
          → full, same reason
10fdd3de  #3211  pin bump            → full, reason: a changed path outside the registration files (third_party/llama.cpp)   [correct]
fe48f4ad  #3213  card bytes          → full, reason: no changed path is a workflow trigger (manual run)                     [correct]

#3219's only effect on the HRX tree is five add_python_test rows and comments, plus a Python tool that is not a build input. It cost a full eight-minute compile on the one build runner to prove something configure already proves. Two of tonight's commits are in that class; every test-registration PR from here on is too, and the build queue is the fleet's stated bottleneck.

The fix, with the exclusion that keeps it honest

Treat add_python_test( as a registration unless the row hands ctest a built binary through $<TARGET_FILE:...> — that row does need the compile it names. No row on main uses $<TARGET_FILE: today (80 add_python_test rows, 0 matches), so the exclusion is for the day someone writes one, not for today.

Arms, both directions verified by mutation: the wrapper alone → configure-only; a wrapper row naming $<TARGET_FILE:onebit> → full; a wrapper row swapped for option(...) → full (the existing balance check). With the rule removed the first arm fails; with the TARGET_FILE exclusion removed the second fails.

Guards this does not weaken: the verdict stays full for any path outside the registration files, for a non-registration line in a registration file, and for a registration inside a foreach/function/macro. The skipped work is a compile, never a configure — the ONEBIT_HRX=ON configure still runs on every such PR, which is what a registration can actually break.

Activity

  1. bong-water-water-bong commented on Nov 21, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Two numbers for this issue now that it is merged, and one correction to my own body.

    Correction first: "eight-minute compile" was the tool's docstring, not this runner. I quoted it (hrx-build.yml's scope comment says an eight-minute compile on the bench runner) and did not check it against the runs. Measured durations of the last 30 hrx_build runs:

    success durations: min 0.2 min · median 2.0 min · max 5.4 min   (n=26)
    configure-only runs (cl-infra/3223-ctest-row-name): 0.2 min
    full runs, same branch: 2.0 / 1.9 / 2.7 min
    

    So the saving is ≈1.8 min of the single runner per registration-only PR, not eight. The claim that the compile was unnecessary was right; the size of it was not.

    Second: how often it happened. Replaying the last 80 merged commits through the tool before and after the fix (--base <sha>^1 --head <sha, verdict from stdout, exit 10 = full):

    full -> configure-only : 12 of 80   (15 %)
    full in both           : 68
    configure-only in both :  0
    

    The twelve are the registration-shaped commits, in order of recency:

    6f124c74 #3219  tool_selftest_wired_check rows        8aaf864c npu: two arms' residuals
    b299efbc #3217  registry_build --from-tarball          c1d1cbbe npu: window11 readiness reason
    8e8a2e02 npu: serve budget configurable               f2af3f33 ci: one shallow-clone guard
    76c62aeb coverage: Loom coverage map                  def282cd config: Loom toolchain pin
    e04ebc4f pre-pr-checks rc 2                          71360aad hrx2kineto --by-kernel
    2bf93623 test: shallow guards' wiring                 7ccdb0b0 hw-gate: NPU link gate
    

    ≈22 minutes of the one build runner across those 80 merges, and the class is self-renewing: a PR that adds a python test row is the commonest kind of PR in this repo.

    Both facts belong in the record because the issue's value is the class, not the one commit: any future change to REGISTRATION should be re-measured this way (replay, both directions, stdout verdict) rather than argued from the docstring — which is what produced my eight-minute error.

  2. bong-water-water-bong commented on Nov 21, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    The first realised instance, from the runner's own log rather than a replay. My merge landed 18:57:04Z; the next registration-shaped PR to run the job was cl-infra/3223-ctest-row-name at 19:01:25Z:

    hrx_build  Scope (compile, or configure only)
      reason: 1 ctest registration line(s), registration files only
    hrx_build  Configure only (test registration, no compile)
      "the ONEBIT_HRX=ON configure above passed, the compile is skipped"
    conclusion: success   start 19:01:25Z  end 19:01:36Z   → 0.2 min
    

    The same branch's three earlier runs (18:03, 18:20, 18:41 — all before the merge) were full at 2.7 / 2.0 / 1.9 min. So on the first opportunity the number moved by an order of magnitude, and the reason line names the new rule: "1 ctest registration line(s), registration files only" — a sentence the tool could not print before this change.

    Caveats, since n=1: this only proves the path is reachable in the runner, not the 15 % rate — that still comes from the 80-commit replay (12/80). And the sample is thin because hrx-build only triggers on nine paths, so a registration-only PR is the majority of what reaches it, not the majority of PRs.

    Note also what did not change: the ONEBIT_HRX=ON configure still ran (that is the step a registration can break), and every downstream step — mem-wait, build, stamp, fork ctest — is gated on build == 'true', so the skipped compile cannot leave this job reading a stale binary from the persistent $HRX_BUILD tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions