pk16_diff: generate the packed high-half constant read by default #2560
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2560
Loading…
Reference in a new issue
No description provided.
Delete branch "jjjj2244-patch-1"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as:
TOOL-PK16-CONST-HI(claim)What and why
tools/pk16_diff.pystill listedpk-const-hiinKNOWN_DIVERGENCES: "a constant in a packed add/sub/mul_lo/min/max/mad source whose high half op_sel or op_sel_hi reads: the translator raises Unsupported". That stopped being true on 2026-11-22. A constant source is its 32-bit dword andop_sel/op_sel_hiindex that dword, high half included (measured on gfx1036,docs/design.md, "Packed 16-bit integer ops").Because the entry existed, the generator refused to put a constant anywhere its high half would be read, so the form was never fuzzed by default. Three things already in the tree contradicted the entry:
tests/test_pk16_diff.py::test_a_wrong_translation_is_caughtrunsv_pk_add_u16 v1, v2, 1 op_sel_hi:[1,0]throughd.check()and asserts the translator matches;test_constants_are_their_32_bit_valueasserts the reference's high-half read:v_pk_add_u16 v1, 0x12345678, 0is0x12345678;docs/shader_validation.mdrecords 2,300--oracle hwprograms on gfx1036 with the--knownforms included matching the model.So the entry was stale, and it cost coverage of a measured form. This removes it, lets a constant go in any packed source, and corrects the two documents that still said the translator rejects the form.
tools/pk16_diff.py:KNOWN_DIVERGENCES = {}; a constant is allowed in every packed source;PK_SHIFTSremoved (its only use was that gate); docstring updated.tests/test_pk16_diff.py:test_known_divergences_are_left_out_by_defaultreplaced bytest_the_high_half_constant_read_is_not_left_outandtest_generated_high_half_constant_reads_match_the_translator.docs/design.md: the packed 16-bit row said a constant's high half "is not measured ... raisesUnsupported"; it is measured and handled.docs/shader_validation.md: the same claim in thepk16_diffsection.KNOWN_DIVERGENCESand the--knownflag are kept (empty) rather than removed, so--knownand the tests that use it keep working; #1654 touches the same mechanism and would otherwise conflict.Tested
Windows 11 (build 26300), Python 3.13, no GPU. The two new tests fail on
main'stools/pk16_diff.pyand pass with this branch:The last run is why the entry is removed rather than kept: with the known forms enabled, main already agreed with the reference on the form over 1,500 programs, with no skips. The whole standalone unit suite was run on the branch and compared with
main(520 of 554 run standalone, the same 6 environment-dependent failures on both).No hardware run: this changes a fuzzer's generator and two documents, not the translator, so there is nothing new to measure on a GPU. The hardware evidence behind the rule is the one already recorded: gfx1036 in
docs/design.md, and the 2,300--oracle hwprograms indocs/shader_validation.md.Branch is based on
ef8fbf0;mainhas moved tob1619e0since, and those commits touch onlyruntime/src/cpu_emulation.handruntime/test/cpu_emulation_test.cpp, so GitHub reports this merges cleanly.GPUs tested: n/a (no GPU test in this change)
AI-assisted: yes — written by a coding agent (OpenCode; DeepSeek V4.1 Flash) working under this account.
Checklist
mainand merges cleanly (GitHub: "Able to merge").docs/design.md; only the row's stale text is corrected).#2560 | head 0ab5ccd213d819f7c588fb4db2de944f42440283 | python -I tests/test_pk16_diff.py | red: FAILED (failures=2, AssertionError) | green: 17/17 OK (2.072s) | full suite: 513/521 stdlib passed, 0 new failures vs main 8994000b08 | Windows 11, Python 3.14.7, no game files | AI-assisted: yes, Antigravity (Gemini)Details:
tests/test_pk16_diff.pyonupstream/main8994000b08):Ran 17 tests in 10.834s — FAILED (failures=2)(AssertionError: 0 not greater than or equal to 5intest_generated_high_half_constant_reads_match_the_translatorandAssertionError: {'pk-const-hi': ...} != {}intest_the_high_half_constant_read_is_not_left_out).upstream/main8994000b08):Ran 17 tests in 2.072s — OK.scripts/check_no_game_data.py->0;python -m compileall -q tools scripts tests->0;node --test tests/test_viewer_streaming.cjs->0; standalone stdlibtests/test_*.py->513/521 passed(33skipped pytest/helper files;0new failures vs8994000b08, same 8 pre-existing Windows/docs/timeout failures:test_docs_cli_flags.py,test_docs_env_vars.py,test_docs_python_deps.py,test_docs_repo_paths.py,test_make_game_preflight.py,test_progress_dashboard.py,test_semantic_mutants.py,test_tool_stdout_encoding.py).Reviewed the diff and tested merged onto
main(493867366).Clearing the stale
pk-const-hientry fromKNOWN_DIVERGENCESwhile keeping--knownintact, updating the generator/tests, and aligningdocs/design.mdanddocs/shader_validation.mdis clean and matches the current translator behaviour.Tests run
python -I tests/test_pk16_diff.py: 17/17 passed (12.73 s).python -I tools/pk16_diff.py --programs 500 --seed 11 --max-ops 8: 500 pass, 0 mismatch, 0 skipped.AI-assisted (Antigravity, Gemini).
#2560 | head
0ab5ccd213d819f7c588fb4db2de944f42440283(merged cleanly ontomaind48a957bb9988afce424552a3c0c8d01ef12320f) | Windows 11 (10.0.26200), CPython3.12.10,llvm-mc(gfx1013),spirv-val(1.4.363.1), NVIDIA GeForce RTX 3090 (Vulkan1.4.341, driver610.88,subgroup 32..32,LEONIDA_VK_VALIDATION=1)main(d48a957bb9988afce424552a3c0c8d01ef12320f):tests/test_pk16_diff.pyfails onmain(KNOWN_DIVERGENCESretains'pk-const-hi', leaving packed high-half constant reads out of default generation).PR + main:python -I tests/test_pk16_diff.py -v: pass (OK).python -I tools/pk16_diff.py --programs 200 --seed 7:200/200pass (0mismatches,0skipped).vk_compute_test,LEONIDA_VK_VALIDATION=1,spirv-valclean): assembled and executed10generatedpk16_diffprograms containing non-shift packed high-half constant reads (op_sel/op_sel_hiindexing bits[31:16]of inline/literal constants) ->10/10GPU 4-word outputs matchpk16_diff.referencebit-for-bit (0Khronos validation errors).scripts/check_no_game_data.py,test_docs_encoding.py, andtest_text_write_line_endings.py: pass (0CRLF).AI-assisted.
Tested
0ab5ccd21merged (no commit) withmainaa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_pk16_diff.py, 21 tests pass. Onmain, its 20 tests pass.tools/pk16_diff.pyback tomain, 2 tests fail (thepk-const-hicase is missing).No blocker from my side.
AI-assisted (Claude Code).
Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto
maine1d87a4a4 without conflict, and its test file(s) (tests/test_pk16_diff.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.