diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index 46970ef93..82df605ca 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -303,10 +303,15 @@ Both end with one table: every harness row over its limit on every leg (the harn below), with its kind (GPU time, host time, own part for a creation row judged on the new runtime's own part, or count for the instructions gate), its ratio and limit, the frozen arm's verdict on it (`VOID`, `stands`, `rebased` or `no base`), and its -status, from `scripts/matrix/status.tsv` by card and row: an open record, with its owner and its -age in rounds; a known gap, with the place it was ruled; or, for a row with neither, `NEW` in the -first round it is over and `UNOWNED` after. A row of a card's own variance (`CARD_VARIANCE`) -reads as its card's known gap. The table changes no verdict. +status, from `scripts/matrix/status.tsv` by card and row: an open record, with its owner, its +age in rounds and the ratio it was owned at; a known gap, with the place it was ruled; or, for a +row with neither, `NEW` in the first round it is over and `UNOWNED` after. A row of a card's own +variance (`CARD_VARIANCE`) reads as its card's known gap. A row past its limit that an open +record holds fails no leg while its ratio, after its re-time, is within 3% of the ratio it was +owned at, and fails it past that; a known gap's row fails no leg unless a ruling gave it a +ceiling (`HARNESS_CEILINGS`) and it is past it. Either is still listed. After the table, the +report names every open record and gap whose rows are within their limits on every leg of their +card that timed them, for removal from `status.tsv`. A leg is one GPU, named by its PCI `vendor:device`, or `lavapipe`, or `lint`. Each GPU runs on one node, and the nodes run at once; a node with several leg GPUs runs their device tests in turn in one job that @@ -356,7 +361,7 @@ changes the harness sets the base for the next. | `metric` | A deterministic count per frame or per command buffer: submissions, passes, barriers, bytes copied, pipelines created | It is larger than the base's | | `instructions` | User-space CPU instructions per draw or per dispatch, and per harness run, the p50 over the row's timed runs: the whole process's (`harness-//per_run`), and where the runtime names its threads, theirs with the harness's thread (`.../own_per_run`) and the rest, a driver's own threads (`.../others_per_run`) | It is more than 1% over the base's; the harness's counts are judged by the instructions gate instead | | `gauge` | Live objects of one resource kind, the key ending in the point it was read at: `@100` and `@200` (loop iterations), `@drop` (after the device dropped) | `@drop` is not 0, or `@200` differs from `@100`; for the memory pool's `blocks`, which frees allocations an earlier workload left idle once the most bytes in use over its window falls and the device is quiet for 20 ms, only `@200` over `@100` | -| `time` | A duration in microseconds: what a program waits on in a harness workload's run, timed on the host: for the frame rows (`frame`, `frame_5cb`), their throughput, two runs in flight, from one run's last completed handler to the next's, and their latency from idle as rows of their own (`_from_idle`, held to the row's ceiling and floor), one run in flight, from its first commit to its last completed handler; for another workload that times its command buffers, its last command buffer's commit-to-complete time (the others' lateness is a column of the harness's table and no record), else the host wall time a run adds (a run's GPU time is a record of its own, `harness-gpu-/`, parked here and judged by the harness budget) | Only as a cross-GPU outlier: its ratio to the base's is more than 1.25 times the median of that ratio over at least 3 GPUs | +| `time` | A duration in microseconds: what a program waits on in a harness workload's run, timed on the host: for the frame rows (`frame`, `frame_5cb`), their throughput, two runs in flight, from one run's last completed handler to the next's, and their latency from idle as rows of their own (`_from_idle`, held to the row's ceiling and floor), one run in flight, from its first commit to its last completed handler; for another workload that times its command buffers, its last command buffer's commit-to-complete time (the others' lateness is a column of the harness's table and no record), else the host wall time a run adds (a run's GPU time is a record of its own, `harness-gpu-/`, parked here and judged by the harness budget) | Only as a cross-GPU outlier: its ratio to the base's is more than 1.25 times the median of that ratio over at least 3 GPUs. A leg with such an outlier of a harness row's time on the new runtime has its harness timed once more after every leg is in, and an outlier fails the leg only where both passes agree | | `size` | The size a harness row whose size follows the device ran at (`long_4cb`) | The leg's two runtimes ran the row at different sizes: its times are then not compared (the harness budget) | | `locks` | The lock budget's locked instructions per million added commands (`lock_budget/draw`, `lock_budget/bound_draw`, `lock_budget/dispatch`; rt's `tests::locks`), the whole process's in user space, on a node whose matrix setup names its CPU's event in `M2V_LOCK_EVENT` (`cpu_core/r21d0`, `r1e25`) | The test fails past 0.25 per added command, on every node alike; on a node whose setup names the event, a GPU leg missing any of the three fails; elsewhere the budget prints `LOCKS-UNMEASURED` and passes | diff --git a/scripts/matrix/matrix b/scripts/matrix/matrix index c3f601cc6..b4e792ba0 100755 --- a/scripts/matrix/matrix +++ b/scripts/matrix/matrix @@ -545,6 +545,9 @@ class Run: self.spaces = load(STATE / "workspaces.json", {}) self.lock = threading.Lock() self.jobs, self.carries, self.failures = [], [], {} + #: Each Linux GPU node's carry, (--carry value, mirror variable, commit), once its legs + #: started: a leg's harness timed once more for a cross-GPU outlier (retime) takes it. + self.carried = {} self.build_info = None #: Whether the commit has the harness, whose timed workloads each GPU leg runs. #: Whether the commit has the lock budget, which a node naming its event must measure. @@ -714,6 +717,8 @@ class Run: if not made: return self.fail(legs, why) carry, mirror, rev = made + with self.lock: + self.carried[node] = made for leg in legs: leg.started = time.time() jobs = [("rt", legs, f"rt-{node}")] + ([("harness", [leg], f"harness-{leg.id}") for leg in legs] @@ -744,6 +749,44 @@ class Run: "timed once more, later") return again + def retime(self, legs): + """Each of LEGS's harness timed once more, after every leg is in: a leg whose one pass has + a harness row's cross-GPU outlier (results.outliers_to_retime), which then fails it only + where both passes agree (results.time_outliers). The second pass's records take the + first's, as a timing's do in timed_again. A node's legs in turn, the nodes at once, each + job holding its node alone as a timing does; a Linux node's job lays the tree out again + and its last one tidies, as the node's last job had.""" + by_node = {} + for leg in legs: + by_node.setdefault(leg.node, []).append(leg) + + def chain(node, these): + for leg in these: + try: + if self.nodes[node]["os"] == "windows": + code, out, rec = self.job("wintime", node, winrun_script(leg, "harness"), + f"winharness-{leg.id}-outlier", gpus=[leg.gpu], space="win", + exclusive=True) + elif node in self.carried: + carry, mirror, rev = self.carried[node] + script = gpu_script(self.short, self.setup(node), [leg], mirror, rev, "harness", + leg is these[-1], None, self.nodes.get(node, {}).get("cpu_model")) + code, out, rec = self.job("time", node, script, f"harness-{leg.id}-outlier", + gpus=[leg.gpu], carries=[carry], space="gpu", exclusive=True) + else: + self.fail([leg], f"its cross-GPU outlier's re-time found no carry on {node}") + continue + self.finish([leg], code, out, rec, "harness") + except Exception as error: # a re-time's own failure fails its leg, not the run + log(f"retime {leg.id}: {error!r}") + self.fail([leg], f"its cross-GPU outlier's re-time failed: {error!r}") + + threads = [threading.Thread(target=chain, args=(node, these)) for node, these in sorted(by_node.items())] + for t in threads: + t.start() + for t in threads: + t.join() + def finish(self, legs, code, out, rec, suite): """Merge one job's legs into theirs: a leg it did not run, or whose suite never reported its exit, fails. A job killed after it named a leg (its device lines) but before that leg's @@ -912,6 +955,23 @@ def leg_entry(run, leg): **({"timed": timed} if timed is not None else {})) +def cross_gpu(sha, doc, entries): + """The GPU legs' times and their bases' times that the cross-GPU rule compares + (results.outlier_keys): this run's ENTRIES' and the note DOC's other GPU legs'. The median + takes every GPU leg of the note, so a run of some legs (--legs) is judged against the GPUs it + did not run again; only this run's legs are judged.""" + times, bases = {}, {} + 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_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] = base_times(sha, e["base"], e["base_records"] and {"records": e["base_records"]}) + return times, bases + + def run_cmd(sha, only, dry): cfg = load(CONFIG, None) if not cfg or not cfg.get("builders"): @@ -942,24 +1002,23 @@ def run_cmd(sha, only, dry): rdir = STATE / "runs" / f"{sha[:12]}-{time.strftime('%m%d-%H%M%S')}" rdir.mkdir(parents=True) run = Run(sha, cfg, nodes, legs, b, rdir) + doc = note(sha) or dict(sha=sha, runs=[], legs={}) try: run.go() + entries = {leg.id: leg_entry(run, leg) for leg in legs} + # A harness row's cross-GPU outlier in one pass fails nothing yet: once every leg is in, + # the legs that have one are timed once more, and an outlier fails a leg only where both + # passes agree (results.time_outliers). + found = results.outlier_keys(*cross_gpu(sha, doc, entries)) + first = results.outliers_to_retime({leg_id: keys for leg_id, keys in found.items() if leg_id in entries}) + if first: + log(f"cross-GPU outliers in one pass on {', '.join(sorted(first))}: timed once more") + again = [leg for leg in legs if leg.id in first] + run.retime(again) + entries.update({leg.id: leg_entry(run, leg) for leg in again}) finally: run.cleanup() - entries = {leg.id: leg_entry(run, leg) for leg in legs} - doc = note(sha) or dict(sha=sha, runs=[], legs={}) - # The cross-GPU median takes every GPU leg of the note, so a run of some legs (--legs) is - # judged against the GPUs it did not run again; only this run's legs are judged. - times, bases = {}, {} - 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_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] = base_times(sha, e["base"], e["base_records"] and {"records": e["base_records"]}) - outliers, parked = results.time_outliers(times, bases) + outliers, parked = results.time_outliers(*cross_gpu(sha, doc, entries), first) for leg_id, problems in outliers.items(): if leg_id in entries: entries[leg_id]["problems"] += problems @@ -1023,7 +1082,8 @@ def rounds_since(sha, since): def print_over(sha, doc): """The report's one table: every row over its limit on each leg of SHA's note DOC (results.over_lines), with the frozen arm's verdict on its base and its status - (results.row_status, status.tsv).""" + (results.row_status, status.tsv); then the status entries whose rows are all within their + limits, to remove (results.entries_within).""" lines = [] for leg_id, leg in sorted(doc["legs"].items()): if not (leg.get("records") or {}).get("time"): @@ -1035,6 +1095,11 @@ def print_over(sha, doc): print(f"rows over their limits: {len(lines)}") for line in lines: print(f" {line}") + within = results.entries_within({leg_id: (leg.get("records") or {}, leg.get("cpu")) + for leg_id, leg in doc["legs"].items() if (leg.get("records") or {}).get("time")}) + print(f"status.tsv entries whose rows are within their limits, to remove: {len(within)}") + for card, row, status, who in within: + print(f" {card} {row} ({status}, {who}): within its limit on every leg of its card that timed it") def show_cmd(sha): diff --git a/scripts/matrix/results.py b/scripts/matrix/results.py index 348d2a223..31a639904 100644 --- a/scripts/matrix/results.py +++ b/scripts/matrix/results.py @@ -310,13 +310,12 @@ def old_path_moved(leg, messages): 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 - both, a leg whose slowdown (now over base) is more than TIME_OUTLIER times the legs' median - slowdown is an outlier. Returns ({leg: [problems]}, {leg: [parked]}): an outlier of a - PARKED_RECORDS key is parked, not a problem.""" - out, parked = {}, {} +def outlier_keys(times, bases): + """The cross-GPU outliers of TIMES against 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 both, a leg + whose slowdown (now over base) is more than TIME_OUTLIER times the legs' median slowdown. + Returns {leg: {key: (slowdown, median, legs)}}, PARKED_RECORDS keys among them.""" + out = {} keys = {key for values in times.values() for key in values} for key in sorted(keys): ratios = {leg: values[key] / bases[leg][key] @@ -327,9 +326,48 @@ def time_outliers(times, bases): median = statistics.median(ratios.values()) for leg, ratio in sorted(ratios.items()): if ratio > TIME_OUTLIER * median: - (parked if key.startswith(PARKED_RECORDS) else out).setdefault(leg, []).append( - f"time {key}: {ratio:.2f}x its base, against a median of {median:.2f}x " - f"over {len(ratios)} GPUs") + out.setdefault(leg, {})[key] = (ratio, median, len(ratios)) + return out + + +def outliers_to_retime(found): + """The legs of FOUND (outlier_keys) whose harness is timed once more before an outlier fails + them: those with an outlier of a harness row's time on the new runtime (HARNESS_NEW), one + pass of which never fails a leg on its own. Returns {leg: its outliers in FOUND}, time_outliers's + FIRST once they are timed again.""" + return {leg: keys for leg, keys in found.items() if any(key.startswith(HARNESS_NEW) for key in keys)} + + +def time_outliers(times, bases, first=None): + """Timing fails only as a cross-GPU outlier (outlier_keys). Returns ({leg: [problems]}, {leg: + [parked]}): an outlier of a PARKED_RECORDS key is parked, not a problem. FIRST: the legs whose + harness was timed once more for a harness row's outlier (outliers_to_retime), each with its + first pass's outliers; TIMES then hold their second pass, and an outlier of theirs is a + problem only where their first pass had it too, the two passes agreeing; one the second pass + alone has is parked.""" + out, parked = {}, {} + first = first or {} + now = outlier_keys(times, bases) + for leg, found in sorted(now.items()): + for key, (ratio, median, count) in sorted(found.items()): + line = f"time {key}: {ratio:.2f}x its base, against a median of {median:.2f}x over {count} GPUs" + if key.startswith(PARKED_RECORDS): + parked.setdefault(leg, []).append(line) + elif leg not in first: + out.setdefault(leg, []).append(line) + elif key in first[leg]: + was = first[leg][key] + out.setdefault(leg, []).append(f"{line}, and {was[0]:.2f}x against {was[1]:.2f}x in the " + "first pass: both passes agree") + else: + parked.setdefault(leg, []).append(f"{line} when timed once more, but not in the first pass: " + "the passes disagree, so it fails nothing") + for leg, keys in sorted(first.items()): + for key in sorted(keys): + if not key.startswith(PARKED_RECORDS) and key not in now.get(leg, {}): + parked.setdefault(leg, []).append( + f"time {key}: an outlier in the first pass, {keys[key][0]:.2f}x its base against a median " + f"of {keys[key][1]:.2f}x, but not when timed once more: the passes disagree, so it fails nothing") return out, parked @@ -901,8 +939,21 @@ def harness_budget(leg_id, leg, base=None, rebased=None, cpu=None): (frozen_rebased). Where the old runtime's own spread across its passes in the leg is past BASE_SPREAD (base_spread), every row its times would fail is named VOID and fails nothing; the problems of its records and its counts stand. On a node whose CPU model is CPU, a row - counts_judge judges by its counts is judged by the instructions gate alone, its time named.""" + counts_judge judges by its counts is judged by the instructions gate alone, its time named. A + row past its limit that status.tsv holds (owned_verdict) is named and fails nothing: an open + record's within OWNED_WORSE of the ratio it was owned at, judged after its re-time, and a + gap's without a ruled ceiling; past that, it fails as any row.""" problems, parked, timed = [], [], [] + + def past_its_limit(row, line, ratio): + """ROW past its limit, LINE naming it, judged by RATIO: a problem (timed) unless its status + holds it (owned_verdict), in which case it is named with that and fails nothing.""" + verdict = owned_verdict(leg_id, row, ratio) + if verdict is None: + timed.append(line) + else: + (timed if verdict[0] else parked).append(f"{line}: {verdict[1]}") + suites = leg["suites"].values() for row in sorted({test[len(HARNESS_OLD):] for suite in suites for test in suite["failed"] if test.startswith(HARNESS_OLD)}): @@ -973,12 +1024,12 @@ def harness_budget(leg_id, leg, base=None, rebased=None, cpu=None): f"part {own:.1f} us over old's whole {old:.1f} us is {own / old:.3f}; the " f"driver's part {driver:.1f} us, new {new:.1f} us whole is {new / old:.3f}: {gap}") if own / old > limit: - timed.append(f"{line}, {past_limit(leg_id, row)}: a regression of its own") + past_its_limit(row, f"{line}, {past_limit(leg_id, row)}: a regression of its own", own / old) else: parked.append(line) continue if new / old > limit: - timed.append(f"{line}, {past_limit(leg_id, row)}") + past_its_limit(row, f"{line}, {past_limit(leg_id, row)}", new / old) elif listed_row(row) in ceilings: parked.append(f"{line}, its ceiling {ceilings[listed_row(row)]}") continue @@ -997,17 +1048,18 @@ def harness_budget(leg_id, leg, base=None, rebased=None, cpu=None): if ratio > limit: past = f"{line}, {past_limit(leg_id, row, gpu)}" ratios = retimed(times, row, gpu) + judged = ratio if ratios is not None: - median = statistics.median(ratios) + judged = statistics.median(ratios) past = (f"{past}; re-timed in {RETIME_PAIRS} pairs, " - f"{', '.join(f'{r:.3f}' for r in ratios)}, median {median:.3f}") - if median <= limit: + f"{', '.join(f'{r:.3f}' for r in ratios)}, median {judged:.3f}") + if judged <= limit: parked.append(f"{past}, within: judged by the median") continue if variance: parked.append(f"{past}: the card's own variance, not judged ({variance})") else: - timed.append(past) + past_its_limit(row, past, judged) elif variance and ratio > HARNESS_BUDGET: parked.append(f"{line}, within its limit: the card's own variance ({variance})") elif listed_row(row) not in ceilings: @@ -1076,49 +1128,70 @@ def over_rows(leg_id, records, cpu=None): #: The status of each row a report lists over its limit (over_rows), by card and row, read from -#: status.tsv (read_status): `open`, an open record, with its owner and the round it first went -#: over; `gap`, a known gap, with the place it was ruled; `note`, a note alone. A row with no open -#: record or gap reads NEW in the first round it is over (not over in its leg's base) and UNOWNED -#: after; a CARD_VARIANCE row reads as its card's known gap. +#: status.tsv (read_status): `open`, an open record, with its owner, the round it first went over +#: and the ratio it was owned at; `gap`, a known gap, with the place it was ruled; `note`, a note +#: alone. A row with no open record or gap reads NEW in the first round it is over (not over in +#: its leg's base) and UNOWNED after; a CARD_VARIANCE row reads as its card's known gap. An open +#: record's row past its limit fails its leg only more than OWNED_WORSE worse than its owned ratio, +#: and a gap's only past the ceiling a ruling gave it (HARNESS_CEILINGS); both are listed +#: (owned_verdict). An entry whose rows are all within their limits is named for removal +#: (entries_within). STATUSES = ("open", "gap", "note") +#: How much worse than the ratio it was owned at an open record's row may judge before it fails +#: its leg again: its owner's work holds it there, and a row that grows past it is a new +#: regression on top of the owned one. +OWNED_WORSE = 1.03 def read_status(text): """The status table's TEXT: `#` comments, a header line, then one entry a line, `|` between its fields: card (`vendor:device`), row (`*` matches any run of characters), status (STATUSES), who owns it or where it was ruled, since (an open record's first round, a commit; - else `-`) and a note (or `-`). Returns [(card, row, status, who, since, note)]; a malformed - line raises ValueError.""" + else `-`), owned (an open record's ratio when it was owned, new over old as the row is judged; + else `-`) and a note (or `-`). Returns [(card, row, status, who, since, owned, note)], owned a + float or None; a malformed line raises ValueError.""" entries = [] lines = [line for line in text.splitlines() if line.strip() and not line.lstrip().startswith("#")] for line in lines[1:]: fields = [field.strip() for field in line.split("|")] - if len(fields) != 6: - raise ValueError(f"status.tsv: {len(fields)} fields, not 6: {line}") - card, row, status, who, since, note = fields + if len(fields) != 7: + raise ValueError(f"status.tsv: {len(fields)} fields, not 7: {line}") + card, row, status, who, since, owned, note = fields if (not re.fullmatch(r"[0-9a-f]{4}:[0-9a-f]{4}", card) or status not in STATUSES or not row or (status == "open") != bool(re.fullmatch(r"[0-9a-f]{7,40}", since)) + or (status == "open") != bool(re.fullmatch(r"[0-9]+\.[0-9]+", owned)) + or (status != "open" and owned != "-") or (status != "note" and who == "-")): raise ValueError(f"status.tsv: malformed entry: {line}") - entries.append((card, row, status, who, since, note)) + entries.append((card, row, status, who, since, float(owned) if status == "open" else None, note)) return entries STATUS = read_status((Path(__file__).resolve().parent / "status.tsv").read_text()) -def row_status(leg_id, row, over_before, rounds_since): +def status_entries(leg_id, row): + """The status entries (STATUS) of LEG_ID's card whose row matches ROW.""" + return [entry for entry in STATUS + if entry[0] == card_of(leg_id) and re.fullmatch(re.escape(entry[1]).replace(r"\*", ".*"), row)] + + +def row_status(leg_id, row, over_before, rounds_since, ratio=None): """ROW's status on LEG_ID for the report's table: `open, 's, rounds` (ROUNDS_SINCE - gives the rounds from a commit on, this one's included, or None), `known gap: `, - `NEW`, or `UNOWNED` where OVER_BEFORE (the row was over in the leg's base), each with the - entries' notes.""" - entries = [entry for entry in STATUS - if entry[0] == card_of(leg_id) and re.fullmatch(re.escape(entry[1]).replace(r"\*", ".*"), row)] - notes = "".join(f"; {note}" for _, _, _, _, _, note in entries if note != "-") - for _, _, status, who, since, _ in entries: + gives the rounds from a commit on, this one's included, or None) with the ratio it was owned + at and, given the RATIO it is judged by now, whether that is within OWNED_WORSE of it; + `known gap: `; `NEW`, or `UNOWNED` where OVER_BEFORE (the row was over in the leg's + base), each with the entries' notes.""" + entries = status_entries(leg_id, row) + notes = "".join(f"; {note}" for *_, note in entries if note != "-") + for _, _, status, who, since, owned, _ in entries: if status == "open": age = rounds_since(since) - return f"open, {who}'s, {'?' if age is None else age} round{'' if age == 1 else 's'}" + notes + line = f"open, {who}'s, {'?' if age is None else age} round{'' if age == 1 else 's'}, owned at {owned:.3f}" + if ratio is not None: + line += (f", within {owned * OWNED_WORSE:.3f}" if ratio <= owned * OWNED_WORSE + else f", WORSE than {owned * OWNED_WORSE:.3f}: fails its leg") + return line + notes if status == "gap": return f"known gap: {who}" + notes if row in CARD_VARIANCE.get(card_of(leg_id), {}): @@ -1126,6 +1199,53 @@ def row_status(leg_id, row, over_before, rounds_since): return ("UNOWNED" if over_before else "NEW") + notes +def entries_within(legs): + """The open records and gaps of status.tsv (STATUS) whose rows are back within their limits, so + the report names them for removal and no entry outlives its problem. LEGS: {leg_id: (records, + cpu)}, a note's legs. An entry is within where it matches a row timed on both runtimes on a + leg of its card and no row it matches is over its limit on any such leg (over_rows, of any + kind); an entry that matches no timed row says nothing. Each `(card, row, status, who)`, in the + table's order.""" + out = [] + for card, row, status, who, *_ in STATUS: + if status == "note": + continue + pattern = re.escape(row).replace(r"\*", ".*") + timed = over = False + for leg_id, (records, cpu) in sorted(legs.items()): + times = records.get("time") or {} + if card_of(leg_id) != card: + continue + if any(key.startswith(HARNESS_NEW) and times.get(HARNESS_OLD + key[len(HARNESS_NEW):]) + and re.fullmatch(pattern, key[len(HARNESS_NEW):]) for key in times): + timed = True + over = over or any(re.fullmatch(pattern, r) for r, *_ in over_rows(leg_id, records, cpu)) + if timed and not over: + out.append((card, row, status, who)) + return out + + +def owned_verdict(leg_id, row, ratio): + """How a row past its limit on LEG_ID, judged by RATIO (new over old, after its re-time where + it was re-timed), stands by its status (STATUS): None where no open record or gap holds it, so + it fails its leg as any row; else (fails, why). An open record's row fails only past its owned + ratio times OWNED_WORSE; a gap's row fails only where a ruling gave it a ceiling + (HARNESS_CEILINGS), being past it, as a row past its ceiling always has; both are still + listed (over_lines).""" + for _, _, status, who, _, owned, _ in status_entries(leg_id, row): + if status == "open": + bound = owned * OWNED_WORSE + if ratio > bound: + return True, (f"owned by {who} at {owned:.3f}, and {ratio:.3f} is more than " + f"{OWNED_WORSE - 1:.0%} worse ({bound:.3f})") + return False, f"owned by {who} at {owned:.3f}, within {bound:.3f}: listed, fails nothing" + if status == "gap": + if listed_row(row) in HARNESS_CEILINGS.get(card_of(leg_id), {}): + return True, f"a known gap ({who}), past the ceiling its ruling gave it" + return False, f"a known gap ({who}): listed, fails nothing" + return None + + def over_lines(leg_id, records, base, rebased, rounds_since, cpu=None): """The report's table on LEG_ID: one line per row over its limit in the leg's RECORDS (over_rows): its kind, its ratio and limit, the frozen arm's verdict against BASE, the base @@ -1140,7 +1260,7 @@ def over_lines(leg_id, records, base, rebased, rounds_since, cpu=None): move = frozen_move(records["time"], base_times, row) meter = ("-" if kind == "count" else "VOID" if void else "no base" if move is None else "rebased" if frozen_rebased(row, rebased) else "VOID" if abs(move[2]) > FROZEN_DRIFT else "stands") - status = row_status(leg_id, row, (row, kind) in before, rounds_since) + status = row_status(leg_id, row, (row, kind) in before, rounds_since, None if kind == "count" else ratio) lines.append(f"{leg_id:<24} {row:<36} {kind:<9} {ratio:6.3f} over {limit:.3f} {meter:<7} {status}") return lines diff --git a/scripts/matrix/status.tsv b/scripts/matrix/status.tsv index fb1afe1aa..8f07ce3f5 100644 --- a/scripts/matrix/status.tsv +++ b/scripts/matrix/status.tsv @@ -5,36 +5,41 @@ # status open: an open record, its owner in `who`, the round it first went over in `since` # gap: a known gap, the place it was ruled in `who` # note: a note alone; the row reads NEW or UNOWNED as a row with no entry does +# owned an open record's ratio when it was owned, new over old as the row is judged; else `-` # note shown beside the status, or `-` # A row with no open record or gap reads NEW in the first round it is over and UNOWNED after. -# An open record leaves when its row is within its limit again; a gap carries its row's ceiling. -card | row | status | who | since | note -8086:a7a0 | create_state/first | gap | the planner's ruling of 2026-11-18 | - | the meter's artifact -1002:15bf | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | - -1002:1900 | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | - -1002:699f | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | - -1002:744c | create_64MiB | open | memory2 | 5f2494bfc5 | - -1002:744c | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | - -10de:1e87 | create_64MiB | open | memory2 | 5f2494bfc5 | - -10de:1e87 | create_private_16MiB/first_take | gap | the planner's ruling of 2026-11-18 | - | NVIDIA holds the submit for the block-maker's allocation -10de:2204 | create_64MiB | open | memory2 | 5f2494bfc5 | - -10de:2204 | create_private_16MiB/first_take | gap | the planner's ruling of 2026-11-18 | - | NVIDIA holds the submit for the block-maker's allocation -8086:3e9b | create_private_16MiB/first_take | open | memory2 | 5f2494bfc5 | - -8086:a7a0 | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | - -8086:a7a0 | create_private_16MiB/first_take | open | memory2 | 5f2494bfc5 | - -1002:699f | wide_bindings | open | identity | 5f2494bfc5 | waits for the card's native table -8086:3e9b | sampling_deep_64x64x16 | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | row_cells | open | identity | 795c834ded | waits for the card's native table -8086:a7a0 | constant_managed | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | constant_private | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | constexpr_sampling | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | sampling_deep_512x512x16 | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | sampling_deep_512x512x16_16x16x1 | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | sampling_deep_512x512x16_4x4x4 | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | sampling_deep_512x512x16_8x8x1 | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | sampling_deep_64x64x16 | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | threadgroup_scan | open | identity | 5f2494bfc5 | waits for the card's native table -8086:a7a0 | waves | open | identity | 5f2494bfc5 | waits for the card's native table -10de:1e87 | frame_5cb | gap | the planner's ruling of 2026-11-18 | - | the runtime guide's known gaps: NVIDIA's latency per submission; throughput 8-14% behind, latency from idle equal -10de:1e87 | frame | note | - | - | new ahead in throughput and in latency from idle -8086:a7a0 | frame | note | - | - | new ahead in throughput and in latency from idle +# An open record's row fails its leg only more than 3% worse than its owned ratio, after its +# re-time (results.OWNED_WORSE); a gap's only past the ceiling a ruling gave it +# (results.HARNESS_CEILINGS). Both are listed. An entry whose rows are all within their limits +# is named for removal in the report (results.entries_within); remove it then. +# The owned ratios of the entries below are their rows' ratios in the matrix note of b0c08e51b5. +card | row | status | who | since | owned | note +8086:a7a0 | create_state/first | gap | the planner's ruling of 2026-11-18 | - | - | the meter's artifact +1002:15bf | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | 0.988 | - +1002:1900 | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | 1.001 | - +1002:699f | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | 1.013 | - +1002:744c | create_64MiB | open | memory2 | 5f2494bfc5 | 1.009 | - +1002:744c | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | 0.995 | - +10de:1e87 | create_64MiB | open | memory2 | 5f2494bfc5 | 1.016 | - +10de:1e87 | create_private_16MiB/first_take | gap | the planner's ruling of 2026-11-18 | - | - | NVIDIA holds the submit for the block-maker's allocation +10de:2204 | create_64MiB | open | memory2 | 5f2494bfc5 | 0.991 | - +10de:2204 | create_private_16MiB/first_take | gap | the planner's ruling of 2026-11-18 | - | - | NVIDIA holds the submit for the block-maker's allocation +8086:3e9b | create_private_16MiB/first_take | open | memory2 | 5f2494bfc5 | 1.196 | - +8086:a7a0 | create_64MiB/first_take | open | memory2 | 5f2494bfc5 | 0.998 | - +8086:a7a0 | create_private_16MiB/first_take | open | memory2 | 5f2494bfc5 | 1.512 | - +1002:699f | wide_bindings | open | identity | 5f2494bfc5 | 1.123 | waits for the card's native table +8086:3e9b | sampling_deep_64x64x16 | open | identity | 5f2494bfc5 | 1.017 | waits for the card's native table +8086:a7a0 | row_cells | open | identity | 795c834ded | 1.144 | waits for the card's native table +8086:a7a0 | constant_managed | open | identity | 5f2494bfc5 | 1.061 | waits for the card's native table +8086:a7a0 | constant_private | open | identity | 5f2494bfc5 | 1.065 | waits for the card's native table +8086:a7a0 | constexpr_sampling | open | identity | 5f2494bfc5 | 1.123 | waits for the card's native table +8086:a7a0 | sampling_deep_512x512x16 | open | identity | 5f2494bfc5 | 1.266 | waits for the card's native table +8086:a7a0 | sampling_deep_512x512x16_16x16x1 | open | identity | 5f2494bfc5 | 1.262 | waits for the card's native table +8086:a7a0 | sampling_deep_512x512x16_4x4x4 | open | identity | 5f2494bfc5 | 1.273 | waits for the card's native table +8086:a7a0 | sampling_deep_512x512x16_8x8x1 | open | identity | 5f2494bfc5 | 1.268 | waits for the card's native table +8086:a7a0 | sampling_deep_64x64x16 | open | identity | 5f2494bfc5 | 1.012 | waits for the card's native table +8086:a7a0 | threadgroup_scan | open | identity | 5f2494bfc5 | 1.075 | waits for the card's native table +8086:a7a0 | waves | open | identity | 5f2494bfc5 | 1.152 | waits for the card's native table +10de:1e87 | frame_5cb | gap | the planner's ruling of 2026-11-18 | - | - | the runtime guide's known gaps: NVIDIA's latency per submission; throughput 8-14% behind, latency from idle equal +10de:1e87 | frame | note | - | - | - | new ahead in throughput and in latency from idle +8086:a7a0 | frame | note | - | - | - | new ahead in throughput and in latency from idle diff --git a/scripts/matrix/test_matrix.py b/scripts/matrix/test_matrix.py index 4aa233c87..663090cd0 100644 --- a/scripts/matrix/test_matrix.py +++ b/scripts/matrix/test_matrix.py @@ -28,6 +28,8 @@ def run_of(stats): run.nodes = {"host": {"os": "windows"}} run.short = "abc" run.jobs = [] + run.failures = {} + run.carried = {} return run @@ -190,6 +192,58 @@ class TimedAgainTests(unittest.TestCase): ("harness-1002:744c-again", True)]) self.assertEqual([(round(spread, 2), row) for spread, row in legs[0].timings], [(0.15, "alu"), (0.04, "alu")]) self.assertEqual([(round(spread, 2), row) for spread, row in legs[1].timings], [(0.01, "alu")]) + self.assertEqual(run.carried, {"n": ("carry", "mirror", "rev")}) + + +class OutlierRetimeTests(unittest.TestCase): + def test_each_leg_is_timed_once_more_alone_its_records_taking_the_first_pass_s(self): + run = run_of({}) + run.harness, run.layer, run.cfg = True, None, {} + run.nodes = {"n": {"os": "linux"}, "w": {"os": "windows"}, "away": {"os": "linux"}} + run.carried = {"n": ("carry", "mirror", "rev")} + legs = [matrix.Leg("1002:744c", "n", "0000:06:00.0", "radeon"), + matrix.Leg("10de:1e87", "n", "0000:09:00.0", "nvidia"), + matrix.Leg("8086:3e9b", "w", "8086:3e9b"), + matrix.Leg("1002:15bf", "away", "0000:c7:00.0", "radeon")] + for leg in legs: + leg.parsed["suites"][matrix.HARNESS_SUITE] = {"records": {"time": {"harness-new/alu": 200.0}}} + asked = [] + + def job(kind, node, script, name, gpus=(), carries=(), space=None, exclusive=False, room=None): + asked.append((kind, node, name, list(gpus), list(carries), space, exclusive, 'rm -rf "$S"' in script)) + leg_id = name.split("-", 1)[1].removesuffix("-outlier") + return 0, (f"M2V-LEG {leg_id} begin\nM2V-MATRIX time harness-old/alu 100.0\n" + f"M2V-MATRIX time harness-new/alu 101.0\nM2V-SUITE {leg_id} harness exit 0\n"), {"id": name} + + with mock.patch.object(run, "job", job, create=True), mock.patch.object(matrix, "log"): + run.retime(legs) + # A Linux node's legs in turn with its carry, its last job tidying; the Windows leg in its + # workspace; each holding its node alone. A node whose legs never started has no carry. + self.assertEqual(sorted(asked), [ + ("time", "n", "harness-1002:744c-outlier", ["0000:06:00.0"], ["carry"], "gpu", True, False), + ("time", "n", "harness-10de:1e87-outlier", ["0000:09:00.0"], ["carry"], "gpu", True, True), + ("wintime", "w", "winharness-8086:3e9b-outlier", ["8086:3e9b"], [], "win", True, False)]) + self.assertEqual([name for _, node, name, *_ in asked if node == "n"], + ["harness-1002:744c-outlier", "harness-10de:1e87-outlier"]) + for leg, name in zip(legs, ("harness-1002:744c-outlier", "harness-10de:1e87-outlier", + "winharness-8086:3e9b-outlier")): + self.assertEqual(leg.parsed["suites"][matrix.HARNESS_SUITE]["records"]["time"], + {"harness-old/alu": 100.0, "harness-new/alu": 101.0}) + self.assertEqual(leg.jobs, [name]) + self.assertEqual(run.failures, {"1002:15bf": ["its cross-GPU outlier's re-time found no carry on away"]}) + + def test_a_re_time_that_raises_fails_its_leg_not_the_run(self): + run = run_of({}) + run.cfg = {} + run.nodes = {"w": {"os": "windows"}} + leg = matrix.Leg("8086:3e9b", "w", "8086:3e9b") + + def job(*args, **kwargs): + raise OSError("no potluck") + + with mock.patch.object(run, "job", job, create=True), mock.patch.object(matrix, "log"): + run.retime([leg]) + self.assertEqual(run.failures, {"8086:3e9b": ["its cross-GPU outlier's re-time failed: OSError('no potluck')"]}) class HarnessRunTests(unittest.TestCase): diff --git a/scripts/matrix/test_results.py b/scripts/matrix/test_results.py index 769d7469a..4d39e04a7 100644 --- a/scripts/matrix/test_results.py +++ b/scripts/matrix/test_results.py @@ -225,6 +225,33 @@ class RuleTests(unittest.TestCase): self.assertEqual([cold in line for line in failing["d"]], [True]) self.assertEqual([warm in line for line in parked["d"]], [True]) + def test_a_harness_row_s_outlier_in_one_pass_fails_only_where_a_second_pass_agrees(self): + alu, frame, bandwidth = (f"{results.HARNESS_NEW}{row}" for row in ("alu", "frame", "bandwidth")) + bases = {leg: {alu: 100, frame: 100, bandwidth: 100, "loop/gpu": 100} for leg in "abcd"} + times = {leg: dict(bases[leg]) for leg in "abcd"} + times["d"].update({alu: 150, frame: 150}) + times["c"]["loop/gpu"] = 150 + found = results.outlier_keys(times, bases) + self.assertEqual(found, {"c": {"loop/gpu": (1.5, 1.0, 4)}, "d": {alu: (1.5, 1.0, 4), frame: (1.5, 1.0, 4)}}) + # Only a harness row's outlier is timed once more; another fails at once, as before. + first = results.outliers_to_retime(found) + self.assertEqual(first, {"d": found["d"]}) + # The second pass: alu again, frame back with the others, bandwidth new. + times["d"].update({frame: 100, bandwidth: 150}) + failing, parked = results.time_outliers(times, bases, first) + self.assertEqual(failing, { + "c": ["time loop/gpu: 1.50x its base, against a median of 1.00x over 4 GPUs"], + "d": [f"time {alu}: 1.50x its base, against a median of 1.00x over 4 GPUs, and 1.50x against 1.00x " + "in the first pass: both passes agree"]}) + self.assertEqual(parked, {"d": [ + f"time {bandwidth}: 1.50x its base, against a median of 1.00x over 4 GPUs when timed once more, but " + "not in the first pass: the passes disagree, so it fails nothing", + f"time {frame}: an outlier in the first pass, 1.50x its base against a median of 1.00x, but not when " + "timed once more: the passes disagree, so it fails nothing"]}) + # Without a second pass, every outlier fails, as one pass did before. + self.assertEqual(sorted(results.time_outliers(times, bases)[0]["d"]), + [f"time {key}: 1.50x its base, against a median of 1.00x over 4 GPUs" for key in (alu, bandwidth)]) + 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) " @@ -264,9 +291,11 @@ class RuleTests(unittest.TestCase): class HarnessBudgetTests(unittest.TestCase): def setUp(self): - # The rules below on no floors and no card's variance unless a test gives its own. - for name in ("HARNESS_FLOORS", "HARNESS_GPU_FLOORS", "CARD_VARIANCE"): - patch = mock.patch.object(results, name, {}) + # The rules below on no floors, no card's variance and no status entry unless a test gives + # its own. + for name, value in (("HARNESS_FLOORS", {}), ("HARNESS_GPU_FLOORS", {}), ("CARD_VARIANCE", {}), + ("STATUS", [])): + patch = mock.patch.object(results, name, value) patch.start() self.addCleanup(patch.stop) @@ -983,11 +1012,72 @@ class HarnessBudgetTests(unittest.TestCase): for row, ceiling in rows.items(): self.assertGreater(ceiling, results.HARNESS_BUDGET, f"{leg} {row}") + def test_an_owned_row_fails_only_past_its_owned_ratio_and_a_gap_only_past_its_ruled_ceiling(self): + entries = [("10de:1e87", "alu", "open", "core", "abc1234", 1.2, "-"), + ("10de:1e87", "sampling_*", "gap", "a ruling", "-", None, "-"), + ("10de:1e87", "bandwidth", "gap", "its ruling", "-", None, "-"), + ("10de:1e87", "frame", "note", "-", "-", None, "looked at once")] + times = {"harness-old/alu": 100.0, "harness-new/alu": 123.0, + "harness-old/sampling_deep": 100.0, "harness-new/sampling_deep": 150.0, + "harness-old/bandwidth": 100.0, "harness-new/bandwidth": 120.0, + "harness-old/frame": 100.0, "harness-new/frame": 110.0} + with mock.patch.object(results, "STATUS", entries), \ + mock.patch.object(results, "HARNESS_CEILINGS", {"10de:1e87": {"bandwidth": 1.1}}): + # alu is within 3% of the ratio it was owned at, sampling_deep a gap with no ruled + # ceiling: both named, neither failing. bandwidth's gap is past the ceiling its ruling + # gave it, and frame's note holds nothing: both fail. + self.assertEqual(self.budget("10de:1e87", times), ([ + "harness budget bandwidth: new 120.0 us over old 100.0 us is 1.200, past its ceiling 1.1 with " + "its allowance, 1.133: a known gap (its ruling), past the ceiling its ruling gave it", + "harness budget frame: new 110.0 us over old 100.0 us is 1.100, past 1.03"], [ + "harness budget alu: new 123.0 us over old 100.0 us is 1.230, past 1.03: owned by core at 1.200, " + "within 1.236: listed, fails nothing", + "harness budget sampling_deep: new 150.0 us over old 100.0 us is 1.500, past 1.03: a known gap " + "(a ruling): listed, fails nothing"])) + # More than 3% worse than its owned ratio, alu fails its leg again. + problems, _ = self.budget("10de:1e87", dict(times, **{"harness-new/alu": 124.0})) + self.assertIn("harness budget alu: new 124.0 us over old 100.0 us is 1.240, past 1.03: owned by core " + "at 1.200, and 1.240 is more than 3% worse (1.236)", problems) + # Re-timed, it is judged by its pairs' median: one pass at 1.300 fails nothing where the + # pairs bring it back within. + again = dict(times, **{"harness-new/alu": 130.0}) + for pair, new in enumerate((121.0, 123.0), 1): + again[f"{results.HARNESS_RETIME}alu/{pair}/old"] = 100.0 + again[f"{results.HARNESS_RETIME}alu/{pair}/new"] = new + problems, parked = self.budget("10de:1e87", again) + self.assertNotIn("alu", " ".join(problems)) + self.assertIn("harness budget alu: new 130.0 us over old 100.0 us is 1.300, past 1.03; re-timed in 2 " + "pairs, 1.210, 1.230, median 1.220: owned by core at 1.200, within 1.236: listed, fails " + "nothing", parked) + # The pairs agreeing with the one pass, it fails. + for pair in (1, 2): + again[f"{results.HARNESS_RETIME}alu/{pair}/new"] = 130.0 + self.assertIn("alu", " ".join(self.budget("10de:1e87", again)[0])) + # Without its entry, alu fails at 1.230 as any row. + with mock.patch.object(results, "HARNESS_CEILINGS", {}): + self.assertEqual(self.budget("10de:1e87", {"harness-old/alu": 100.0, "harness-new/alu": 123.0}), + (["harness budget alu: new 123.0 us over old 100.0 us is 1.230, past 1.03"], [])) + + def test_an_owned_first_take_is_judged_by_its_processes_median(self): + row = "create_64MiB/first_take" + times = {f"harness-old/{row}": 1000.0, f"harness-new/{row}": 1200.0} + for n in range(2, results.FIRST_RUNS + 1): + times[f"{results.HARNESS_FIRST}{row}/{n}/old"] = 1000.0 + times[f"{results.HARNESS_FIRST}{row}/{n}/new"] = 1200.0 + for owned, fails in ((1.17, False), (1.16, True)): + entries = [("10de:1e87", "create_64MiB/*", "open", "core", "abc1234", owned, "-")] + with mock.patch.object(results, "STATUS", entries), mock.patch.object(results, "OWN_PART_GATES", {}), \ + mock.patch.object(results, "HARNESS_CEILINGS", {}): + problems, parked = self.budget("10de:1e87", times) + self.assertEqual((len(problems), len(parked)), (1, 0) if fails else (0, 1), owned) + self.assertIn(f"owned by core at {owned:.3f}", (problems + parked)[0]) + class OverTableTests(unittest.TestCase): def setUp(self): for name, value in (("HARNESS_FLOORS", {}), ("HARNESS_GPU_FLOORS", {}), ("CARD_VARIANCE", {}), - ("HARNESS_CEILINGS", {"a:0001": {"listed": 2.0}}), ("STORED_INSTRUCTIONS", {})): + ("HARNESS_CEILINGS", {"a:0001": {"listed": 2.0}}), ("STORED_INSTRUCTIONS", {}), + ("STATUS", [])): patch = mock.patch.object(results, name, value) patch.start() self.addCleanup(patch.stop) @@ -995,15 +1085,22 @@ class OverTableTests(unittest.TestCase): def test_the_stored_status_table_reads_and_a_malformed_entry_is_refused(self): stored = results.read_status((Path(results.__file__).parent / "status.tsv").read_text()) self.assertTrue(stored) - self.assertTrue(all(status in results.STATUSES for _, _, status, _, _, _ in stored)) - head = "card | row | status | who | since | note\n" - self.assertEqual(results.read_status(head + "10de:1e87 | frame | open | core | 140714ceae | -\n"), - [("10de:1e87", "frame", "open", "core", "140714ceae", "-")]) - for bad in ("10de:1e87 | frame | open | core | - | -", # an open record without its first round - "10de:1e87 | frame | gap | - | - | -", # a gap without its place - "10de:1e87 | frame | closed | core | - | -", # no such status - "nvidia | frame | gap | here | - | -", # not a card - "10de:1e87 | frame | gap | here | -"): # a field short + self.assertTrue(all(status in results.STATUSES for _, _, status, _, _, _, _ in stored)) + # Every open record names the ratio it was owned at; nothing else has one. + self.assertTrue(all((status == "open") == (owned is not None) for _, _, status, _, _, owned, _ in stored)) + head = "card | row | status | who | since | owned | note\n" + self.assertEqual(results.read_status(head + "10de:1e87 | frame | open | core | 140714ceae | 1.120 | -\n" + "10de:1e87 | alu | gap | here | - | - | ruled\n"), + [("10de:1e87", "frame", "open", "core", "140714ceae", 1.12, "-"), + ("10de:1e87", "alu", "gap", "here", "-", None, "ruled")]) + for bad in ("10de:1e87 | frame | open | core | - | 1.120 | -", # an open record without its first round + "10de:1e87 | frame | open | core | 140714ceae | - | -", # nor the ratio it was owned at + "10de:1e87 | frame | open | core | 140714ceae | 1.1x | -", # a ratio that is no number + "10de:1e87 | frame | gap | here | - | 1.120 | -", # a gap is owned by no one + "10de:1e87 | frame | gap | - | - | - | -", # a gap without its place + "10de:1e87 | frame | closed | core | - | - | -", # no such status + "nvidia | frame | gap | here | - | - | -", # not a card + "10de:1e87 | frame | gap | here | - | -"): # a field short with self.assertRaises(ValueError, msg=bad): results.read_status(head + bad + "\n") @@ -1097,9 +1194,9 @@ class OverTableTests(unittest.TestCase): self.assertEqual(over(1500.0), [(row, "own part", 1.5)]) def test_a_listed_row_reads_its_status_and_an_unlisted_one_new_then_unowned(self): - entries = [("a:0001", "frame", "open", "core", "abc1234", "-"), - ("a:0001", "sampling_*", "gap", "a ruling", "-", "its ceiling holds"), - ("a:0001", "alu", "note", "-", "-", "looked at once")] + entries = [("a:0001", "frame", "open", "core", "abc1234", 1.48, "-"), + ("a:0001", "sampling_*", "gap", "a ruling", "-", None, "its ceiling holds"), + ("a:0001", "alu", "note", "-", "-", None, "looked at once")] times = {"harness-old/frame": 100.0, "harness-new/frame": 150.0, "harness-old/sampling_deep": 100.0, "harness-new/sampling_deep": 150.0, "harness-old/alu": 100.0, "harness-new/alu": 150.0, @@ -1110,7 +1207,8 @@ class OverTableTests(unittest.TestCase): lines = results.over_lines("a:0001@node", recs(time=times), base, None, rounds.get) self.assertEqual([line.split(None, 1)[1] for line in lines], [ "alu host time 1.500 over 1.030 stands UNOWNED; looked at once", - "frame host time 1.500 over 1.030 VOID open, core's, 3 rounds", + "frame host time 1.500 over 1.030 VOID open, core's, 3 rounds, " + "owned at 1.480, within 1.524", "sampling_deep host time 1.500 over 1.030 stands known gap: a ruling; " "its ceiling holds", "waves host time 1.500 over 1.030 stands NEW"]) @@ -1118,7 +1216,11 @@ class OverTableTests(unittest.TestCase): # Without a base, every unlisted row is new and the arm has nothing to say; on another # harness, only the creation rows are compared. lines = results.over_lines("a:0001", recs(time=times), None, None, rounds.get) - self.assertEqual([line.split()[-1] for line in lines], ["once", "rounds", "holds", "NEW"]) + self.assertEqual([line.split()[-1] for line in lines], ["once", "1.524", "holds", "NEW"]) + # Past its owned ratio by more than OWNED_WORSE, the open record's row says it fails. + entries[0] = entries[0][:5] + (1.4, "-") + self.assertTrue(results.over_lines("a:0001", recs(time=times), None, None, rounds.get)[1].endswith( + "open, core's, 3 rounds, owned at 1.400, WORSE than 1.442: fails its leg")) self.assertEqual({line.split(" ")[-2].strip() for line in results.over_lines("a:0001", recs(time=times), base, results.REBASED_TREES, rounds.get)}, {"rebased"}) @@ -1127,6 +1229,33 @@ class OverTableTests(unittest.TestCase): self.assertEqual(results.row_status("a:0001", "waves", True, rounds.get), "known gap: the card's own variance (CARD_VARIANCE)") + def test_an_entry_whose_rows_are_all_within_their_limits_is_named_for_removal(self): + entries = [("a:0001", "frame", "open", "core", "abc1234", 1.48, "-"), + ("a:0001", "sampling_*", "gap", "a ruling", "-", None, "-"), + ("a:0001", "alu", "open", "core", "abc1234", 1.2, "-"), + ("a:0001", "waves", "note", "-", "-", None, "looked at once"), + ("a:0001", "untimed", "open", "core", "abc1234", 1.2, "-"), + ("b:0002", "frame", "gap", "a ruling", "-", None, "-")] + within = {"harness-old/frame": 100.0, "harness-new/frame": 101.0, + "harness-old/sampling_deep": 100.0, "harness-new/sampling_deep": 102.0, + "harness-old/sampling_wide": 100.0, "harness-new/sampling_wide": 150.0, + "harness-old/alu": 100.0, "harness-new/alu": 102.0, + "harness-old/waves": 100.0, "harness-new/waves": 100.0, + "harness-new/untimed": 100.0} + over = dict(within, **{"harness-new/alu": 110.0}) + with mock.patch.object(results, "STATUS", entries): + # frame is within; one of sampling_*'s rows is still over; alu is within on one leg of + # its card and over on the other; a note is never named; untimed and b:0002's frame + # were timed on no leg of theirs. + self.assertEqual(results.entries_within({"a:0001": (recs(time=within), None), + "a:0001@other": (recs(time=over), None)}), + [("a:0001", "frame", "open", "core")]) + # sampling_wide back within, the gap is named too. + back = dict(within, **{"harness-new/sampling_wide": 101.0}) + self.assertEqual(results.entries_within({"a:0001": (recs(time=back), None)}), + [("a:0001", "frame", "open", "core"), ("a:0001", "sampling_*", "gap", "a ruling"), + ("a:0001", "alu", "open", "core")]) + if __name__ == "__main__": unittest.main()