startup: make gfx2hlsl --capture terminate on wrapper cycles and refuse short descs #1521
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1528"
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 RenzoWit35 on 2026-11-24T13:43:07Z.
Change
The
--capturebranch oftools/startup/gfx2hlsl.pyreads pipeline records from a capture file and writes one translation request per pipeline. Two malformed records made it fail in ways that lose the rest of the run:while p and p['path'] == 55 and p['base']. A wrapper whose base is itself, or a longer cycle of wrappers, never terminated.struct.erroratstruct.unpack_from('<12Q', p['desc'], 0).The chain walk now keeps a visited set and prints
pso <id>: wrapper chain loops back to <id>. A short desc printspso <id>: pipeline desc is <n> bytes, need 96. In both cases the reader moves on to the next record, in the style of the existingcode not capturedline. 9 added lines;parse_root, the--pendinghandling and the ALU lowering are untouched.No test exercised
--capturebefore (no match intests/,CMakeLists.txtor the docs). Newtests/startup_gfx2hlsl_capture_check.pybuilds synthetic capture files with thechunkandmemhelpers oftests/startup_capture_check.pyand runs the tool in a subprocess with a timeout. It is registered as CTeststartup_gfx2hlsl_capture, in thepython-linuxjob and in the AGENTS.md list.Verification
Windows 11, Python 3.14.5, base
origin/main1ca0dec1.Negative control, with
tools/startup/gfx2hlsl.pyfrommainand the new check:The check stops there. With the cycle cases disabled, the short-desc case on
mainends in a traceback withstruct.error(buffer of 40 bytes).Also run on this branch, all exit 0:
tests/startup_capture_check.py,tests/startup_translator_check.py,tests/startup_gfx2hlsl_sdwa_check.py,tests/startup_gfx2hlsl_bit_alu_check.py.Not run: the CTest registration through
ctest(theadd_testmirrors the neighbouringstartup_captureentry), the new check on Linux (this PR'spython-linuxjob is the first Linux run), and GPU tests.Evidence and follow-up
Inputs are synthetic records built in the test; no captured data from an executable. My open PR #1526 changes
parse_rootin the same file and adds a line to the same two lists a few lines further down; the two merge cleanly in either order (checked withgit merge-tree). Open PR #1471 edits other parts ofgfx2hlsl.py.AI-assisted.