diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index 33bfaaed8..fe0790047 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -293,7 +293,9 @@ M2V-MATRIX / The value is an unsigned integer (`time`: microseconds, decimals allowed), and a key appears once per leg. The base is the nearest -first-parent ancestor whose note holds the same leg. +first-parent ancestor whose note holds the same leg. Times are compared only when the base's +`crates/metal2vulkan-harness` tree is this commit's: the harness's warm-up and windows are part of +the measurement, so a commit that changes the harness sets the base for the next. | Kind | What it counts | Fails when | |---|---|---| @@ -304,6 +306,12 @@ first-parent ancestor whose note holds the same leg. Every cache has a test that fills it past its capacity and records its gauge. +The old runtime takes no fixes until the cutover deletes it, so its failures that the matrix has +met are parked (`PARKED_TESTS` and `PARKED_GAUGES` in `scripts/matrix/results.py`, each with its +reason): a parked test's failure, or a parked gauge's change between `@100` and `@200`, 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. + `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 diff --git a/scripts/matrix/matrix b/scripts/matrix/matrix index 339aa6081..be709a351 100755 --- a/scripts/matrix/matrix +++ b/scripts/matrix/matrix @@ -121,6 +121,20 @@ def base_of(sha, leg_id): return None, None +def harness_tree(sha): + """The harness crate's tree at SHA. Its times measure through the harness's own warm-up and + windows, so two commits' times compare only when one harness measured both.""" + return git("rev-parse", f"{sha}:crates/metal2vulkan-harness", check=False) + + +def base_times(sha, base_sha, base): + """The times of BASE (the leg at BASE_SHA) that SHA's are judged against: none when the + harness changed between them, and the run then sets the base for the next.""" + if not base or harness_tree(base_sha) != harness_tree(sha): + return {} + return (base.get("records") or {}).get("time", {}) + + # --- the plan ------------------------------------------------------------------------------------ class Leg: @@ -587,7 +601,8 @@ def leg_entry(run, leg): started=leg.started and datetime.fromtimestamp(leg.started, timezone.utc).isoformat(timespec="seconds"), minutes=leg.started and leg.ended and round((leg.ended - leg.started) / 60, 2), suites={name: {k: s[k] for k in ("exit", "run", "passed", "failed")} for name, s in parsed["suites"].items()}, - records=records, base=base_sha, base_records=base and base["records"], problems=problems) + records=records, base=base_sha, base_records=base and base["records"], problems=problems, + parked=results.leg_parked(parsed, records)) def run_cmd(sha, only, dry): @@ -632,11 +647,11 @@ def run_cmd(sha, only, dry): for leg_id, e in doc["legs"].items(): if e.get("gpu") and leg_id not in entries: times[leg_id] = e["records"]["time"] - bases[leg_id] = ((base_of(sha, leg_id)[1] or {}).get("records") or {}).get("time", {}) + bases[leg_id] = base_times(sha, *base_of(sha, leg_id)) for leg_id, e in entries.items(): if e["gpu"]: times[leg_id] = e["records"]["time"] - bases[leg_id] = (e["base_records"] or {}).get("time", {}) + bases[leg_id] = base_times(sha, e["base"], e["base_records"] and {"records": e["base_records"]}) for leg_id, problems in results.time_outliers(times, bases).items(): if leg_id in entries: entries[leg_id]["problems"] += problems diff --git a/scripts/matrix/results.py b/scripts/matrix/results.py index 612a32377..8801bf73c 100644 --- a/scripts/matrix/results.py +++ b/scripts/matrix/results.py @@ -20,6 +20,21 @@ TIME_OUTLIER = 1.25 #: ...of at least this many GPUs. TIME_MIN_GPUS = 3 +#: The old runtime's failures the matrix reports on a leg's line but fails no leg for: the old +#: runtime takes no fixes until the cutover deletes it, and this list goes with it. A test, by its +#: nextest name, with the reason it fails. +PARKED_TESTS = { + "metal2vulkan-validation runtime_lane::cross_queue_shadows::" + "a_cpu_write_while_a_command_buffer_runs_reaches_none_of_its_encoders": + "a GPU-hazard test whose spin can end before the host's write on a loaded host", + "metal2vulkan-validation runtime_lane::compute_inherited_buffers::" + "a_host_step_orders_the_commands_by_their_barriers_alone": + "the old runtime's barrier count moves with its background pipeline builds", +} +#: Gauge keys, by prefix, whose @100-to-@200 flatness is parked for the same reason (their @drop +#: still fails): the old runtime frees idle memory blocks at times of its own. +PARKED_GAUGES = ("harness-old/",) + 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*$") @@ -121,22 +136,38 @@ def leg_records(leg): return records, problems +def leg_parked(leg, records): + """The leg's parked failures (PARKED_TESTS, PARKED_GAUGES), one line each.""" + out = [f"test {test}" for suite in leg["suites"].values() for test in suite["failed"] + if test in PARKED_TESTS] + gauges = records["gauge"] + for key, value in sorted(gauges.items()): + name, _, point = key.rpartition("@") + if (point == "200" and name.startswith(PARKED_GAUGES) and f"{name}@100" in gauges + and value != gauges[f"{name}@100"]): + out.append(f"gauge {name}: {gauges[f'{name}@100']} at iteration 100, {value} at 200") + return out + + def leg_problems(leg, records, base): """What fails a leg: a suite that failed, a record's own problem, and the rules against the - base leg's records (BASE None: no base, so only the rules that need none).""" + base leg's records (BASE None: no base, so only the rules that need none). A suite whose every + failed test is parked (PARKED_TESTS) has not failed.""" problems = [] for name, suite in leg["suites"].items(): - if suite["exit"] != 0 or suite["failed"]: - shown = ", ".join(suite["failed"][:5]) + (" ..." if len(suite["failed"]) > 5 else "") + failed = [test for test in suite["failed"] if test not in PARKED_TESTS] + if failed or (suite["exit"] != 0 and not suite["failed"]): + shown = ", ".join(failed[:5]) + (" ..." if len(failed) > 5 else "") problems.append(f"suite {name} exited {suite['exit']}" - + (f", {len(suite['failed'])} failed: {shown}" if suite["failed"] else "")) + + (f", {len(failed)} failed: {shown}" if failed else "")) problems += suite["problems"] gauges = records["gauge"] for key, value in sorted(gauges.items()): name, _, point = key.rpartition("@") if point == "drop" and value != 0: problems.append(f"gauge {name}: {value} live at device drop") - if point == "200" and f"{name}@100" in gauges and value != gauges[f"{name}@100"]: + if (point == "200" and not name.startswith(PARKED_GAUGES) and f"{name}@100" in gauges + and value != gauges[f"{name}@100"]): problems.append(f"gauge {name}: {gauges[f'{name}@100']} at iteration 100, {value} at 200") if base is not None: for key, value in sorted(records["metric"].items()): @@ -183,4 +214,6 @@ def verdict_line(leg_id, leg): f"jobs {' '.join(leg.get('jobs', [])) or '-'}") if leg["problems"]: tail += " | " + " | ".join(leg["problems"][:4]) + (" ..." if len(leg["problems"]) > 4 else "") + if leg.get("parked"): + tail += f" | parked: {len(leg['parked'])} ({leg['parked'][0]}" + (" ..." if len(leg["parked"]) > 1 else "") + ")" return f"{head}: {tail}" diff --git a/scripts/matrix/test_results.py b/scripts/matrix/test_results.py index 7e55ed65d..bc12199a5 100644 --- a/scripts/matrix/test_results.py +++ b/scripts/matrix/test_results.py @@ -125,6 +125,23 @@ class RuleTests(unittest.TestCase): leg = leg_of(recs(), code=100) self.assertEqual(results.leg_problems(leg, recs(), None), ["suite rt exited 100"]) + def test_a_suite_whose_failures_are_all_parked_passes_and_names_them(self): + parked = next(iter(results.PARKED_TESTS)) + leg = leg_of(recs(), code=100) + leg["suites"]["rt"]["failed"] = [parked] + self.assertEqual(results.leg_problems(leg, recs(), None), []) + self.assertEqual(results.leg_parked(leg, recs()), [f"test {parked}"]) + leg["suites"]["rt"]["failed"].append("metal2vulkan-rt tests::breaks") + self.assertEqual(results.leg_problems(leg, recs(), None), + ["suite rt exited 100, 1 failed: metal2vulkan-rt tests::breaks"]) + + def test_a_parked_gauge_moves_between_iterations_but_must_reach_zero(self): + prefix = results.PARKED_GAUGES[0] + now = recs(gauge={f"{prefix}w/b@100": 3, f"{prefix}w/b@200": 2, f"{prefix}w/b@drop": 1}) + self.assertEqual(self.problems(now, None), [f"gauge {prefix}w/b: 1 live at device drop"]) + self.assertEqual(results.leg_parked(leg_of(now), now), + [f"gauge {prefix}w/b: 3 at iteration 100, 2 at 200"]) + def test_two_suites_recording_one_key_is_a_problem(self): leg = leg_of(recs(metric={"a/x": 1})) leg["suites"]["other"] = dict(leg["suites"]["rt"])