Scripts: pr_check holds the 125 % peak commit to medians of 3 runs #2268

Open
github-bot wants to merge 2 commits from github-bot/gh-2268 into main AGit
Owner

@⁠KainanP on GitHub · 2026-11-25 11:54 UTC · original
KainanP:scripts-commit-noise-2225 → main · +101 −10 · 3 files · 2 commits · open

pr_check.py rejects a runtime PR when its one smoke run shows more than 125 % of main's peak commit, but one run's peak commit is bimodal: the same release build of main gave 11,374 to 20,977 MB on one machine, and #2223 (a help-text change) came out at 164 % and 55 % of main on two pairs of the same two commits (numbers in #2225). So a clean PR fails by chance, and a regression can pass on main's high draw. This keeps the 125 % rule but applies it to the medians of 3 runs a side, as the issue suggests; with fewer runs the ratio is printed and only more than twice main's fails. Fixes #2225.

The 200 % single-pair ceiling is my choice, set above the largest same-build spread in the issue (20,977 / 11,435 = 1.84x) so a doubling still fails without repeats; if you would rather have the single-pair check purely advisory (as suggested in the issue comments), that is a one-constant change (COMMIT_NOISE).

What is in it

  • scripts/pr_check.py: the peak-commit comparison takes the median of the PR's clean blocks and of main's blocks of the same title and time. With at least COMMIT_RUNS = 3 on each side the 125 % limit fails the PR as before; with fewer, over 125 % is printed as a note: line (the check passes) and over COMMIT_NOISE = 2.0 times main's still fails. check() takes an optional notes list for that. Crash, device-removal, exit and frames checks are unchanged (they still look at the last PR block and the first matching main block).
  • scripts/test_pr_check.py: PeakCommitTests with the issue's numbers: one pair inside the spread passes with a note (#2223's 11,952 / 19,558 MB), one pair under 125 % passes silently, one pair over 200 % fails, 3 runs a side with medians over 125 % fail, Creaa's run with one low draw among three passes, 3 + 1 runs are judged as one pair, and no peak commit line compares nothing.
  • CONTRIBUTING.md: the 125 % sentence says how it is applied now.

Tested

  • Windows 11 Home 10.0.26200, NVIDIA GeForce RTX 4060 Laptop GPU (driver 610.47), Intel Core i7-14650HX, Rust 1.97.0, debug; commit a1afe3b on main 1a0bbe3
  • python -B -m unittest discover -s scripts -p "test_*.py": 32 passed, 0 failed (20 in test_pr_check.py, 7 new). The 7 new tests fail on main's pr_check.py.
  • python scripts/pr_check.py --local on a synthetic body with one pair at 11,952 / 19,558 MB: prints the note with 163 % and description ok, exit 0; the same body at 25,000 MB: "commits much more memory than main's", exit 1.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 1250 passed, 0 failed, 46 ignored
  • SKIPPED on this adapter (17 tests, 27 lines): 15 recompiler GPU tests in gpu::recomp::lower, lower_dxil and recomp::tests (no wave64; some lower_dxil cases "per-lane form: refused"), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), shaders::tests::pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache), test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state (no D3D12 debug layer)

Regression run

  • not needed: no runtime file changes (scripts/ and CONTRIBUTING.md only).

Not tested

  • No xcl-smoke runs: this does not touch crates/xcl/src, and the numbers in the tests are the ones from #2225, not runs of mine.
  • smoke.ps1 -Repeat N (printing several blocks in one go) is not part of this; for now 3 blocks a side means running smoke.ps1 3 times.
  • The frames check (80 %) has the same one-pair problem per the issue; left as it is here.
  • Not run through the PR checks workflow on GitHub before this PR.
  • This will conflict textually with open #2230 / #2235 / #1112 / #2219, which change the same block of check().

AI use

  • Claude Code with Claude Opus 5.5: wrote the change, the tests and this description, and ran the tests above.

🤖 Generated with Claude Code

