From caa468389c839a7066185b5b81f81921b0b5c548 Mon Sep 17 00:00:00 2001 From: griffin-warrior Date: Wed, 28 Oct 2026 05:07:39 +0800 Subject: [PATCH] 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. --- tools/rad_kbench.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tools/rad_kbench.cpp b/tools/rad_kbench.cpp index 0b5d154c..5b47d678 100644 --- a/tools/rad_kbench.cpp +++ b/tools/rad_kbench.cpp @@ -358,12 +358,25 @@ int write_report(const std::string& path, const std::vector& 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";