From 003071f1c9296264ba2343787b29ea67681a8d34 Mon Sep 17 00:00:00 2001 From: Hedi Trigui Date: Tue, 24 Nov 2026 12:44:50 +0100 Subject: [PATCH] Scripts: skip memory growth limit when main crashed or aborted early When main crashes, experiences device removals, or fails to reach its end before logging full frames, its reported peak commit represents an incomplete run rather than full working-set memory. A PR that fixes the crash runs the full duration and naturally commits more memory than the aborted baseline, triggering a false-positive rejection. Skip the 125% peak commit ceiling check when main did not exit cleanly (crashes, device removals, non-zero exit, or incomplete frame log). Clean baselines continue to enforce the growth limit. --- scripts/pr_check.py | 8 +++++++- scripts/test_pr_check.py | 44 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/scripts/pr_check.py b/scripts/pr_check.py index 3a526b4a9d..33537cc392 100644 --- a/scripts/pr_check.py +++ b/scripts/pr_check.py @@ -139,7 +139,13 @@ def check(body, head, files, is_main_ancestor, *, test_only=False): if mf and (pf is None or pf < FRAMES_KEPT * mf): problems.append(f"the PR's run shows fewer frames than main's ({pf} against {mf})") pc, mc = number(pr.get("peak commit")), number(m.get("peak commit")) - if pc and mc and pc > COMMIT_GROWTH * mc: + main_crashed = ( + (number(m.get("crashes")) or 0) > 0 + or (number(m.get("device removals")) or 0) > 0 + or mf is None + or (m.get("exit") and m.get("exit") != "0x0") + ) + if not main_crashed and pc and mc and pc > COMMIT_GROWTH * mc: problems.append(f"the PR's run commits much more memory than main's ({pc} MB against {mc} MB)") return problems diff --git a/scripts/test_pr_check.py b/scripts/test_pr_check.py index e5de366a54..934e387c88 100644 --- a/scripts/test_pr_check.py +++ b/scripts/test_pr_check.py @@ -97,5 +97,49 @@ def test_bare_bullets_and_html_comments_only_fail(self): self.assertEqual(3, len(problems)) +class SmokeComparisonTests(unittest.TestCase): + def test_clean_baseline_enforces_memory_growth_limit(self): + main_block = ( + "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: G\nseconds: 60\n" + "exit: 0x0\nframes shown: 1000 (PresentX 1000)\ndevice removals: 0\ncrashes: 0\npeak commit: 100 MB\n```\n" + ) + pr_ok = ( + "```\nxcl-smoke v1\ncommit: 1234567890\ntitle: G\nseconds: 60\n" + "exit: 0x0\nframes shown: 1000 (PresentX 1000)\ndevice removals: 0\ncrashes: 0\npeak commit: 125 MB\n```\n" + ) + pr_regress = ( + "```\nxcl-smoke v1\ncommit: 1234567890\ntitle: G\nseconds: 60\n" + "exit: 0x0\nframes shown: 1000 (PresentX 1000)\ndevice removals: 0\ncrashes: 0\npeak commit: 126 MB\n```\n" + ) + files = [changed("crates/xcl/src/hle/d3d12x/vram.rs")] + self.assertEqual([], check(BODY + main_block + pr_ok, HEAD, files, lambda sha: sha == "1111111aaaa")) + problems = check(BODY + main_block + pr_regress, HEAD, files, lambda sha: sha == "1111111aaaa") + self.assertEqual(["the PR's run commits much more memory than main's (126 MB against 100 MB)"], problems) + + def test_crashed_baseline_skips_memory_growth_limit(self): + crashed_main_blocks = [ + "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: G\nseconds: 60\n" + "exit: 0x887a0001\nframes shown: none logged (the run did not reach its end)\n" + "device removals: 0\ncrashes: 1\npeak commit: 100 MB\n```\n", + "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: G\nseconds: 60\n" + "exit: 0x887a0005\nframes shown: none logged (the run did not reach its end)\n" + "device removals: 1\ncrashes: 0\npeak commit: 100 MB\n```\n", + "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: G\nseconds: 60\n" + "exit: 0x0\nframes shown: none logged (the run did not reach its end)\n" + "device removals: 0\ncrashes: 0\npeak commit: 100 MB\n```\n", + "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: G\nseconds: 60\n" + "exit: 0xc0000005\nframes shown: 50 (PresentX 50)\n" + "device removals: 0\ncrashes: 0\npeak commit: 100 MB\n```\n", + ] + pr_block = ( + "```\nxcl-smoke v1\ncommit: 1234567890\ntitle: G\nseconds: 60\n" + "exit: 0x0\nframes shown: 3000 (PresentX 3000)\ndevice removals: 0\ncrashes: 0\npeak commit: 250 MB\n```\n" + ) + files = [changed("crates/xcl/src/hle/d3d12x/vram.rs")] + for main_block in crashed_main_blocks: + with self.subTest(main=main_block.splitlines()[6]): + self.assertEqual([], check(BODY + main_block + pr_block, HEAD, files, lambda sha: sha == "1111111aaaa")) + + if __name__ == "__main__": unittest.main()