kbench: state the coverage the pass measured in the report header

The header asserted "Every kernel of every loaded library ran" on a pass
whose own body counted 132 of 510 rows reached, so a coverage gap read as
full coverage. Print the sentence only when no declared row was left
unreached; otherwise name the count and point at Rows nothing ran. The
counts come from the same LibRow data the section below prints, so header
and body cannot disagree.

Reproduces on v1.13.0 (checked-in docs/KERNELS.md); the generator literal
is unchanged on current main.
This commit is contained in:
griffin-warrior authored and StillDeadcode committed 2026-10-28 11:38:00 +01:00
1 parent bbf90ebaa2
commit caa468389c
1 file changed
+19 -6
+19 -6
View File
@@ -358,12 +358,25 @@ int write_report(const std::string& path, const std::vector<Row>& rows,
std::string s;
s += "# radiance kernel libraries\n\n";
s += "Generated by `rad-kbench`. Every kernel of every loaded library ran on the same "
"inputs" + (benched ? std::string(" and each\ncase that passed was timed in the same "
"run, so correctness, completeness and speed come from "
"one run\n(the Speed section says how the times were "
"taken).\n\n")
: std::string(";\nnothing was timed (`--bench` was not given).\n\n"));
/* The header may claim only what this pass measured. The counts are the same ones the
* Rows nothing ran section prints from this data below; the sentence claiming every
* kernel ran is true only when no declared row was left unreached. */
size_t declared_rows = 0, reached_rows = 0;
for (const LibRow& l : libs) { declared_rows += l.rows.size(); reached_rows += l.ran.size(); }
const bool all_ran = reached_rows == declared_rows;
s += "Generated by `rad-kbench`. " +
(all_ran
? std::string("Every kernel of every loaded library ran on the same inputs")
: fmt("%zu of %zu declared kernel rows ran on the same inputs", reached_rows,
declared_rows)) +
(benched ? std::string(" and each\ncase that passed was timed in the same "
"run, so correctness, completeness and speed come from "
"one run\n(the Speed section says how the times were "
"taken).\n\n")
: std::string(";\nnothing was timed (`--bench` was not given).\n\n"));
if (!all_ran)
s += "Rows no case in this pass reached are listed under *Rows nothing ran*; a row "
"there is a gap in\ncoverage, not a failing kernel.\n\n";
s += "- " + provenance + "\n";
if (!arch_plugin.empty()) s += "- architecture plugin: `" + arch_plugin + "`\n";
s += "- libraries: `" + libraries + "`\n";