matrix: the old path moving fails a leg unless its fix says so
The old runtime is frozen until the cutover: the translator's output through Device::new must not move. Today it moved three times through the shared path (half outputs widened, the half pair workarounds dropped, the stage-size rows dropped) and nothing caught it, because the golden table's failure read as "needs a bless" whatever moved. The golden table compiles through Device::new. Its test's stale message now counts each kind (new, gone, under a changed fixture source, under a changed profile fingerprint), from one tested function. The matrix reads the counts: a cell changed under an unchanged key, or one under a changed profile fingerprint, fails the leg with OLD PATH MOVED, unless a commit since the table's last bless says "old-runtime regression fix" (the fix of such a move, or a fix the old-runtime lane lands). New, gone and re-keyed fixture rows still only need a bless. Tests: scripts/matrix/test_results.py (16 pass; the new one feeds both panics as nextest prints them, a new-rows-only failure and a passing run, with and without the phrase); golden_hashes::only_a_cell_changed_under_its_key_needs_a_bump checks the counts' text.
This commit is contained in:
1 parent
2872c419e0
commit
a17eb26a6b
5 files changed
+86
-2
No files matched your search
@@ -915,6 +915,19 @@ fn diff(committed: &Table, observed: &Observed) -> Diff {
|
||||
d
|
||||
}
|
||||
|
||||
/// The stale cells by kind, in the words the matrix reads (scripts/matrix/results.py): a cell
|
||||
/// under a changed profile fingerprint is one whose device, built by `Device::new`, changed.
|
||||
fn stale_counts(stale: &[String]) -> String {
|
||||
let count = |kind: &str| stale.iter().filter(|l| l.starts_with(kind)).count();
|
||||
format!(
|
||||
"{} new, {} gone, {} under a changed fixture source, {} under a changed profile fingerprint",
|
||||
count("new:"),
|
||||
count("gone:"),
|
||||
count("fixture source changed:"),
|
||||
count("profile changed:")
|
||||
)
|
||||
}
|
||||
|
||||
fn shown(lines: &[String]) -> String {
|
||||
let mut s = String::new();
|
||||
for l in lines.iter().take(SHOWN) {
|
||||
@@ -997,9 +1010,10 @@ fn matches_the_table(golden: Golden, devices: &[(String, Device)], observed: &Ob
|
||||
if !d.stale.is_empty() {
|
||||
panic!(
|
||||
"{table} is stale: {} cell(s) are new, gone, or under a changed fixture source or \
|
||||
profile (their keys changed, so no SEMANTICS_VERSION bump is needed). Bless it \
|
||||
profile (their keys changed, so no SEMANTICS_VERSION bump is needed): {}. Bless it \
|
||||
with\n {BLESS}\n{}",
|
||||
d.stale.len(),
|
||||
stale_counts(&d.stale),
|
||||
shown(&d.stale)
|
||||
);
|
||||
}
|
||||
@@ -1151,8 +1165,16 @@ fn only_a_cell_changed_under_its_key_needs_a_bump() {
|
||||
assert_eq!((d.changed.len(), d.stale.len()), (0, 1));
|
||||
let d = diff(&base, &observed(table("s", "f2", &[("a.ll", "h2")]), &[]));
|
||||
assert_eq!((d.changed.len(), d.stale.len()), (0, 1));
|
||||
assert_eq!(
|
||||
stale_counts(&d.stale),
|
||||
"0 new, 0 gone, 0 under a changed fixture source, 1 under a changed profile fingerprint"
|
||||
);
|
||||
let d = diff(&base, &observed(table("s", "f", &[("b.ll", "h1")]), &[]));
|
||||
assert_eq!((d.changed.len(), d.stale.len()), (0, 2));
|
||||
assert_eq!(
|
||||
stale_counts(&d.stale),
|
||||
"1 new, 1 gone, 0 under a changed fixture source, 0 under a changed profile fingerprint"
|
||||
);
|
||||
let d = diff(&base, &observed(table("s", "f", &[]), &["a.ll"]));
|
||||
assert_eq!((d.changed.len(), d.stale.len()), (0, 0));
|
||||
let d = diff(&base, &observed(base.clone(), &[]));
|
||||
|
||||
@@ -313,6 +313,12 @@ reason): a parked test's failure, a parked gauge's change between `@100` and `@2
|
||||
time's cross-GPU outlier is named on the leg's line and fails no leg. A parked gauge's `@drop` still fails. The list goes with the old
|
||||
runtime.
|
||||
|
||||
The old runtime's translations do not move either. The golden hash table compiles through
|
||||
`Device::new`, the old runtime's path. When its test reports a cell that changed under an unchanged
|
||||
key, or one under a changed profile fingerprint, the leg fails with `OLD PATH MOVED`. The one
|
||||
exception is a range where a commit since the table's last bless has a message that says
|
||||
`old-runtime regression fix`. New, gone and re-keyed fixture rows only need a bless.
|
||||
|
||||
`metal2vulkan_devtools::instructions::InstructionCounter` measures `instructions`: the calling
|
||||
thread's user-space instructions from Linux's `perf_event_open`, the form an unprivileged process
|
||||
may open at `perf_event_paranoid` 2. On a hybrid x86 CPU it sums the event over each core type's
|
||||
|
||||
@@ -42,6 +42,8 @@ sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
import results # noqa: E402
|
||||
|
||||
REPO = Path(__file__).resolve().parents[2]
|
||||
#: The golden hash table, compiled through `Device::new`: results.old_path_moved.
|
||||
GOLDEN_TABLE = "crates/metal2vulkan/tests/golden_hashes.tsv"
|
||||
CONFIG = Path.home() / ".config/metal2vulkan/matrix.json"
|
||||
STATE = Path.home() / ".cache/metal2vulkan-matrix"
|
||||
TREE = STATE / "tree"
|
||||
@@ -360,6 +362,11 @@ class Run:
|
||||
#: Whether the commit has the harness, whose timed workloads each GPU leg runs.
|
||||
self.harness = subprocess.run(["git", "cat-file", "-e", f"{sha}:crates/metal2vulkan-harness/Cargo.toml"],
|
||||
cwd=REPO, capture_output=True).returncode == 0
|
||||
#: The messages of the commits since the golden table's last bless, which
|
||||
#: results.old_path_moved reads for the one phrase that lets the old path move.
|
||||
blessed = git("log", "-1", "--format=%H", sha, "--", GOLDEN_TABLE)
|
||||
self.since_bless = [m for m in git("log", "--format=%B%x00", f"{blessed}..{sha}").split("\0")
|
||||
if m.strip()]
|
||||
|
||||
def setup(self, node):
|
||||
return self.cfg.get("setup", {}).get(node, "")
|
||||
@@ -628,6 +635,7 @@ def leg_entry(run, leg):
|
||||
base_sha, base = base_of(run.sha, leg.id)
|
||||
problems += run.failures.get(leg.id, [])
|
||||
problems += results.leg_problems(parsed, records, base and base["records"])
|
||||
problems += results.old_path_moved(parsed, run.since_bless)
|
||||
if not parsed["suites"] and leg.id not in run.failures:
|
||||
problems.append("no suite reported")
|
||||
dev = parsed["device"]
|
||||
|
||||
@@ -37,6 +37,15 @@ PARKED_TESTS = {
|
||||
#: code (1.58x at a68d520bee, 1.47x at 9af29fbb20).
|
||||
PARKED_RECORDS = ("harness-old/",)
|
||||
|
||||
#: The phrase that opens the message of a commit allowed to change the old runtime's output: until
|
||||
#: the cutover, the translator's output through `Device::new` moves only in such a commit.
|
||||
OLD_PATH_FIX = "old-runtime regression fix"
|
||||
#: The golden hash table's test (crates/metal2vulkan/src/tests/golden_hashes.rs) compiles through
|
||||
#: `Device::new`, the old runtime's path. Its failure names the cells that changed under an
|
||||
#: unchanged key and those under a changed profile fingerprint: either is the old path moving.
|
||||
GOLDEN_CHANGED = re.compile(r"output changed under an unchanged key: (\d+) cell")
|
||||
GOLDEN_PROFILE = re.compile(r"(\d+) under a changed profile fingerprint")
|
||||
|
||||
RECORD = re.compile(r"^\s*M2V-MATRIX (\S+) (\S+) (\S+)\s*$")
|
||||
LEG = re.compile(r"^M2V-LEG (\S+) begin\s*$")
|
||||
DEVICE = re.compile(r"^M2V-DEVICE (\S+) (\S+) (.*?)\s*$")
|
||||
@@ -64,8 +73,13 @@ def parse_suite(lines):
|
||||
run = passed = 0
|
||||
failed, problems = [], []
|
||||
records = empty_records()
|
||||
golden = dict(changed=0, profile=0)
|
||||
summary = False
|
||||
for line in lines:
|
||||
for kind, pattern in (("changed", GOLDEN_CHANGED), ("profile", GOLDEN_PROFILE)):
|
||||
m = pattern.search(line)
|
||||
if m:
|
||||
golden[kind] = max(golden[kind], int(m.group(1)))
|
||||
m = NEXTEST_SUMMARY.match(line)
|
||||
if m and not summary:
|
||||
summary = True
|
||||
@@ -96,7 +110,8 @@ def parse_suite(lines):
|
||||
problems.append(f"record {kind} {key}: recorded twice")
|
||||
else:
|
||||
records[kind][key] = float(value) if kind == "time" else int(value)
|
||||
return dict(run=run, passed=passed, failed=failed, records=records, problems=problems)
|
||||
return dict(run=run, passed=passed, failed=failed, records=records, problems=problems,
|
||||
golden=golden)
|
||||
|
||||
|
||||
def parse_job(text):
|
||||
@@ -183,6 +198,20 @@ def leg_problems(leg, records, base):
|
||||
return problems
|
||||
|
||||
|
||||
def old_path_moved(leg, messages):
|
||||
"""The old path's output moved: the golden table's test reports a cell changed under an
|
||||
unchanged key or under a changed profile fingerprint, and none of MESSAGES (the commits since
|
||||
the table's last bless) says OLD_PATH_FIX. One problem per suite that reports it."""
|
||||
if any(OLD_PATH_FIX in message.lower() for message in messages):
|
||||
return []
|
||||
return [f"OLD PATH MOVED: suite {name}: the golden table, compiled through Device::new, has "
|
||||
f"{s['golden']['changed']} cell(s) changed under an unchanged key and "
|
||||
f"{s['golden']['profile']} under a changed profile fingerprint, and no commit since "
|
||||
f"its last bless says \"{OLD_PATH_FIX}\""
|
||||
for name, s in leg["suites"].items()
|
||||
if s.get("golden") and (s["golden"]["changed"] or s["golden"]["profile"])]
|
||||
|
||||
|
||||
def time_outliers(times, bases):
|
||||
"""Timing fails only as a cross-GPU outlier. TIMES and BASES: {leg: {key: microseconds}} of
|
||||
the GPU legs now and at their bases. For each key that at least TIME_MIN_GPUS legs timed at
|
||||
|
||||
@@ -164,6 +164,25 @@ class RuleTests(unittest.TestCase):
|
||||
self.assertEqual(failing, {})
|
||||
self.assertEqual(list(parked), ["d"])
|
||||
|
||||
def test_the_old_path_moving_fails_unless_a_commit_since_the_bless_is_its_fix(self):
|
||||
# The golden test's two panics, as its captured output prints them.
|
||||
changed = (" tests/golden_hashes.tsv: output changed under an unchanged key: 333 cell(s) "
|
||||
"changed while their fixture source and profile fingerprint did not, so a")
|
||||
stale = (" tests/golden_hashes.tsv is stale: 4 cell(s) are new, gone, or under a changed "
|
||||
"fixture source or profile (their keys changed, so no SEMANTICS_VERSION bump is "
|
||||
"needed): 0 new, 0 gone, 0 under a changed fixture source, 4 under a changed "
|
||||
"profile fingerprint. Bless it with")
|
||||
new_rows = stale.replace("0 new", "4 new").replace("4 under a changed profile", "0 under a changed profile")
|
||||
for text, moved in ((changed, True), (stale, True), (new_rows, False), (NEXTEST, False)):
|
||||
leg = results.parse_job(job(("cpu", "workspace", 100, text)))["cpu"]
|
||||
problems = results.old_path_moved(leg, ["translator: one stage bound on every device"])
|
||||
self.assertEqual(len(problems), int(moved), text)
|
||||
self.assertEqual(results.old_path_moved(
|
||||
leg, ["Old-runtime regression fix: the stage bound returns to Device::new"]), [])
|
||||
leg = results.parse_job(job(("cpu", "workspace", 100, changed)))["cpu"]
|
||||
self.assertIn("333 cell(s) changed under an unchanged key and 0 under a changed profile",
|
||||
results.old_path_moved(leg, [])[0])
|
||||
|
||||
def test_time_needs_three_gpus(self):
|
||||
bases = {"a": {"t": 100}, "b": {"t": 100}}
|
||||
self.assertEqual(results.time_outliers({"a": {"t": 100}, "b": {"t": 300}}, bases), ({}, {}))
|
||||
|
||||
Reference in new issue
Block a user