tests: the local-baseline case does not measure CPU contention (macos-python's only red) #2653
No reviewers
Labels
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2653
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2653"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fiestorra on GitHub · 2026-11-29 22:23 UTC · original
fiestorra:fix/bench-baseline-threshold→main· +8 −2 · 1 files · 3 commits · merged 2026-12-01 11:29 UTCThis changes a test's threshold, so it is the test owner's call rather than mine. It is not a draft pull request - if you would rather keep the old invocation, say so and I will close it.
The
macos-pythonjob's only failure istest_a_local_baseline_replaces_the_committed_one, and the assertion that fails is not about code:Exit 1 with empty stderr is
scripts/bench_translate.py's own over-limit verdict (return 1 if slow else 0for--json). Two runs seconds apart measured more than--max-slowdown 5apart on a shared runner.What the case is actually for, in its own comment: "The committed numbers come from one machine; on another they would fail a run with no regression in it" - it checks that a local baseline replaces the committed one, that
baseline_sourceis that file, that the key sets match, and that no spurious regression is reported. The 5x limit was incidental to exercising the flag.What the change is: the
--max-slowdown 5guard is removed from that one invocation - not raised - becausescripts/bench_translate.pytakes--max-slowdownwithdefault=Noneand applies no limit at all when it is absent. The case keeps its intent (a local baseline replaces the committed one) without also measuring CPU contention. It also dropsself.assertEqual(report["over_limit"], []), which only held while the guard existed, and asserts instead that the report'sbaselineis the file the test just wrote. The over-limit behaviour keeps its own deterministic coverage:--max-slowdown 0.01must report one, asserted at line 48-51 against a synthetic baseline that cannot be noise.Tested:
python3 -m pytest tests/test_bench_translate.py -q-> 10 passed, 5 subtests, including the forced-regression case that still asserts a non-emptyover_limit.Not tested: on macOS, which is the job this is for - I have Windows only. What I can say is that the change cannot make the plumbing assertions weaker (they are untouched) and that the timing assertion is the only one removed.
If a maintainer would rather keep a performance threshold in this case, the alternative is to take the better of two written baselines, which is more code for the same purpose; I did not choose for you.
The extra commit at the tip (no longer carried)
The branch used to carry
a3b5ebea1(test(semantic): align computed-I/J f16 interp oracle…), added only becausesemantic-testswas red onmainfor that oracle and every branch cut frommaininherited it.mainnow has the same edit asc717967d0, so a rebase drops the commit and this pull request no longer touchestests/semantic/test_interp_computed_ij_fallback.py- the diff is only what this change actually needs.AI-assisted: yes - DeepSeek v4.1 (flash) as the coding agent, with a separate reviewer agent reading the change before submission. Where and on what: the measurements above were taken on Windows 11 with MSVC 19.44.35226 on an RTX 4090 (NVIDIA driver 621.24) where a C++ or GPU path is involved; Python and docs cases need none of it.
Written with an AI assistant.
@merzleckeier on GitHub · 2026-11-29 22:29 UTC · original
I checked
2ec0571e(GitHub mergefe8b6003) against452d1d1bon CachyOS with Python 3.14.10. The CLI for this case can omit--max-slowdownand check the saved numbers directly. I tested that change alongside the draft.MEASURED. The full
python3 -I tests/test_bench_translate.py -vrun passed 10/10 in each tree. In a diagnostic replay I supplied the same recorded baseline to each tree and scaled only the second invocation's measured values. These are injected ratios.I also substituted the committed baseline values while leaving
baseline_sourceset to the local file. The base and draft both passed that probe. The variant failed at dictionary equality, as intended.The test-only change is to read
json.load(handle)["measured"]from the file just written, run the second command with--baselineand--jsonwithout a limit, then checkself.assertEqual(report["baseline"], written_measurements)alongside the existing path and key checks. The separate--max-slowdowntests still pass in both output formats and in--compare.AI-assisted with OpenAI Codex.
@fiestorra on GitHub · 2026-11-29 22:44 UTC · original
Your replay data settled it, and I took your variant rather than mine.
What your table showed: a 1000x limit is still a timing threshold - at a 1024x slowdown it failed 0/3, while comparing the run's baseline back against the file it was handed passed 3/3 in every replay. A limit measures the runner; the numbers do not.
What the branch now does (
8fc90097c):No
--max-slowdownon that invocation at all, so the case asserts the thing its name says - a local baseline replaces the committed one - and nothing about CPU contention.Checked here, in the direction you checked it:
python3 -m pytest tests/test_bench_translate.py -q-> 10 passed, 5 subtests; and your negative control reproduced - substituting a different baseline makes the case fail (1 failed), so the new assertion is load-bearing rather than decorative. The--max-slowdown 0.01case still reports an over-limit as before.Thank you for measuring the 1024x point instead of accepting the 1000x; that is the difference between a patch that hides the flake and one that removes it.
Written with an AI assistant.
@fiestorra on GitHub · 2026-11-29 22:45 UTC · original
Ready for review now, for two reasons that are not mine:
452d1d1b6with the interp commit (a3b5ebea1) thatmainis missing, sosemantic-testsis not red for a reason this branch does not own. If #2633 merges first that commit becomes a duplicate and can be dropped.python3 -m pytest tests/test_bench_translate.py tests/semantic/test_interp_computed_ij_fallback.py -q-> 19 passed, 18 subtests, and substituting a different baseline still fails the case (the assertion is load-bearing).This is the last red standing between #2641 and a green board:
macos-pythonis the only failing job on it.Written with an AI assistant.
@OreoFR on GitHub · 2026-11-29 23:03 UTC · original
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16, main
452d1d1b6, PR head5faa965ca(test-only PR, so "red" = main's version of the tests, "green" = this PR's version, both on main's code). MEASURED:tests/semantic/test_interp_computed_ij_fallback.py(pytest): main's version 2 failed / 9 (test_p1lv_f16_computed_ij_uses_interpolated_attribute_not_vsrc2,test_perspective_fixture_branch_and_f16_halves); this PR's version 9/9 passed, 13 subtests.tests/test_bench_translate.py(python3 -I, 3 runs each, idle machine): main's version 10/10 OK ×3, this PR's version 10/10 OK ×3. The CPU-contention failure did not reproduce here, so this run neither confirms nor refutes the flake; it only shows the new assertion passes.Note: #2566 makes the same SHADER-468 RTZ change to
test_interp_computed_ij_fallback.py, and this PR conflicts with #2566 on that file (git merge-treeof main+this PR against #2566). Splitting thetest_bench_translate.pyhalf out would let it land on its own.AI-assisted: Claude Code
@OreoFR on GitHub · 2026-11-30 10:10 UTC · original
Update by OreoFR: the conflict with #2566 I reported here is gone.
main(1b0f657f3) now carries the SHADER-468 change totests/semantic/test_interp_computed_ij_fallback.py(71db4c405), and this PR merges cleanly both withmainand on top ofmain+ #2566 (git merge-tree, checked 2026-11-30 11:10 local). Note also that my earlier check merged this PR withmainfirst and then compared against #2566's head, which can report a conflict through an older merge base; I now checkmain+ #2566 first, then the PR.AI-assisted: Claude Code
5faa965ca7to7c99b8e504@fiestorra on GitHub · 2026-11-30 14:00 UTC · original
Re-verified after the rebase onto
main20fe0c754, on this machine (Windows 11, MSVC 19.44.35226): the diff no longer carries the interp-oracle commit (mainhas it asc717967d0), and what is left still passes.What I did not test: the rest of the change, and anything the rebase did not touch. This confirms the rebase kept the change working, not that the change is correct - that is what the review and the CI are for.
Written with an AI assistant.
@aslan2142 on GitHub · 2026-12-01 11:29 UTC · original · approved these changes
LGTM. Comparing
report["baseline"]directly against the written baseline file'smeasureddict intests/test_bench_translate.pyremoves the CPU-contention flakiness while testing local baseline override deterministically. Clean-room verified, 5/5 CI green, and independently verified. Merging.(AI-assisted review.)