diff --git a/tests/test_rank_pipeline_failures.py b/tests/test_rank_pipeline_failures.py index 2bfae15..488a880 100644 --- a/tests/test_rank_pipeline_failures.py +++ b/tests/test_rank_pipeline_failures.py @@ -44,6 +44,22 @@ def test_modern_rows_do_not_attribute_stale_raw_digest(self): self.assertEqual(rank(rows, {"raw": "obsolete"})[0], {HOST_REJECTED: 5, NO_ANSWER: 3}) + def test_recorded_wave_refusal_ranks_errors_and_stand_ins_together(self): + rows = ["4\tstand-in\tslot62\tCS=raw CS.used=rooted CS.refused=host-lacks-wave64", + "2\t0x80070057\tslot86\tCS=raw CS.refused=host-lacks-wave64", + "1\t0x80070057\tslot86\tCS.refused=host-lacks-wave64"] + counts, shaders, outcomes = rank(rows, {"raw": "stale cached reason"}) + self.assertEqual(counts, {"host-lacks-wave64": 7}) + self.assertEqual(shaders, {"host-lacks-wave64": 2}) + self.assertEqual(outcomes, {"stand-in": 4, "0x80070057": 3}) + + def test_driver_refusal_preserves_detail_and_precedes_lookup_guesses(self): + rows = ["3\tstand-in\tslot62\tCS.used=good CS.refused=driver compile failed: 0x80004005", + "2\tstand-in\tslot62\tCS.refused=driver compile deadline CS.missing=retry"] + counts, _, _ = rank(rows, {"retry": "stale refusal"}) + self.assertEqual(counts, {"driver compile failed: 0x80004005": 3, + "driver compile deadline": 2}) + def test_mixed_attempt_and_independent_missing_stage(self): rows = ["2\t0x80004001\tslot86\tMS.missing=raw MS.used=rooted", "3\t0x80004001\tslot86\tMS.missing=raw MS.used=rooted PS.missing=pixel", diff --git a/tools/rank_pipeline_failures.py b/tools/rank_pipeline_failures.py index a9f1341..cc00a5a 100644 --- a/tools/rank_pipeline_failures.py +++ b/tools/rank_pipeline_failures.py @@ -60,10 +60,23 @@ def rank(lines, reasons): if count <= 0: continue outcomes[outcome] += count - items = [(name, digest) for name, sep, digest in - (item.partition("=") for item in stages.split()) - if sep and name and digest] + # A refusal may contain spaces. The next name=value starts a new field. + items = [(name, value) for name, sep, value in + (item.partition("=") for item in re.split(r"\s+(?=[\w.]+=)", stages.strip())) + if sep and name and value] used = {(name[:-5], digest) for name, digest in items if name.endswith(".used")} + refusal = next(((name.removesuffix(".refused"), value) for name, value in items + if name.endswith(".refused")), None) + if refusal and outcome != "not listed": + stage, reason = refusal + pipelines[reason] += count + keys = {key for name, key in used if name == stage} + if not keys: + keys = {digest for name, digest in items if name == stage and digest != "unknown"} + distinct = shaders.setdefault(reason, set()) + if len(keys) == 1: + distinct.update(keys) + continue missing = [(name[:-8], digest) for name, digest in items if name.endswith(".missing")] used_stages = {stage for stage, _ in used} # A raw digest is not the rooted request key. In modern rows, attribute