Skip to main content

launchbound_report/
lib.rs

1//! The run report (`report.v1`). The section that prints every
2//! configuration that was **faster and refused** is the product: never
3//! soften, hide, or downrank it.
4
5mod build;
6mod render;
7
8pub use build::{RunDir, build_report};
9pub use render::render_text;
10
11use launchbound_bench::Summary;
12use serde::{Deserialize, Serialize};
13
14#[derive(Debug, thiserror::Error)]
15pub enum ReportError {
16    #[error("run dir: {0}")]
17    RunDir(String),
18    #[error("report io: {0}")]
19    Io(String),
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct Report {
24    pub schema: String,
25    pub kernel: String,
26    pub gate_cc: String,
27    /// `measured` or `estimated` — stamped on the report and every number
28    /// in it. Reporting an estimate as a measurement is release-blocking
29    /// (docs/LIMITATIONS.md).
30    pub measurement_kind: String,
31    /// `full` when every candidate passed through the reconverge gate;
32    /// `none` on the Metal path (there is no MSL analyzer — §3.4). The
33    /// renderer prints the no-gate notice unconditionally when this is
34    /// `none`; a test asserts it cannot be omitted.
35    pub convergence_gate: String,
36    #[serde(default, skip_serializing_if = "Option::is_none")]
37    pub device: Option<DeviceInfo>,
38    #[serde(default, skip_serializing_if = "Option::is_none")]
39    pub allow_unsafe_reason: Option<String>,
40    #[serde(default, skip_serializing_if = "Option::is_none")]
41    pub chosen: Option<ChosenInfo>,
42    /// IDs whose intervals overlap the chosen one: reported as
43    /// indistinguishable, never ranked (docs/BENCHMARKING.md).
44    #[serde(default)]
45    pub indistinguishable_from_chosen: Vec<String>,
46    /// THE section: refused configurations that measurably beat the chosen
47    /// one (their CI is entirely below the chosen CI).
48    #[serde(default)]
49    pub rejected_faster: Vec<RejectedFaster>,
50    pub candidates: Vec<CandidateReport>,
51    pub totals: Totals,
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
55pub struct DeviceInfo {
56    pub name: String,
57    pub cc: String,
58    pub driver_version: String,
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
62pub struct ChosenInfo {
63    pub id: String,
64    pub config: String,
65    pub summary: Summary,
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
69pub struct RejectedFaster {
70    pub id: String,
71    pub config: String,
72    pub summary: Summary,
73    /// chosen_median / this_median: how much faster the refused one was.
74    pub speedup_vs_chosen: f64,
75    pub rules: Vec<RuleRef>,
76}
77
78#[derive(Debug, Clone, Serialize, Deserialize)]
79pub struct RuleRef {
80    pub rule: String,
81    #[serde(default, skip_serializing_if = "Option::is_none")]
82    pub span: Option<String>,
83    pub reason: String,
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
87pub struct CandidateReport {
88    pub id: String,
89    pub config: String,
90    /// clean | admitted_with_caveats | disqualified | tool_error
91    pub verdict: String,
92    #[serde(default)]
93    pub rules: Vec<RuleRef>,
94    /// ok | error | timeout | unmeasured
95    pub measurement_status: String,
96    #[serde(default, skip_serializing_if = "Option::is_none")]
97    pub summary: Option<Summary>,
98    #[serde(default, skip_serializing_if = "Option::is_none")]
99    pub measurement_error: Option<String>,
100    pub gpu_seconds: f64,
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
104pub struct Totals {
105    pub candidates: usize,
106    pub admitted: usize,
107    pub refused: usize,
108    pub measured_ok: usize,
109    pub gpu_seconds: f64,
110}