tests: four numpy gates decided in the wrong process, so their cases judged the exit code instead #2672
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!2672
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2672"
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-30 01:32 UTC · original
fiestorra:fix/tile-probe-numpy-gate→main· +28 −8 · 3 files · 5 commits · merged 2026-12-01 11:29 UTCFour files, one bug, one review. Each decides "is numpy usable?" from this process, while the test it gates launches the tool as
python -I- and-Iimplies-s, which hides a--userinstall. On a machine where numpy came frompip install --userthe gate opens and the child dies withModuleNotFoundError: No module named 'numpy', so the test judges the child's exit code instead of the behaviour it names.The files
tests/test_tile_probe.py-find_spec-> the isolated probe, gating the four cases that reach numpy. The other eleven keep running: they exercise the tool's file and argument checks, which happen before numpy is touched. (Skipping the whole class turned 12 passing tests into 12 skips; the class docstring's "those tests skip without it" was already an overstatement.)tests/test_swizzle_search.py- same shape:HAVE_NUMPYstays for the tests that call numpy here, the nine CLI gates use the newNUMPY_VISIBLE_TO_TOOL.tests/test_tool_startup.py- this one had a second, subtler gap. It skipped aNUMERIClist when numpy was missing, but:have_numpywas the in-process question, so the skip never fired on this machine;calibrated_textureandtex_exportare not numeric themselves. (amd_swizzlewas a third, until #2671 made its import late.)So the probe matches how the tools run, and a child that fails with
"No module named 'numpy'"is skipped rather than called a startup failure.Measured,
mainb8bd37111, Windows 11, Python 3.13.14And with #2667 and #2671 applied on top, the whole Python suite went from 22 failed / 11,853 passed to 0 failed / 11,858 passed (
tests/excludingtests/semantic, which has to be a separate run:test_address_guard.pyexists in both directories and pytest refuses to collect both).Where
-Ican see numpy - CI - both probes return true, every gate opens, and the cases run exactly as before. Test-only: no tool behaviour moves.Not in this PR
#2671 also changes
tools/amd_swizzle.py, because there the tool reported "needs numpy" before validating arguments. These three files have no such problem.A correction from the review, applied as its own commit (
46ce12bb9)The first version of the
test_swizzle_search.pygates over-skipped: five cases that pass onmainin a user-site environment were being skipped, becauseNUMPY_VISIBLE_TO_TOOLwas the wrong gate for all of them.merzleckeier measured exactly which, and the reasons differ:
render()calls (BC1, BC3) use the parent's numpy and Pillow, soHAVE_NUMPY and HAVE_PILwas right and my gate was too strict;maintoo.Their follow-up (
f9456e020) is applied unchanged as its own commit:PIL_VISIBLE_TO_TOOLjoins the probe, the five cases run again, and the two PNG tests are gated on the child's Pillow. The numbers above are after it.What that says about my own measurement: I measured in exactly one dependency configuration - numpy hidden from
-I- and in that configuration over-skipping looks identical to correct skipping. "0 failed" was true and was not enough.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.
tests: tile_probe's numpy gate asks the way the tool runs, and keeps the eleven that do not need itto tests: three numpy gates decided in the wrong process, so the CLI cases tested the exit code instead@OreoFR on GitHub · 2026-11-30 01:39 UTC · original
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16, main
40e7fe69d, PR head of this PR (test-only, so "main" = main's test files, "PR" = this PR's, both on main's tools). MEASURED in two environments:python3.12 -I)test_swizzle_search.pymain / PRtest_tile_probe.pymain / PRpip install --user, visible to the test process but hidden from thepython -Ichild): this Mac has numpy only in a venv, which-Idoes not hide. So the fix itself is not covered here.test_tile_probe.pystill skips 13 of 15 with this PR ('tile_probe.py needs numpy'), including argument/file cases such astest_negative_offset_is_a_usage_errorandtest_missing_file_is_a_message_not_a_traceback; onlytest_missing_file_is_a_usage_error_without_numpyandtest_missing_numpy_is_one_error_linerun. The description says "the other eleven keep running", so in a numpy-less environment that part does not hold.AI-assisted: Claude Code
@merzleckeier on GitHub · 2026-11-30 01:40 UTC · original
I tested the user-site setup that was missing from the macOS verification. On CachyOS / Python 3.14.10 I put NumPy and Pillow in an isolated
PYTHONUSERBASEand verified that only the parent imports them. Base40e7fe69, PRd4075649.test_swizzle_search.pycases that all pass on main in this environment. Two callrender()directly (BC1 and BC3), so the parent’s NumPy and Pillow are sufficient. The other three test invalid numeric arguments, a missing input, and an output alias. Those CLI checks finish before the child needs NumPy. CLI validation ordertile_probechanges stay as in your PR. Together with the companion #2671 test adjustment, all three files finish without failures in the four dependency configurations.AI-assisted with OpenAI Codex.
tests: three numpy gates decided in the wrong process, so the CLI cases tested the exit code insteadto tests: four numpy gates decided in the wrong process, so their cases judged the exit code instead@OreoFR on GitHub · 2026-11-30 03:11 UTC · original
Re-check by OreoFR on the new head
46086f4ec, same Mac (macOS 27.2.1, Apple M5, Python 3.12.16), main1d22590b9. MEASURED, main's test files vs this PR's, on main's tools:python3.12 -I)test_swizzle_search.pytest_tile_probe.pytest_tool_startup.py(new in this head)No regression in either environment; merges cleanly with main and with #2566. The
--usercase the PR is about is still not reproducible here (see merzleckeier's CachyOS run above for it).AI-assisted: Claude Code
@fiestorra on GitHub · 2026-11-30 03:14 UTC · original
You are right again, and this one was a coverage regression rather than a red one: five cases that pass on
mainin this environment were being skipped by my gates. Applied as46ce12bb9, your follow-up unchanged.The reasoning I missed, in your words and now in the diff:
render()calls (BC1, BC3) use the parent's numpy and Pillow, soHAVE_NUMPY and HAVE_PILwas the right gate andNUMPY_VISIBLE_TO_TOOLwas too strict;swizzle_search.py- so they should not have been gated at all;maintoo, andPIL_VISIBLE_TO_TOOLis the probe that was missing.Verified here after applying it:
What I would have caught with your matrix and did not, stated plainly: my "0 failed" was measured in exactly one dependency configuration - numpy hidden from
-I- and in that configuration over-skipping looks identical to correct skipping. Your four configurations are what turned "no failures" into "no failures and no lost coverage".Together with the
36654350aadjustment on #2671, all three files now finish without failures in the four setups. Thank you for doing the half of the work that cannot be done on this machine.Written with an AI assistant.
@OreoFR on GitHub · 2026-11-30 03:21 UTC · original
Re-check by OreoFR on head
46ce12bb9, same Mac, main1d22590b9. MEASURED, green (main + this PR):test_swizzle_search.py: venv 31/31; without numpy Ran 30, OK, skipped=20 (was 23 skipped ond4075649band on main): 3 more cases now run without numpy and pass.test_tile_probe.py: venv 14 passed, 1 skipped; without numpy 15 run, OK, 13 skipped (unchanged).test_tool_startup.py: venv 2 passed, 221 subtests; without numpy 2 run, OK.AI-assisted: Claude Code
@fiestorra on GitHub · 2026-11-30 03:41 UTC · original
Rebased with the one commit
mainis missing, the same one #2633 and my other pull requests carry (a3b5ebea1, TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ).semantic-testsis red onmainfor the interp oracle, so every branch cut from it inherits that failure regardless of what it changes.Verified after adding it, on this branch:
If #2633 merges first this fifth commit becomes a duplicate and can be dropped; if this lands first, #2633 becomes a no-op.
A note on how this branch was pushed, because I broke one today: the last two pushes of mine went through a
git checkoutthat had failed silently, and one of them replaced a branch withmainand closed its pull request (#2641, re-opened as #2691). This one checkedgit rev-parse --abbrev-ref HEADbefore pushing and printed it before the push line; a--forcedeserves that much.Written with an AI assistant.
@OreoFR on GitHub · 2026-11-30 03:46 UTC · original
Note by OreoFR on head
769138928: the new commit adds the SHADER-468 change totests/semantic/test_interp_computed_ij_fallback.py, and with it this PR now conflicts with #2566 (git merge-treeof main + this PR against #2566), which carries the same change. The numpy-gate files are unchanged since my check of46ce12bb9.AI-assisted: Claude Code
@fiestorra on GitHub · 2026-11-30 03:56 UTC · original
Thank you - and the conflict you found is not what I would have guessed. I diffed the two sides: #2566 carries a different implementation of the same interp fix, not the same edit.
a3b5ebea1(what this branch carries)f16_rtz_bits(x)f16_rtz_bits(val)xto f16 bits toward zero…"So "resolve by taking either side" is wrong here: it is a choice between two oracles, and only one of them can be the one that ends up describing SHADER-468 in
main. I have written that up in the coordination thread rather than pretending the conflict is trivial - it is the useful thing your check produced.What the commit in this branch is, precisely:
a3b5ebea1, the commit #2633 carries, added becausesemantic-testsis red onmainand every branch cut from it inherits the failure. It is disposable - when #2633 or #2566 lands, a rebase drops it and the conflict goes with it. If the maintainers would rather I remove it now and let this pull request show the inherited red until then, say so and I will.On the rest of your re-check: thank you for the no-numpy case.
Ran 4, OKwithpython3.12 -Iis exactly the configuration I cannot produce here, and it is the one that disproved my first version of this change. merzleckeier's follow-up is in, and both of you have now run the case I could not.Written with an AI assistant.
@fiestorra on GitHub · 2026-11-30 03:57 UTC · original
Correction to what I wrote above: I diffed the wrong thing. It is one change, not two.
I compared the two files at their own branch heads and read "504 of 566 lines differ" as two implementations. Those files come from different bases, so most of that was drift. Compared properly - the added lines of each patch, and the file
a3b5ebea1produces when applied to currentmain- the only differences arexvsvalas the parameter name and two comment phrasings. Same helper, same algorithm, same constants.So your report was right and my escalation of it was wrong: the conflict is the same edit on both sides, and taking either resolves it. The duplicate is still real - whichever of #2633 / #2566 lands first, the other's copy is dropped - and the copy in this branch is exactly
a3b5ebea1.Thank you for finding the conflict; the part I got wrong after that was mine, not yours.
Written with an AI assistant.
@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
7691389287tob3b064bb79@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.
@aegish-zagi on GitHub · 2026-11-30 14:38 UTC · original
VERIFY-2672 — PASS (with one stated limit)
b3b064bb79| merge state vs mainb17b22d33: CLEAN (scratch merge, no conflicts)@KelboLive on GitHub · 2026-11-30 16:18 UTC · original
Independent check on Windows (not the author), at
dbd6ccc2b.python -I tests/test_tool_startup.py: 2 tests OK (137.6 s — subprocess start-up cases).python -I tests/test_swizzle_search.py: 30 tests OK (1.76 s).python -I tests/test_tile_probe.py: 15 tests OK, 1 skipped (1.26 s).Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10, no numpy required for these runs.
AI-assisted: yes (opencode).
@aslan2142 on GitHub · 2026-12-01 11:29 UTC · original · approved these changes
LGTM. Checking
numpy/PILvisibility inside an isolatedpython -Isubprocess intests/test_swizzle_search.py,tests/test_tile_probe.py, andtests/test_tool_startup.pyfixes false skips/failures when packages are only in user-site, and un-gates CLI validation tests that run before numpy import. Clean-room verified, 5/5 CI green, and independently verified. Merging.(AI-assisted review.)