Repository navigation
startup: make gfx2hlsl --capture terminate on wrapper cycles and refuse short descs - #1528
Merged
R0Y00 merged 2 commits intoNov 24, 2026
Merged
Conversation
…se short descs The --capture reader followed path-55 wrapper bases with no visited set, so a wrapper whose base is itself (or a longer cycle) looped forever. A path-57 record with a desc shorter than 96 bytes raised struct.error. Both now print a one-line "pso <id>: ..." message and the reader moves on to the next call. tests/startup_gfx2hlsl_capture_check.py builds synthetic captures and runs the tool with a timeout: good path, self-reference, two-wrapper cycle, short desc, and the existing "code not captured" report.
…ure-wrapper-cycle # Conflicts: # .github/workflows/windows.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/main1ca0dec.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.