Repository navigation
hip_f16_audit: order by narrowings and roll up the tail after 20 rows - #2417
Conversation
engine#2415 made the narrowing arm count (_Float16) casts, which on gpu-kernels 96593660718d is 62 rows across 68 kernel files. A closing line saying '3 narrowing(s), which are format writes unless a file says otherwise' was a footnote under a table nobody reads in full, and the files worth looking at -- 11 and 10 narrowings in hrx_dense_prefill.hip and hrx_prefill_gemm.hip -- were buried alphabetically. I raised this on #2415; this is the change. rows sort by (-narrowings, -accumulators, file) the first 20 print, then '... 48 more file(s), 4 narrowing(s) among 4 of them (--top 0 for every row)' --top N overrides, --top 0 prints every row (the pre-rollup behaviour) --json unchanged: still exactly the JSON, no rollup line Measured on the real tree: the first four rows are hrx_dense_prefill 11, hrx_prefill_gemm 10, gptoss_attn_sink_decode 4, gptoss_rope_kv_decode 3; --top 0 still prints 68 rows; --json still parses as 68. Two arms added to --self-test, and the ctest row (hip_f16_audit_self) passes.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
VERDICT: READY Independent of the wiring question (see my notes on #2418/#2419/#2420), and right on its own terms: a 62-row table that buries the files that matter is a table nobody reads, and solving it by ordering rather than by truncating keeps every row visible. Sorting by something that puts the add-on's own kernels first — rather than alphabetically — is the correct fix for an audit whose consumer is "is our code clean", not "what does the tree contain". One suggestion: if the order is now meaningful (ours first), say so in the header line. An ordering that looks arbitrary invites the next person to restore alphabetical sort and re-bury the rows. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 1441c1b: READY
The presentation change is right and the ordering is the part that matters, because it sorts by the failing property first:
ordered = sorted(rows, key=lambda r: (-r["narrowings"], -len(r["accumulators"]), r["file"]))
limit = 20 if top is None else top
shown = ordered if limit <= 0 else ordered[:limit]- accumulators sort ahead of everything (
-len(r["accumulators"])beforefile), so the files that fail the audit are the ones inside the window even when 62 rows are competing for it; --top 0prints every row, so the pre-rollup table is one flag away rather than gone;- and the tail is counted rather than dropped —
… N more file(s), M narrowing(s) among …— which is the difference between a rollup and a truncation; - the threshold is justified by a measurement: "on gpu-kernels 965936607 is 62 rows — more than a reader scans."
One note, and it is the rollup counting the wrong column
The hidden-tail summary counts narrowings, which is the informational property, and not accumulators, which is the one that fails the run. The with_narrowings sum is computed and there is no equivalent for accumulators.
That matters only in the case where more than 20 files carry an f16 accumulator — then the tail holds failing rows and the summary line would report them as "N more files, M narrowings" with no mention of the failures it is hiding. The exit code is unaffected (it is computed from all rows, so CI still fails), which is why this is a note and not a condition — but the summary is read by a human deciding what to fix, and the audit's own severity split says narrowings are context and accumulators are the defect. One term in the same f-string:
… {len(rest)} more file(s), {sum(r['narrowings'] for r in rest)} narrowing(s),
{sum(1 for r in rest if r['accumulators'])} with an f16 accumulator
Nothing else to change. #2417 is the one PR in this cluster that is orthogonal to the caller collision on #2418/#2419/#2420 — it changes how the audit reports, not how it is invoked — so it can land in any order.
And the description's own framing is worth keeping: "order by narrowings and roll up the tail after 20 rows" is a display change described as one, with the number of rows and the flag that undoes it. That is the shape a presentation PR should take.
The table this tool prints is now 62 rows long, and the files that matter were buried alphabetically
engine#2415 made the narrowing arm count
(_Float16)casts. On gpu-kernels96593660718dthat is 62 narrowings across 68 kernel files, and the closing line — "3 narrowing(s), which are format writes unless a file says otherwise" — was a footnote under a table nobody reads in full. I raised it on that PR; this is the change.What it does
Rows sort by
(-narrowings, -accumulators, file), so the files with something to look at come first — before this change the top of the list was alphabetical (f16_mask.hipfirst, and the two 10-plus files 40 rows down).--top Noverrides the 20-row default;--top 0prints every row, i.e. the pre-rollup behaviour, so nothing is hidden behind an option nobody knows;--jsonis untouched: exactly the JSON array, no rollup line (the property--jsonshould have, and the one hip_f16_audit: the audit #2406 asks for on a pin bump, mechanised (and it caught itself on the first run) #2409 initially got wrong).Verified
No change to what is counted or what fails: an f16 accumulator still fails, a narrowing is still a note, and the exit codes are the same.
Refs engine#2415 (the count this makes readable), engine#2409 / #2411 / #2413 (the tool and its gates), engine#2406 (the scope line it discharges).