shader: pin unsupported form ranking and decoder result refusals in shader_corpus_report_check #1833
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1840"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T19:21:25Z.
Change
tests/shader_corpus_report_check.pygivestools/shader_corpus_report.pyadecoder callback that reports one
_e32form in one stream and always returnsvalid counts. The ranking of unsupported forms, the other encoding suffixes and
the refusal of invalid callback results could therefore change without a
failure. I applied 16 single-point mutants to the tool by hand and ran the
existing check after each one. Fifteen survived. This PR adds two tests that
kill 13 of them. The tool is unchanged.
tools/shader_corpus_report.py-blocked_streams->blocked_streams(ascending)-instructions->instructions(ascending)_dppsuffix from_form_parts_sdwasuffix from_form_partscontinue->pass)stagessorted alphabetically instead of by stage orderform_instructions[form] += 1->= 1blocked_recordscounts streams instead of records< 0->< -1)boolinstruction count accepteddecoded_dwordsabove the stream's code dwords accepted (<= dwords-><= dwords + 1)ValueErrorpartialinstead offailedunknown_stage_kindsdecode.streamsreported without a decoderThe new cases use the existing five-record fixture: one pixel stream backing
three records, and one compute and one vertex stream backing one record each.
test_unsupported_forms_split_encoding_and_rankreturns unsupported text perstream: pixel
V_ADD_F32_DPP,v_mov_b32_sdwa,s_nopand a blank entry;compute
v_add_f32_dppand twov_cmp_eq_u32_e64; vertexv_mov_b32_sdwa.The expected rows are:
v_add_f32_dpp(familyv_add_f32,dpp), stages pixel then compute,2 streams, 3 + 1 = 4 records, 2 instructions. The upper-case pixel entry
merges with the compute one.
v_mov_b32_sdwa(sdwa), pixel and vertex, 2 streams, 4 records,2 instructions. It ties row 1 on streams and instructions and sorts after
it by name.
v_cmp_eq_u32_e64(e64), compute, 1 stream, 1 record, 2 instructions.s_nop(plain), pixel, 1 stream, 3 records, 1 instruction. It ties row3 on streams and sorts after it on instructions.
The blank entry produces no row. The test also checks the first Markdown row.
test_invalid_decoder_results_are_failuresreturnsDecodeResult(-1, 2)forpixel,
DecodeResult(1, 3)for compute (3 decoded dwords from a 2-dwordstream) and
DecodeResult(True, 2)for vertex. All three streams fail, thestatus is
failed, the first failures list pixel, vertex and compute instage order with the
ValueErrortext, and no decoded dwords orinstructions are added. A second callback raises
RuntimeErrorfor vertexonly and gives
partialwith oneRuntimeError: owned callback stopfailureand 2 + 2 = 4 instructions from the other two streams.
Verification
Based on
origin/mainat813045b3c1.Windows 11 Pro 26300.9974, Python 3.12.10.
Before this change the check printed
Ran 8 tests ... OK. For the negativecontrol, I ran the check at
origin/mainand the new check against eachmutant above and recorded the results in the table.
Evidence and follow-up
All inputs are synthetic bytes built in the check. No game files are used.
Two survivors are left for a separate change because they are about other
report fields than the decoder callback:
unknown_stage_kindsis never populated by the fixture. A case would need arecord whose stage kind is outside
STAGE_NAMES.decode.status == "not_run"but not thatdecode.streamsis 0 when no decoder is supplied.The tool is not changed.
Checklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:35:33Z.
Review: COMMENTED
Reviewed head
6ff393432310143e2ae6b71ee3c1c9b9631e97fein a clean Linux worktree.git diff --check origin/main...HEAD: clean (rc 0)python -B tests/bidi_controls_check.py: rc 0python -B tests/shader_corpus_report_check.py: rc 0Local mutations on
tools/shader_corpus_report.py(each restored withgit checkout -- .). The test failed (rc 1) when I:decoded_dwords <= dwordsboundinstructionscheck.lower()on the form nameblocked_recordswith the stream countOne mutation survived: swapping the first two ranking keys (instructions before blocked_streams). The fixture rows come out in the same order either way, so the test comment about ranking "by blocked streams, then instructions" is not fully enforced. This is a small coverage gap, not a defect. A row with more instructions but fewer blocked streams would close it.
The new asserts guard real logic: decoder result validation, form merging and encoding split, and ranking. Nothing cosmetic.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:31:12Z.
Review: COMMENTED
Review of head
6ff393432310143e2ae6b71ee3c1c9b9631e97fe(Linux, pure-Python test-only change, no Windows run needed).No P1, no P2. The new test
test_unsupported_forms_split_encoding_and_rankguards real logic in tools/shader_corpus_report.py: decoder result validation, form merging and encoding split, and the ranking.Commands run:
git diff --check origin/main...HEAD: rc=0python3 tests/docs_links_check.py: rc=0python3 tests/bidi_controls_check.py: rc=0python3 -B tests/shader_corpus_report_check.py: rc=0 (OK)Mutations on tools/shader_corpus_report.py, each restored with
git checkout -- .; the test must fail (rc=1) and did:instructionscheck dropped (line 174): rc=1-instructionsremoved (line 230): rc=1.lower()on the form name removed (line 77): rc=1Known small gap, as noted in the earlier review: swapping the first two ranking keys is not caught, because the fixture rows come out in the same order. Not a defect.
AI-assisted; commands listed were executed locally.