Repository navigation
ci: a bench table is only a measurement if its backend initialised (engine#2858) - #2892
Conversation
…ngine#2858) A llama-bench run whose HRX runtime failed to initialise still prints a full results table labelled 'backend HRX', from whatever path it fell back to. Measured on the shipped bench tree on a box it was not built on: 2026-11-18 IQ1_S pp512 11.22 runtime: 'did not initialise ... registers no devices' 2026-11-19 IQ1_S pp512 73.61 same sentence in the log So NEITHER number was an HRX measurement -- which is why one artifact can be 5x slow against local builds on one day and 30 % fast on the next while its kernel code objects are irrelevant, and why the row's lowering-provenance line of investigation is a dead end. The table is the only artefact anybody keeps, and it looks identical either way. tools/ci/hrx_bench_backend_check.py --log bench.log # 0 initialised, 1 it did not, 2 cannot tell The arms, each one a shape this week produced: a clean table passes; the engine#2858 shape (table beside 'did not initialise') fails and quotes the line; the failure alone fails; an empty log and a table-less log are 2, not a pass; the match is case-insensitive so a reworded capitalisation cannot slip through; and a CPU table is 2, because this tool does not certify a backend it was not asked about. Checked against the two real logs from the runs behind engine#2858: both rc 1, naming the line and the two result rows beside it. Registered as ctest hrx_bench_backend_self in its own cmake/tests-hrx-bench.cmake (engine#1979's convention), plus a docs/bench.md section. Refs #2858.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
This is the root cause of #2858, and it explains in one measurement what three days of "the tree reports IQ1_S prefill 5× low" could not: neither number was an HRX measurement at all.
2026-11-18 shipped tree IQ1_S pp512 11.22 ± 0.10 runtime: "did not initialise … registers no devices"
2026-11-19 same tree IQ1_S pp512 73.61 ± 0.14 same sentence in the log
Both carried
hrx_gpu_initialize(0) failed: … symbol 'hsa_amd_queue_create' not found in library
ggml_hrx: the HRX runtime did not initialise, so this backend registers no devices
A 6.6× difference between two runs of the same tree, and the explanation is that both were CPU — one on a loaded box, one on an idle one. That is the worst kind of measurement artifact: not a wrong number, but a complete, plausible, labelled results table (backend HRX0 in the header) produced by a backend that registered no devices. Nothing in the table says "this is the CPU"; the evidence is a log line two screens away.
And it is my own lane's trap, caught in a different tool: the guard I have been using all session — --list-devices | grep -qiE 'hrx|gfx' || exit 2 — exists precisely because the system libhsa-runtime64.so.1 lacks hsa_amd_queue_create, so a build that links the wrong library registers no devices and every op silently runs on the CPU. Here the bench harness had no such guard, and three days of analysis followed a number that the harness could have refused to print.
Refusing to emit the table unless the backend initialised is the right fix, and — importantly — it is the same rule as the rest of tonight: an artifact must not be publishable when it cannot say what produced it. Two things I would want:
- make the failure mode the absence of a table, not a label on it. If the check is a note added to the header (
runtime: did not initialise), a reader can still quote the numbers; if the tool exits non-zero with no table, the number cannot be quoted at all. The measured cost of the softer version is exactly this issue: two tables, both labelled, both wrong. - say what the check asserts —
ggml_backend_dev_count() > 0and the backend's own name in the device list, or the log line? A log-line check is a string match on stderr (fragile: the wording changed once already between#2538and now); a device-count check is a property of the process. The stronger one is one line of API and cannot be reworded away.
Not blocking: this is the finding that reframes #2858 from "prefill is slow" to "the bench measured the CPU and called it HRX", and it was found by reading two log lines rather than by re-running the benchmark.
|
VERDICT at That is exactly the #2858 hazard: the row is present, labelled This closes the loop on #2858's real finding rather than its first reading: the shipped tree could not initialise HRX in any configuration tried, so neither 11.22 nor 73.61 was an HRX number, and the reason one artifact looked 5× slow one day and 30 % fast the next is that both tables came from a path that is not the backend in their column. A check that refuses those rows by name is worth more than any single re-measurement, because the next person to run that tree will paste the same table. Two notes, neither blocking:
Not verified: the device side — no bench was run here, and none is needed to judge this change; it reads logs. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 1f02d28: READY
I ran the incident shape through it and it fails: a log with the initialisation failure and a full backend HRX table beside it returns 1, quoting the line and the row count.
The incident, in the tool's own words
*"a shipped bench tree on a box it was not built on reported IQ1_S
pp512 11.22on 2026-11-18 and73.61on the same tree a day later, and in BOTH logs the runtime saidhrx_gpu_initialize(0) failed: … symbol 'hsa_amd_queue_create' not found in library ggml_hrx: the HRX runtime did not initialise, so this backend registers no devicesSo neither number was an HRX measurement, and comparing either to a working local build compares two different backends. The failure is silent in the only artefact anybody keeps — the table — which is why this is a check and not a convention."*
"Neither number was an HRX measurement" is the sharp part: a 6.6× swing between two runs of the same tree, with the explanation printed in both logs and read by nobody, because the product is a table.
Run
$ hrx_bench_backend_check.py --log bad.log (init failure + HRX table)
rc=1
"…: the runtime says it did not initialise (1 result row(s) beside it):"
--self-test rc 0, 8 arms
The eight arms are the right eight, and three of them are the ones that matter
ok the engine#2858 shape fails: a table printed by a runtime that did not initialise
ok and the reason quotes the line rather than counting rows
ok an empty log is cannot-tell, not a pass
ok a CPU table is not an HRX measurement, and this tool does not pass it as one
- "quotes the line rather than counting rows" — a message that says "3 rows" is not actionable; one that prints the
dlopenfailure is. - "an empty log is cannot-tell, not a pass" — the rule this lane has applied to every instrument tonight, and the one that turns a broken capture into a red rather than a green.
- "a CPU table is not an HRX measurement" — the discrimination arm. A
backendcolumn that saysCPUis the other way to get a table that is not an HRX number, and a checker that only looks for the failure line would pass it.
Why the exit contract is the correct one here
0 a table from an initialised backend · 1 the log says it did not initialise or a run supplied both · 2 cannot tell. "A run supplied both" failing is the conservative and correct choice: a log holding an initialised run and a failed one cannot be attributed to either, so it is not a measurement of anything in particular. That is the same reasoning as merged-intact.py's "could not fetch" versus "fetched, still absent" — two different facts must not share a verdict.
One ask
The failure is detected by the line, not by the contract between the table and the runtime. If the runtime ever initialises and then the run reports a backend it did not get — e.g. a table labelled HRX produced while ngl=0 forced CPU layers — this tool passes it. That is a different failure from #2858 and probably a different ticket, but the docstring's claim "a table is only a measurement if its backend initialised" is slightly narrower than the check: it verifies initialisation happened, not that the numbers came from it. Worth one sentence, so the next reader knows the boundary of the guarantee rather than inferring a stronger one.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
ready for review at So the registration reaches ctest (nothing "Not Run"), the skip report is unchanged, and the arms execute in CI rather than only here. |
Refs #2858
A
llama-benchrun whose HRX runtime failed to initialise still prints a complete results table, labelledbackend HRX, from whatever path it fell back to. That is what poisoned #2858's table, and I have the two logs from the runs behind it:Both carried
so neither number was an HRX measurement. That is why one artifact can be 5× slow against local builds one day and 30 % fast the next while its kernel code objects are irrelevant — and why #2858's remaining "stale lowering" line of investigation is a dead end rather than a lead. A second attempt with
LD_LIBRARY_PATH=/opt/1bit/libhsaandIREE_HAL_AMDGPU_LIBHSA_PATHpointed at the only lib on this box that exportshsa_amd_queue_createprinted the same warning and the same kind of table (69.71 ± 3.98 / 4.53), so it is not a matter of which libhsa is on the path.What this adds
The failure is silent in the only artefact anybody keeps — the table looks identical either way — so this is a check rather than a convention.
2is not a pass: an empty log, or one with no result row and no runtime verdict, does not say a backend initialised.Arms (self-test, ctest
hrx_bench_backend_self)Each arm is a shape this week actually produced:
Evidence it works on the real thing
Both of my logs from the runs behind #2858, unchanged:
Scope
Three files, no behaviour change anywhere: the tool, its ctest row in its own
cmake/tests-hrx-bench.cmake(the engine#1979 convention, so it touches no line another PR edits), and adocs/bench.mdsection that says to run the check before quoting a rate.pre-pr-checks --base origin/main: 12 green / 3 skipped;copyright --checkrc 0;ci_targets"none new"; the tree configures.Root cause note for whoever owns the artifact: the shipped
libggml-hrx.soandllama-benchcarry a RUNPATH into/opt/rocm-therock/...(the CI runner's tree) and resolvelibhsa-runtime64.so.1through the loader cache instead of a path that exists on a foreign box. Fixing that is a CI-job/artifact decision, not a lane one — this PR only stops a fallback number from being read as a measurement.