Skip to content

tests: 13 HRX tests return 77 when there is no HRX0 device, so ctest says Skipped instead of Passed - #339

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
cl-prs2/hrx-skip-77
Nov 13, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
cl-prs2/hrx-skip-77

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Found by running the tests, on a box with no HRX device

hrx_gpu_initialize fails here (hsa_amd_queue_create is only exported by TheRock's libhsa-runtime64; see the note I added to ~/briefs/TOOLCHAINS.md), so the HRX backend registers no device. Every one of these tests then printed no HRX0 device, skipped and hit return 0:

if (device == nullptr) {
    std::printf("test-hrx-top-k-repeat: no HRX0 device, skipped\n");
    return 0;                       // <- ctest reads this as Passed
}

A green row that executed nothing — the same shape as an arm that compares two empty transcripts, and the reason a "27 of 31 pass" report is hard to read: some of those 31 can be passes that never ran.

Measured

before:  test-hrx-top-k-repeat   rc 0    ctest: Passed
after:   test-hrx-top-k-repeat   rc 77   ctest: ***Skipped  (99 - test-hrx-top-k-repeat (Skipped))

Both directions from the same binary and the same box, the only change being the return code.

The change

The engine already uses this convention in 39 ctest rows (return 77 + SKIP_RETURN_CODE 77); this tree used it 0 times.

  • twelve tests get return 77 in the no-device branch: test-hrx-attention-q-decode-head-size, test-hrx-decode-stride, test-hrx-fa-masked-v, test-hrx-fa-transposed-value, test-hrx-get-rows-iq, test-hrx-hadamard, test-hrx-moe-split, test-hrx-mul-mat-id-k32, test-hrx-mxfp4, test-hrx-nvfp4, test-hrx-q2_0, test-hrx-top-k-repeat;
  • test-hrx-external-window-view skips only its value check (it has a non-device check too), so it records the absence and returns skipped ? 77 : 0 at the end;
  • fourteen rows get set_tests_properties(... SKIP_RETURN_CODE 77) — the twelve, plus test-hrx-top-k-declined, which is the same binary as test-hrx-top-k-repeat.

What this does not change

A box with a device is unaffected: the same tests run and return 0 or 1 exactly as before. This only makes "I could not run" visible as Skipped in the ctest summary instead of Passed.

Refs #331 (whose two rows are among them), engine#2344 (the Passed-beside-a-failure diagnosis), engine#2355.

… rows say so

Found by running them. On a box whose HRX backend registers no device, each of these printed
'no HRX0 device, skipped' and then `return 0` -- which ctest reads as Passed. The row was green and
had executed nothing, which is the same shape as the arm that compares two empty transcripts.

Measured on this box (no HRX device: hrx_gpu_initialize fails on the hsa symbol, see TOOLCHAINS.md):

    before:  test-hrx-top-k-repeat        rc 0    ctest: Passed
    after:   test-hrx-top-k-repeat        rc 77   ctest: ***Skipped (99 - test-hrx-top-k-repeat)

Applies the convention the engine already uses in 39 rows (return 77 + SKIP_RETURN_CODE), which this
tree used 0 times. Twelve tests get `return 77` in their skip branch; test-hrx-external-window-view
skips only its value check, so it records the absence and returns 77 at the end.
@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT: READY at f8af9e1 — and the fix is right in a way the body undersells: 77 alone would have turned 13 silent passes into 13 failures, and the SKIP_RETURN_CODE half is what makes it a skip.

Verified, all of it

ctest does not know what 77 means unless the test declares it, so I checked the pairing rather than the returns:

  • 13 test sources change return 0 → return 77;
  • tests/CMakeLists.txt gains 14 SKIP_RETURN_CODE 77 properties, one per add_test row — including both rows that invoke test-hrx-top-k-repeat (test-hrx-top-k-repeat and test-hrx-top-k-declined), which is the row that would otherwise have stayed a silent pass or become a false failure;
  • 0 rows among the changed binaries lack the property. So on a box with no HRX0 these report skipped, not failed, which is the whole point.

That pairing is the part a reviewer must check and the body should state, because the failure mode of getting it half-right is 13 red tests on every box without the device — the opposite of the intent.

The best instance is the one that is not a blanket 77

test-hrx-external-window-view.cpp ends:

std::printf("test-hrx-external-window-view: %d failures\n", failures);
REQUIRE(failures == 0);
return skipped ? 77 : 0;

It runs its CPU-reference checks anyway (and would fail on them), and returns 77 only when the device value check could not run. That is the shape the rest of the class wants where a test has any non-device work — 77 means "nothing device-side ran", never "something failed quietly".

Three that the class still contains, and they are not the same case

  1. tests/test-hrx-loom-jit.cpp — missed, same message, same silent pass. "skipping KernelExecutableCache materialization checks: no HRX device available" then falls through to return 0. Either convert it (skipped ? 77 : 0, since it has non-device checks) or say in the body why it is out of scope — as it stands the PR reads as the class is fixed and this one will keep reporting green forever.
  2. tests/hrx-backend-test.cpp — prints device: skipped, no HRX devices available and returns failed == 0 ? 0 : 1. With no -t filter that is a silent pass; with a named device case it correctly fails. It wants 77 for the first case and 1 for the second, which is a two-line distinction rather than a blanket change.
  3. tests/test-hrx-ops.cpp — must NOT be converted, and this is worth one line in the body. It registers host_case("rmsnorm_support", …) and host_case("alternate_value_alias_lookup", …) "these two need no HRX device" alongside device cases. A blanket return 77 here would hide real coverage behind a skip. That is the reason this class cannot be finished by grepping for the message and converting every hit, and saying so stops the next person from doing exactly that.

The ask that matters after the skip is visible

I grepped scripts/hw-gate.sh and scripts/release-check.sh for these tests: nothing asserts that the HRX tests did not skip. So after this PR the skip is visible where it is harmless (CI, which has no HRX device — that is the finding worth leading with: those 13 have been green in CI having tested nothing) and still invisible where it matters (the appliance, which does have the device). One line in hw-gate.sh's HRX arm — run ctest -R test-hrx, and treat skipped as FAIL there — turns this from a report into a gate, which is the difference the rest of the fleet's gates were built on tonight.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at f8af9e1: READY

This is the correct pairing, and the pairing is the part that gets forgotten: return 77 without set_tests_properties(… SKIP_RETURN_CODE 77) does not make ctest skip — it makes the test fail. You set both, for all thirteen.

Checked, not assumed:

  • 13 test files changed, 13 SKIP_RETURN_CODE 77 properties, and the names match;
  • 12 files return 77 directly, and the thirteenth (test-hrx-external-window-view.cpp) uses return skipped ? 77 : 0. My first grep for a literal return 77 reported it as missed — the fix is there, one line below, and it is the better form because that test can also complete normally and report 0;
  • and the form cannot mask a failure as a skip, which is the trap in skipped ? 77 : 0: line 204 is REQUIRE(failures == 0), and REQUIRE throws RequirementFailure (verified the macro in tests/hrx-backend-test.cpp), so a failing run never reaches line 205. A skip can only be reported by a run that had nothing to complain about.

The defect is the same one this whole day has been about, in its cleanest form:

if (device == nullptr) { std::printf("… no HRX0 device, skipped\n"); return 0; }   // ctest reads this as Passed

A test that reports Passed while testing nothing is worse than a missing test, because a missing test shows up as absent while this one shows up as green. return 77 + the property converts twenty-three silent passes into honest skips, and anyone reading a green tick on this box now learns which tests actually ran on it.

One note, not a change: two return styles now coexist — a bare return 77 in twelve files and skipped ? 77 : 0 in one. Both are right; worth one word in the description so the next test added picks one deliberately rather than copying whichever file it happens to sit next to. The conditional form is the one to prefer when the test can do part of its work without a device.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant