Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions specs/tri/t27b/timeout_terminal.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// SPDX-License-Identifier: Apache-2.0
// specs/tri/t27b/timeout_terminal.t27 -- which corpus timeouts are terminal,
// so the redundant retry (#6063) is skipped.
//
// The retry exists for ONE purpose: to tell a contention-timeout in the
// parallel pass from a genuine infinite loop. A spec whose timeout is already
// CLASSIFIED as a genuine infinite loop does not need the retry -- the retry
// is dead time, and it can never change a "timeout" into anything else.
//
// What is suppressed: ONLY the retry. The initial run is always performed; its
// verdict stays "timeout" (non-success). Nothing here turns a timeout into a
// pass, a skip-as-success, or a cached success.
//
// Classification binding (owner order 2026-11-04): one entry holds, and the
// retry is suppressed, only when ALL of these match the recorded values:
// path the repo-relative spec path, byte-exact
// toolchain the reference-cache key verdict_key.t27 names (#8095): the
// spec and its `use` closure, the code `t27c gen` makes of it,
// the test runner, `zig version`, and the host arch -- so a
// changed spec, changed import, changed compiler/gen, changed
// runner, changed zig, or changed host invalidates the entry
// timeout_ms the t27b-native execution timeout the run was made under
//
// A changed or unrecognised classification, and an entry whose toolchain is
// still zero (unfilled), all fall back to the existing retry -- the predicate
// returns false and the caller reruns exactly as today.
//
// Why --reference-timeout-ms is NOT in the binding: the retried verdict is the
// t27b-native Outcome::Timeout, produced by `run_one` under `--timeout-ms`
// only (cli/t27b/src/main.rs: `run_capture(..., o.timeout_ms)`). The reference
// path's `Reference::Timeout` is a separate verdict that is never retried
// (main.rs retry predicate is `matches!(r.r, Outcome::Timeout)`).
//
// Evidence: docs/now/2026-10-05-t27b-timeout-retry.md names the three below as
// the genuine infinite loops the retry was built around.
// ASCII only (L3). phi^2 + 1/phi^2 = 3 | TRINITY

module T27bTimeoutTerminal;

// Entry 0. Toolchain = the actual verdict_key from the built t27b
// (bootstrap run, t27c @ /Users/playra/t27/target/release/t27c, macOS arm64), 2026-11-04.
pub const T0_PATH : str = "specs/fpga/testbench/axi4_tb.t27";
pub const T0_TOOLCHAIN : u64 = 5728463738309294493;
pub const T0_TIMEOUT_MS : u64 = 60000;
pub const T0_EVIDENCE : str = "docs/now/2026-10-05-t27b-timeout-retry.md";

// Entry 1.
pub const T1_PATH : str = "specs/fpga/testbench/clock_domain_tb.t27";
pub const T1_TOOLCHAIN : u64 = 15950203674166270488;
pub const T1_TIMEOUT_MS : u64 = 60000;
pub const T1_EVIDENCE : str = "docs/now/2026-10-05-t27b-timeout-retry.md";

// Entry 2. REJECTED (2026-11-04 measurement): gf16_accel_tb timed out at
// --jobs 8 and at --jobs 4 (two of three runs), but completed in one --jobs 4
// run, so its timeout is contention-dependent, NOT a genuine infinite loop.
// It stays on the normal retry: toolchain left zero so it never suppresses.
pub const T2_PATH : str = "specs/fpga/testbench/gf16_accel_tb.t27";
pub const T2_TOOLCHAIN : u64 = 0;
pub const T2_TIMEOUT_MS : u64 = 60000;
pub const T2_EVIDENCE : str = "docs/now/2026-10-05-t27b-timeout-retry.md (superseded by measurement)";

/// One entry's decision. The toolchain MUST be non-zero: an unfilled entry
/// (0) never suppresses, even when the caller's key is also 0, so a
/// placeholder can never silently skip a retry.
pub fn entry_suppresses(path: []const u8, entry_path: []const u8, vk: u64, entry_toolchain: u64, timeout_ms: u64, entry_timeout: u64) -> bool {
return entry_toolchain != 0 and vk == entry_toolchain and timeout_ms == entry_timeout and same(path, entry_path);
}

/// Whether a timed-out file's retry is redundant. `reference_present` must be
/// true: the verdict_key is minted by the reference runner, so without it the
/// timeout's stability is unproven and the retry always runs. false => retry.
pub fn retry_suppressed(path: []const u8, vk: u64, timeout_ms: u64, reference_present: bool) -> bool {
if (reference_present == false) { return false; }
if (entry_suppresses(path, T0_PATH, vk, T0_TOOLCHAIN, timeout_ms, T0_TIMEOUT_MS)) { return true; }
if (entry_suppresses(path, T1_PATH, vk, T1_TOOLCHAIN, timeout_ms, T1_TIMEOUT_MS)) { return true; }
if (entry_suppresses(path, T2_PATH, vk, T2_TOOLCHAIN, timeout_ms, T2_TIMEOUT_MS)) { return true; }
return false;
}

fn same(a: []const u8, b: []const u8) -> bool {
if (a.len != b.len) { return false; }
var i : usize = 0;
while (i < a.len) {
if (a[i] != b[i]) { return false; }
i = i + 1;
}
return true;
}

test a_matching_entry_suppresses {
assert entry_suppresses("a", "a", 5, 5, 60000, 60000);
}

test an_unfilled_toolchain_never_suppresses_even_at_vk_zero {
assert entry_suppresses("a", "a", 0, 0, 60000, 60000) == false;
assert entry_suppresses("a", "a", 5, 0, 60000, 60000) == false;
}

test a_changed_toolchain_retries {
assert entry_suppresses("a", "a", 5, 6, 60000, 60000) == false;
}

test a_changed_timeout_retries {
assert entry_suppresses("a", "a", 5, 5, 60000, 61000) == false;
}

test a_changed_path_retries {
assert entry_suppresses("a", "b", 5, 5, 60000, 60000) == false;
}

test an_unknown_file_retries {
assert retry_suppressed("specs/not/classified.t27", 5, 60000, true) == false;
}

test no_reference_never_suppresses {
// without a reference runner the verdict_key cannot be minted, so a
// matched entry must still retry (the caller's reference_present is false)
assert retry_suppressed(T0_PATH, T0_TOOLCHAIN, T0_TIMEOUT_MS, false) == false;
}

test a_classified_but_unfilled_entry_retries {
assert retry_suppressed(T0_PATH, 0, 60000, true) == false;
assert retry_suppressed(T1_PATH, 0, 60000, true) == false;
assert retry_suppressed(T2_PATH, 0, 60000, true) == false;
}

test a_matched_entry_with_reference_suppresses {
assert retry_suppressed(T0_PATH, T0_TOOLCHAIN, T0_TIMEOUT_MS, true);
assert retry_suppressed(T1_PATH, T1_TOOLCHAIN, T1_TIMEOUT_MS, true);
}
Loading