**@⁠KainanP** on GitHub · 2026-11-25 11:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2268) `KainanP:scripts-commit-noise-2225` → `main` · +101 −10 · 3 files · 2 commits · open `pr_check.py` rejects a runtime PR when its one smoke run shows more than 125 % of main's peak commit, but one run's peak commit is bimodal: the same release build of main gave 11,374 to 20,977 MB on one machine, and #2223 (a help-text change) came out at 164 % and 55 % of main on two pairs of the same two commits (numbers in #2225). So a clean PR fails by chance, and a regression can pass on main's high draw. This keeps the 125 % rule but applies it to the medians of 3 runs a side, as the issue suggests; with fewer runs the ratio is printed and only more than twice main's fails. Fixes #2225. The 200 % single-pair ceiling is my choice, set above the largest same-build spread in the issue (20,977 / 11,435 = 1.84x) so a doubling still fails without repeats; if you would rather have the single-pair check purely advisory (as suggested in the issue comments), that is a one-constant change (`COMMIT_NOISE`). **What is in it** - `scripts/pr_check.py`: the peak-commit comparison takes the median of the PR's clean blocks and of main's blocks of the same title and time. With at least `COMMIT_RUNS = 3` on each side the 125 % limit fails the PR as before; with fewer, over 125 % is printed as a `note:` line (the check passes) and over `COMMIT_NOISE = 2.0` times main's still fails. `check()` takes an optional `notes` list for that. Crash, device-removal, exit and frames checks are unchanged (they still look at the last PR block and the first matching main block). - `scripts/test_pr_check.py`: `PeakCommitTests` with the issue's numbers: one pair inside the spread passes with a note (#2223's 11,952 / 19,558 MB), one pair under 125 % passes silently, one pair over 200 % fails, 3 runs a side with medians over 125 % fail, Creaa's run with one low draw among three passes, 3 + 1 runs are judged as one pair, and no `peak commit` line compares nothing. - `CONTRIBUTING.md`: the 125 % sentence says how it is applied now. **Tested** - Windows 11 Home 10.0.26200, NVIDIA GeForce RTX 4060 Laptop GPU (driver 610.47), Intel Core i7-14650HX, Rust 1.97.0, debug; commit a1afe3b on main 1a0bbe3 - `python -B -m unittest discover -s scripts -p "test_*.py"`: 32 passed, 0 failed (20 in `test_pr_check.py`, 7 new). The 7 new tests fail on main's `pr_check.py`. - `python scripts/pr_check.py --local` on a synthetic body with one pair at 11,952 / 19,558 MB: prints the note with 163 % and `description ok`, exit 0; the same body at 25,000 MB: "commits much more memory than main's", exit 1. - `cargo build --workspace && cargo test --workspace -- --test-threads=4`: 1250 passed, 0 failed, 46 ignored - SKIPPED on this adapter (17 tests, 27 lines): 15 recompiler GPU tests in `gpu::recomp::lower`, `lower_dxil` and `recomp::tests` (no wave64; some `lower_dxil` cases "per-lane form: refused"), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows), `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` (cannot disable the driver cache), `test_title_draws_with_a_root_signature_under_the_debug_layer` and `uploads_start_from_each_subresources_state` (no D3D12 debug layer) **Regression run** - not needed: no runtime file changes (`scripts/` and `CONTRIBUTING.md` only). **Not tested** - No `xcl-smoke` runs: this does not touch `crates/xcl/src`, and the numbers in the tests are the ones from #2225, not runs of mine. - `smoke.ps1 -Repeat N` (printing several blocks in one go) is not part of this; for now 3 blocks a side means running `smoke.ps1` 3 times. - The frames check (80 %) has the same one-pair problem per the issue; left as it is here. - Not run through the `PR checks` workflow on GitHub before this PR. - This will conflict textually with open #2230 / #2235 / #1112 / #2219, which change the same block of `check()`. **AI use** - Claude Code with Claude Opus 5.5: wrote the change, the tests and this description, and ran the tests above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
One 60 s run's peak commit is bimodal: the same build of main gave
11,374 to 20,977 MB (#2225), and #2223, a help-text change, came out at
164 % and 55 % of main on two pairs of the same two commits. So one pair
cannot carry the 125 % limit: a clean PR fails by chance and a real
regression can pass on main's high draw.

pr_check now compares the medians of the PR's and main's blocks of the
same title and time. With 3 or more runs on each side the 125 % limit
holds as before; with fewer, the ratio is printed as a note and only
more than 200 % of main's fails, beyond the observed ~1.84x spread.

Fixes #2225

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An even number of integer-MB samples can produce a half-MB median. Compare the actual medians at both memory thresholds and cover values just above them.

Assisted-by: OpenAI Codex (GPT-6)
(cherry picked from commit f52fbdb8341fb20186562d974ac0b3a75e1d9e81)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:25:04 +00:00
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 13:49 UTC · original

@⁠RavenCurseBurg thanks, that's a real bug: round() on an even-count median rounds half to even, so 12,500.5 MB became 12,500 and slipped under the 125 % line (and 20,000.5 under the 200 % one). Your commit is on the branch as 703c59a (cherry-picked with your authorship): the medians are now compared unrounded, and the message prints the integer percentage. python -B -m unittest discover -s scripts -p "test_*.py": 33 passed here as well (Windows 11 26200, Python 3.14).

AI use: Claude Code (Claude Opus 5.5).

**@⁠KainanP** on GitHub · 2026-11-25 13:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2268#issuecomment-7164351133) @⁠RavenCurseBurg thanks, that's a real bug: `round()` on an even-count median rounds half to even, so 12,500.5 MB became 12,500 and slipped under the 125 % line (and 20,000.5 under the 200 % one). Your commit is on the branch as `703c59a` (cherry-picked with your authorship): the medians are now compared unrounded, and the message prints the integer percentage. `python -B -m unittest discover -s scripts -p "test_*.py"`: 33 passed here as well (Windows 11 26200, Python 3.14). _AI use: Claude Code (Claude Opus 5.5)._
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 13:36 UTC · original · edited 2026-11-25 14:11 UTC

Tested a1afe3bfd25f73fcfae8bc06a41439b07a5dea68 with eight synthetic comparisons through python -B scripts/pr_check.py --local --body <file> --files <file> --head <sha>. With main at 10,000 MB, the strict 125% and 200% limits worked for integer medians, including after permuting the three-run samples. Two comparisons returned exit 0 despite the median crossing the applicable limit:

Main peaks (MB) PR peaks (MB) PR median Observed on PR head
10,000 × 4 12,500 × 2 and 12,501 × 2 12,500.5 Passed silently
10,000 × 2 20,000 and 20,001 20,000.5 Passed with a note

Cherry-pickable fix and regression test. The two new subcases failed on the PR head. With the change, both CLI inputs exited 1, the exact-limit inputs kept their expected results, and all eight comparisons matched expectations. python -B -m unittest discover -s scripts -p "test_*.py" passed 32 tests on the PR head and 33 with the fix.

Windows 11 build 26100.9711, i7-13700, RTX 4060, Python 3.14.3. These inputs test the checker arithmetic. No retail memory measurements, GPU workload or Rust suite. OpenAI Codex (GPT-6) ran the checks, prepared the patch and wrote the report.

Retested after the cherry-pick. At 703c59a21539b4ce9be6813bba2f6129aed8d3c9, git diff --exit-code f52fbdb 703c59a -- scripts/pr_check.py scripts/test_pr_check.py reported no differences. python -B -m unittest discover -s scripts -p "test_*.py" passed all 33 tests on the PR branch, including both half-MB cases above.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 13:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/2268#issuecomment-7164022424) · edited 2026-11-25 14:11 UTC Tested `a1afe3bfd25f73fcfae8bc06a41439b07a5dea68` with eight synthetic comparisons through `python -B scripts/pr_check.py --local --body <file> --files <file> --head <sha>`. With main at 10,000 MB, the strict 125% and 200% limits worked for integer medians, including after permuting the three-run samples. Two comparisons returned exit 0 despite the median crossing the applicable limit: | Main peaks (MB) | PR peaks (MB) | PR median | Observed on PR head | | --- | --- | ---: | --- | | 10,000 × 4 | 12,500 × 2 and 12,501 × 2 | 12,500.5 | Passed silently | | 10,000 × 2 | 20,000 and 20,001 | 20,000.5 | Passed with a note | [Cherry-pickable fix and regression test](https://github.com/RavenCurseBurg/xcl/commit/f52fbdb8341fb20186562d974ac0b3a75e1d9e81). The two new subcases failed on the PR head. With the change, both CLI inputs exited 1, the exact-limit inputs kept their expected results, and all eight comparisons matched expectations. `python -B -m unittest discover -s scripts -p "test_*.py"` passed 32 tests on the PR head and 33 with the fix. Windows 11 build 26100.9711, i7-13700, RTX 4060, Python 3.14.3. These inputs test the checker arithmetic. No retail memory measurements, GPU workload or Rust suite. OpenAI Codex (GPT-6) ran the checks, prepared the patch and wrote the report. **Retested after the cherry-pick.** At `703c59a21539b4ce9be6813bba2f6129aed8d3c9`, `git diff --exit-code f52fbdb 703c59a -- scripts/pr_check.py scripts/test_pr_check.py` reported no differences. `python -B -m unittest discover -s scripts -p "test_*.py"` passed all 33 tests on the PR branch, including both half-MB cases above.
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-25 15:21 UTC · original

Independent Windows check of 703c59a21539b4ce9be6813bba2f6129aed8d3c9. The CLI accepts values exactly on the memory limits and rejects medians 0.5 MB above them.

Tested

  • Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, Python 3.14.5.
  • python -B -m unittest discover -s scripts -p "test_*.py" -v: 33 passed, 0 failed, 0 skipped.
  • Ran python -B scripts/pr_check.py --local --body <fixture> --head <sha> --files <fixture> with four synthetic descriptions and a 10,000 MB baseline. With four runs per side, 12,500 MB exited 0 and 12,500.5 MB exited 1. With two runs per side, 20,000 MB exited 0 with a note and 20,000.5 MB exited 1. Both rejections printed the precise median.
  • Repeated the four CLI cases with the checker from prior revision a1afe3bfd25f73fcfae8bc06a41439b07a5dea68. It accepted all four.

Not tested

Hosted GitHub Actions, real game smoke data, or the Rust workspace suite.

AI use

OpenAI Codex (GPT-6.2 Sol) prepared and ran the checks, verified the results, and wrote this report.

**@⁠nnonno91** on GitHub · 2026-11-25 15:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/2268#issuecomment-7166713224) Independent Windows check of `703c59a21539b4ce9be6813bba2f6129aed8d3c9`. The CLI accepts values exactly on the memory limits and rejects medians 0.5 MB above them. **Tested** - Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, Python 3.14.5. - `python -B -m unittest discover -s scripts -p "test_*.py" -v`: 33 passed, 0 failed, 0 skipped. - Ran `python -B scripts/pr_check.py --local --body <fixture> --head <sha> --files <fixture>` with four synthetic descriptions and a 10,000 MB baseline. With four runs per side, 12,500 MB exited 0 and 12,500.5 MB exited 1. With two runs per side, 20,000 MB exited 0 with a note and 20,000.5 MB exited 1. Both rejections printed the precise median. - Repeated the four CLI cases with the checker from prior revision `a1afe3bfd25f73fcfae8bc06a41439b07a5dea68`. It accepted all four. **Not tested** Hosted GitHub Actions, real game smoke data, or the Rust workspace suite. **AI use** OpenAI Codex (GPT-6.2 Sol) prepared and ran the checks, verified the results, and wrote this report.
Author
Owner

@⁠safesearch77 on GitHub · 2026-11-25 16:28 UTC · original

Tested current head 703c59a21539b4ce9be6813bba2f6129aed8d3c9 (merges cleanly with main 0829441).

Tested

  • CachyOS Linux (Linux 7.3.5-2-cachyos x86_64), 13th Gen Intel Core i9-13900HX, NVIDIA GeForce RTX 4070 Laptop GPU (driver 620.73.04), Python 3.14.10.
  • python3 -B -m unittest discover -s scripts -p 'test_*.py' -v: 33 passed, 0 failed, 0 skipped (21 in test_pr_check.py, including all 8 tests in PeakCommitTests; verified the new tests fail against main's scripts/pr_check.py).
  • Verified exact 125 % (10000 vs 12500 / 12501 MB on 3x3 runs), half-MB even-count medians, and 200 % (10000 vs 20000 / 20001 MB on 1x1 runs) boundaries, plus python3 scripts/pr_check.py --local on this PR's own description (description ok, exit 0).

Two small notes from checking multi-block edge cases & metadata

  1. Earlier crashed/killed PR blocks in a 3-run set: Because field_problems, device removals, crashes, and exit: killed still check only pr = clean[-1] while pcs takes statistics.median across all clean blocks with matching (title, seconds), an earlier PR block that crashed or was killed early (e.g. crashes: 1, frames shown: none logged ..., peak commit: 4200 MB from smoke.ps1) is neither rejected nor excluded from pcs, and can pull a [4200, 25000, 22000] set's median below 1.25 * 18000 (problems = [], notes = []). Validating field_problems / device removals / crashes / killed on every PR block in [b for b in clean if same(b)] would prevent a failed run from skewing the 3-run median.
  2. PR description sync after 703c59a: The second commit 703c59a (Scripts: compare peak commit medians before rounding, Assisted-by: OpenAI Codex (GPT-6)) brought the Python suite from 32 to 33 tests, so Tested (commit a1afe3b / 32 passed) and AI use could be updated to reflect 703c59a and OpenAI Codex (GPT-6).

Not tested

  • Windows PowerShell (scripts/smoke.ps1), Rust/Cargo workspace suite, and D3D12 runtime (this PR changes scripts/pr_check.py, scripts/test_pr_check.py, and CONTRIBUTING.md only).

AI use

  • Antigravity (Gemini 4 Carbon): ran the unit test suite and multi-block boundary/crash probes in an isolated worktree and drafted this report; reviewed by me.
**@⁠safesearch77** on GitHub · 2026-11-25 16:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2268#issuecomment-7168028471) Tested current head `703c59a21539b4ce9be6813bba2f6129aed8d3c9` (merges cleanly with `main` `0829441`). **Tested** - CachyOS Linux (`Linux 7.3.5-2-cachyos x86_64`), 13th Gen Intel Core i9-13900HX, NVIDIA GeForce RTX 4070 Laptop GPU (driver 620.73.04), Python 3.14.10. - `python3 -B -m unittest discover -s scripts -p 'test_*.py' -v`: 33 passed, 0 failed, 0 skipped (21 in `test_pr_check.py`, including all 8 tests in `PeakCommitTests`; verified the new tests fail against `main`'s `scripts/pr_check.py`). - Verified exact 125 % (`10000` vs `12500` / `12501` MB on 3x3 runs), half-MB even-count medians, and 200 % (`10000` vs `20000` / `20001` MB on 1x1 runs) boundaries, plus `python3 scripts/pr_check.py --local` on this PR's own description (`description ok`, exit `0`). **Two small notes from checking multi-block edge cases & metadata** 1. **Earlier crashed/killed PR blocks in a 3-run set:** Because `field_problems`, `device removals`, `crashes`, and `exit: killed` still check only `pr = clean[-1]` while `pcs` takes `statistics.median` across all `clean` blocks with matching `(title, seconds)`, an earlier PR block that crashed or was killed early (e.g. `crashes: 1`, `frames shown: none logged ...`, `peak commit: 4200 MB` from `smoke.ps1`) is neither rejected nor excluded from `pcs`, and can pull a `[4200, 25000, 22000]` set's median below `1.25 * 18000` (`problems = []`, `notes = []`). Validating `field_problems` / `device removals` / `crashes` / `killed` on every PR block in `[b for b in clean if same(b)]` would prevent a failed run from skewing the 3-run median. 2. **PR description sync after `703c59a`:** The second commit `703c59a` (`Scripts: compare peak commit medians before rounding`, `Assisted-by: OpenAI Codex (GPT-6)`) brought the Python suite from 32 to 33 tests, so **Tested** (`commit a1afe3b` / `32 passed`) and **AI use** could be updated to reflect `703c59a` and `OpenAI Codex (GPT-6)`. **Not tested** - Windows PowerShell (`scripts/smoke.ps1`), Rust/Cargo workspace suite, and D3D12 runtime (this PR changes `scripts/pr_check.py`, `scripts/test_pr_check.py`, and `CONTRIBUTING.md` only). **AI use** - Antigravity (Gemini 4 Carbon): ran the unit test suite and multi-block boundary/crash probes in an isolated worktree and drafted this report; reviewed by me.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 17:09 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 17:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/2268#issuecomment-7169084601) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2268/head:github-bot/gh-2268'
git switch 'github-bot/gh-2268'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2268'
git switch 'github-bot/gh-2268'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2268'
git switch 'github-bot/gh-2268'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2268'
git switch 'main'
git merge --squash 'github-bot/gh-2268'
git switch 'main'
git merge --ff-only 'github-bot/gh-2268'
git switch 'main'
git merge 'github-bot/gh-2268'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.