shaders: reject and retry truncated disassembly listings and name failing shaders (SHADERS-DISASM-TRUNCATED-CHECK) #2553
Closed
leonida/mandy
kirigayakazima wants to merge 0 commits from
fix/shaders-disasm-truncated-check into main
pull from: fix/shaders-disasm-truncated-check
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2553
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/shaders-disasm-truncated-check"
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 closed
This pull request cannot be reopened because the branch was deleted.
SHADERS-DISASM-TRUNCATED-CHECK. Claim. Fixes #2539.
In #2539, an
llvm-mcrun left a.sdisassembly listing truncated mid-line befores_endpgm, yettools/shader_disasm.pystill published it,--skip-existingandmake_game.py(disassembly_listings) accepted any non-empty file, andtools/rdna2spirv.pyonly printed failure counts without naming which shaders hitbranch without encodingor other refusal reasons.This removes the root causes rather than adding a manual workaround:
tools/shader_stage_manifest.py: add sharedlisting_is_complete()and fast tail-checkinglisting_file_is_complete()(requiring trailing newline, a complete non-comment endings_endpgm, and a closed; encoding: [...]when encoding comments are present, while ignoring optional trailing; --- llvm-mc messages ---footers).tools/shader_disasm.py: retry truncatedllvm-mcdisassemblies (up to 3 total attempts) before refusing to publish partial.sfiles (FAILEDguarded byFAILED_LOCK), and reject incomplete existing.slistings under--skip-existing.make_game.py: havedisassembly_listings()validate completeness vialisting_file_is_complete()so truncated listings invalidate reuse and get repaired automatically on--skip-existing.tools/rdna2spirv.py: record up to 5 failing shader stems per failure/refusal reason (Unsupported, translator errors,INVALID:) and print them alongside counts in the shard/run summary.tests/: add 6 targeted regression tests acrosstest_shader_disasm.py,test_shader_stage_resume.py, andtest_rdna2spirv_cli.py, and update the 7 test suites whose placeholder.sfixtures wrote plain text instead of a valids_endpgmlisting.Verification on Windows 11 (RTX 4070 Laptop host; stdlib/synthetic tests only, no game files or GPU execution tested):
python -I tests/test_shader_disasm.py: 35 tests OKpython -I tests/test_shader_stage_resume.py: 48 tests OKpython -I tests/test_rdna2spirv_cli.py: 37 tests OK (1 skipped without SPIRV-Tools)python -I tests/test_make_game_dry_run.py: 24 tests OKpython -I tests/test_make_game_empty_translation.py: 14 tests OKpython -I tests/test_make_game_resume.py: 14 tests OKpython -I tests/test_make_game_translator_flags.py: 34 tests OKpython -I tests/test_text_write_line_endings.py: 3 tests OKpython -I tests/test_make_game_preflight.py: 108/109 passed (test_preflight_charges_space_only_when_shaders_need_to_be_rebuiltpassed; only pre-existing repo-rename failuretest_ensure_submodule_names_the_clone_command_the_readme_givesfailed on1a441d336)python -m compileall -q,python -I make_game.py --help, andpython -I scripts/check_no_game_data.pyover all 12 modified files passed.AI-assisted: Antigravity (Gemini).
#2553 | head aee75f002ef33fc9daeb526348da19e1e128b3ac (merged cleanly with main 02f71ccfe) |
python -I tests/test_rdna2spirv_cli.py && python -I tests/test_shader_disasm.py && python -I tests/test_shader_stage_resume.py| red on main: rdna2spirv_cli FAILED (failures=1, skipped=2) in 37 tests; shader_disasm FAILED (failures=3, errors=1 importing newlisting_is_complete) in 35 tests; shader_stage_resume FAILED (failures=1) in 48 tests | green on PR+main: rdna2spirv_cli 37 tests OK (skipped=2); shader_disasm 35 tests OK; shader_stage_resume 48 tests OK | Windows 11, Python 3.12.10 | AI-assisted: yesDiff reviewed across all 12 touched files (
FAILED_LOCKguards concurrent failure recording, tail check handles trailing; --- llvm-mc messages ---footers, and--skip-existingrepairs truncated.sfiles). Also verified on mergedPR+main:test_make_game_dry_run.py(24/24 OK),test_make_game_empty_translation.py(14/14 OK),test_make_game_resume.py(14/14 OK),test_make_game_translator_flags.py(34/34 OK),test_make_game_preflight.py(same single pre-existing clone-URL failure as plainmain, 108/109 pass, skipped=2),test_runner_calls_all_tests.py(3/3 OK),test_text_write_line_endings.py(3/3 OK),compileall,git diff --check, andscripts/check_no_game_data.py(clean).Reviewed the diff and tested merged onto
main(493867366).The shared
listing_is_complete/listing_file_is_completetail check,TRUNCATED_RETRY_ATTEMPTSretry loop withFAILED_LOCK,--skip-existingrepair path, and per-reason failing-shader stem summaries intools/rdna2spirv.pycleanly address #2539.Tests run
python -m unittestacrosstest_shader_disasm.py,test_shader_stage_resume.py,test_rdna2spirv_cli.py,test_make_game_dry_run.py,test_make_game_empty_translation.py,test_make_game_resume.py, andtest_make_game_translator_flags.py: 205 passed (1 skipped, 0 failures).AI-assisted (Antigravity, Gemini).
Re-checked on
mainc8bf0e7b6(headaee75f002unchanged): Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean. I ran only the tests, not the shader stage.test_shader_disasm.py(38),test_rdna2spirv_cli.py(37),test_shader_stage_resume.py(48),test_make_game_dry_run.py,test_make_game_empty_translation.py,test_make_game_resume.pyandtest_make_game_translator_flags.py.test_make_game_preflight.py: not run here (it starts bash).make_game.py,tools/rdna2spirv.py,tools/shader_disasm.pyandtools/shader_stage_manifest.pyback tomain, the same three files fail as before:test_rdna2spirv_cli.py:branch without encoding (ps_branch_no_enc)is not reported.test_shader_disasm.py: 3 failures and 1 error ('reused': 1).test_shader_stage_resume.py:test_finished_disassembly_repairs_a_truncated_listingfails.main, the 7 files pass. The PR adds 6 tests (34 to 38, 36 to 37, 47 to 48).No blocker from my side. AI-assisted (Claude Code).
Tested
aee75f002merged (no commit) withmainaa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.I ran only the tests, not the shader stage.
test_make_game_preflight.py. Its one failure,test_ensure_submodule_names_the_clone_command_the_readme_gives, fails the same way on plainmain, so it is unrelated.make_game.py,tools/rdna2spirv.py,tools/shader_disasm.pyandtools/shader_stage_manifest.pyback tomain, three files fail:test_rdna2spirv_cli.py:branch without encoding (ps_branch_no_enc)is not reported.test_shader_disasm.py: 3 failures and 1 error ('reused': 1).test_shader_stage_resume.py: 1 failure.No blocker from my side.
AI-assisted (Claude Code).
Retested
aee75f002ef33fc9daeb526348da19e1e128b3acmerged withmainc8bf0e7b65on Windows 10/CPython 3.12.1. The 38 stock disassembler tests passed. Two new synthetic probes confirm the later review findings:one()a hand-built 16-byte range containing twonop; endpgmprograms and stubbed the decoder to return only the first 8 bytes' listing. The result wasclean, it was published on the first attempt, andlisting_file_is_complete()accepted it for reuse.The first probe checks coverage of the selected byte range. The second checks the retry policy with a transient failure. They use no game files.
AI-assisted. Codex (GPT-6).
Verification of this one on current
main, since it is 1780 commits behind and nobody has said whether it still applies.I cherry-picked its single commit onto
origin/main4364a4fa6:So the change applies to today's tree and the tests written for it hold, including
make_game.pyandtools/rdna2spirv.py, whichmainhas moved on since thebranch was cut. It still wants a rebase before merging - 1780 commits is a lot of drift in the diff a reviewer would see - but the content itself is not stale.
Not verified: any behaviour that needs the game. Everything above is the standard-library side, which is what these eight files cover.
Written with an AI assistant.
Independent check on Windows (not the author), at
aee75f002.Green:
tests/test_shader_disasm.py: 35 passedtests/test_make_game_resume.py: 14 passedtests/test_shader_stage_resume.py: 48 passedtests/test_make_game_empty_translation.py: 14 passedOne failure, and it is a stale base, not this PR's logic:
tests/test_make_game_preflight.py: 109 passed, 1 failed — the test still expectsgit clone --recursive https://github.com/ubiquitarianism/leonida, while the branch's README (and currentmain) sayhttps://github.com/ProjectLeonida/mandy.mainb17b22d33has the updated expectation and passes 110 tests, OK.So merging/rebase on current
mainshould clear it; the branch is based onf9f3ec4c6, where the expectation had not yet been renamed.Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10.
AI-assisted: yes (opencode).
Merged
upstream/main(3ee508b46) atefe1a42ea(no rebase, no force-push) and addressed all five review findings at594469b99:tools/shader_stage_manifest.py,tools/shader_disasm.py):listing_is_completenow parses; code 0x..<end>, ..., N invalid words(or uses explicitexpected_bytesandinvalid_words) and verifiessum(encoded_instruction_bytes) + invalid_words * 4 == expected_bytesacross all instructions in the code section. A truncated prefix ending on an earliers_endpgmin a multi-program range is rejected during bothone()andlisting_file_is_complete().s_endpgm(tools/shader_stage_manifest.py): Because completeness now validates full byte coverage independently of a trailings_endpgmmnemonic line when the byte range is known, a complete Python-backend decode whose final instruction consumes0xbf810000as a literal is accepted and reused..sfiles during resume (make_game.py): Added_disassembly_inventory(dxbc)returning(observed, complete)stems.disassembly_statusnow validatesobserved <= activeandobserved <= expected <= activebefore reusing or preserving files, andshaders()verifiesobserved == listingsaftershader_disasm.py, so unexpected truncated.sfiles cannot be hidden whiletranslate()still scans the folder.llvm-mcandautomodes (tools/shader_disasm.py):one()now runs the same boundedTRUNCATED_RETRY_ATTEMPTSloop for bothllvm-mcandautowhen the initial response is non-empty, and keeps retrying through intermediate empty responses up to the final attempt.tools/shader_disasm.py): Publication now usesreplace_retry(tools/replace_retry.py), and temp.tmpcleanup usesreplacedtracking with atry/except OSError: passunlink so transient Windows sharing violations retry and cleanup errors cannot mask the original exception.Thanks @timbot103 for the thorough static audit, @lixonik for both synthetic probes (both cases now have dedicated regression tests in
tests/test_shader_disasm.py), and @fiestorra / @KelboLive for checking againstmain(mergingmainalso resolves the stale clone-URL test intests/test_make_game_preflight.py).Verification (Windows 11, Python 3.12, no game data)
python -I tests/test_shader_disasm.py: 44 tests OKpython -I tests/test_shader_stage_resume.py: 49 tests OK (includingTranslationSourcesTest)python -I tests/test_rdna2spirv_cli.py: 37 tests OK (skipped=1)python -I tests/test_make_game_dry_run.py: 25 tests OKpython -I tests/test_make_game_empty_translation.py: 20 tests OK (skipped=1)python -I tests/test_make_game_resume.py: 14 tests OKpython -I tests/test_make_game_translator_flags.py: 42 tests OKpython -I tests/test_make_game_preflight.py: 110 tests OK (skipped=1)python -I tests/test_text_write_line_endings.py: 3 tests OKpython -I scripts/check_no_game_data.py&git diff --check upstream/main...HEAD: clean (exit 0)AI-assisted.
Updated the
fake_mc.pytest stubs intests/test_bvh_shaders_stage.pyandtests/test_exe_shaders_stage.py(494a4384f7) to echo encoded instruction bytes (; encoding: [...]) per input dword instead of bare\ts_endpgm, soshader_disasm.py's byte-range coverage check accepts them cleanly.Verified locally (Windows 11, Python 3.14, no game data):
python -m unittest tests.test_bvh_shaders_stage: 13 OKpython -m unittest tests.test_exe_shaders_stage: 11 OKpython -m unittest tests.test_fspx_shaders_stage: 24 OKpython -m unittest tests.test_library_shaders_stage: 17 OK (1 skipped)python -m unittest tests.test_shader_disasm: 44 OKpython -m unittest tests.test_text_write_line_endings: 3 OKpython -I scripts/check_no_game_data.pyandgit diff --check: cleanAI-assisted: yes
Real LLVM resume check for a truncated two-stage listing at
494a4384f+c95183fd8, using LLVM 23.1.5 on Linux. I preseeded a synthetic listing whose header declared 16 bytes but contained only the first two encoded instructions. With--backend llvm-mc --skip-existing, main reportedreusedand left two instructions. The PR reportedcleanand rewrote all four. I also ran ten affected Python suites against that tree. 364 tests passed and two skipped.AI-assisted with OpenAI Codex.
I tested a local resolution of the publication-path conflict between 494a4384 and main 88a9f133e. The conflict is in tools/shader_disasm.py, after the temporary listing has been written. The local merge keeps main’s destination mode calculation and writable-temp cleanup, and retains the PR’s replace_retry. Best-effort cleanup preserves the original replacement exception if the temporary file cannot be removed.
Ten affected suites passed with this resolution: 263 tests and 153 subtests passed, with one skip. This includes the existing mode-restoration-on-failure and transient replacement retry checks, along with truncated-listing repair and the affected stage suites. The merge resolution here is a local test, and the published branch still has the conflict. MEASURED on Linux using synthetic fixtures. AI-assisted (Codex).
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.