Repository navigation
tests: the local-baseline case does not measure CPU contention (macos-python's only red) - #2653
Conversation
|
I checked MEASURED. The full
I also substituted the committed baseline values while leaving The test-only change is to read AI-assisted with OpenAI Codex. |
|
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 ( with open(path, encoding="utf-8") as handle:
written = json.load(handle)["measured"]
result = run("--runs", "1", "--size", "20", "--baseline", path, "--json")
self.assertEqual(result.returncode, 0, result.stderr)
report = json.loads(result.stdout)
self.assertEqual(report["baseline_source"], os.path.abspath(path))
self.assertEqual(sorted(report["baseline"]), sorted(report["measured"]))
# The baseline is that file's own numbers, not the committed ones: substituting the latter fails here.
self.assertEqual(report["baseline"], written)No Checked here, in the direction you checked it: 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. |
|
Ready for review now, for two reasons that are not mine:
This is the last red standing between #2641 and a green board: Written with an AI assistant. |
|
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16, main 452d1d1, PR head 5faa965 (test-only PR, so "red" = main's version of the tests, "green" = this PR's version, both on main's code). MEASURED:
Note: #2566 makes the same SHADER-468 RTZ change to AI-assisted: Claude Code |
|
Update by OreoFR: the conflict with #2566 I reported here is gone. AI-assisted: Claude Code |
test_a_local_baseline_replaces_the_committed_one asks that a locally written baseline replaces the committed one; the 5x limit was incidental to that, and on a shared runner it turned the case into a performance test whose only observed failure was a contended box (macos-python on ProjectLeonida#2641: returncode 1 with empty stderr, i.e. the tool's own over-limit verdict). The over-limit behaviour keeps its deterministic coverage: --max-slowdown 0.01 must report one, and that case asserts it. Written with an AI assistant.
merzleckeier measured what a bigger limit buys and it is not enough: at a 1024x slowdown the 1000x draft still failed 0/3, while comparing the run's baseline back against the file it was given passed 3/3. A limit measures the runner; the numbers do not. So the case now reads the measured values out of the baseline it just wrote and asserts the second run used exactly those, with no --max-slowdown on that invocation. The over-limit behaviour keeps its own deterministic test (--max-slowdown 0.01 must report one), untouched. Verified here: 10 passed, 5 subtests; and substituting a different baseline makes the case fail (1 failed), which is what the assertion is for. Written with an AI assistant.
5faa965 to
7c99b8e
Compare
|
Re-verified after the rebase onto 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. |
No content change.
aslan2142
left a comment
There was a problem hiding this comment.
LGTM. Comparing report["baseline"] directly against the written baseline file's measured dict in tests/test_bench_translate.py removes the CPU-contention flakiness while testing local baseline override deterministically. Clean-room verified, 5/5 CI green, and independently verified. Merging.
(AI-assisted review.)
This 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.