shader_disasm: list a wave64 program for wave64 (TOOLS-DISASM-WAVE-SIZE) #1282
Closed
leonida/mandy
Moriz82 wants to merge 0 commits from
split/tools-disasm-wave-size into main
pull from: split/tools-disasm-wave-size
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!1282
Loading…
Reference in a new issue
No description provided.
Delete branch "split/tools-disasm-wave-size"
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.
Rebased onto
bfef489catf6290b41. Main already sets the disassembler wave size. This diff adds coverage through FSPX unpacking, pipeline-library extraction and translation. The four focused suites passed 91 tests with one skip.Claimed in the coordination issue as: TOOLS-DISASM-WAVE-SIZE (claim).
Part of the split of #984 into small pull requests.
Depends on: none
Overlaps: #984 is the parent integration. #1021 (open, SHADER-W64-SDST-PAIR) repairs the same listings from the other side:
widen_wave64_masksintools/rdna2spirv.pyturns a single-register mask operand into the pair once a program is known to be wave64. The integration branch had that repair too (widen_wave64_valu_masks); it is the same change as #1021 and is not in this pull request. This one makes the disassembler write the pair in the first place, which #1021 does not touch (it says the listings "come from llvm-mc without+wavefrontsize64"). The two do not conflict and either order works: with both, a new listing already has the pairs and the repair finds nothing to widen; an old listing is repaired by #1021. #998 (open) addscompute=Trueto the same twodisasm.disasm(...)calls infspx_unpack.pyandshader_library.pyand a parameter todisasm(): a textual conflict on those lines, both keywords stay. Merged three-way with each open pull request that touches these files (its diff applied to the base, then merged into this branch): #623, #908, #861, #583 and #1021 merge cleanly; #998 conflicts on those two call lines and nowhere else. #957 and #281 also changetools/shader_disasm.py, but their diffs do not apply to this base, so they were not tried.What and why
llvm-mc lists the lane-mask operands of a VALU instruction for the wave size it is told, and wave32 is its default for the CPUs used here. For the same bytes (llvm-mc 23.1.5,
gfx1013):-mattr=-wavefrontsize32,+wavefrontsize64v_cmp_gt_u32_e64 s8, 40, v0v_cmp_gt_u32_e64 s[8:9], 40, v0v_cndmask_b32_e64 v5, 2, 3, s10v_cndmask_b32_e64 v5, 2, 3, s[10:11]v_add_co_ci_u32_e64 v5, s8, v5, 4, s10v_add_co_ci_u32_e64 v5, s[8:9], v5, 4, s[10:11]v_cmp_gt_u32_e32 vcc_lo, 48, v0v_cmp_gt_u32_e32 vcc, 48, v0The same holds for the SDWA compares,
v_cmp_class, the other carry instructions,v_div_scaleandv_mad_[ui]64_[ui]32. Nothing else differs: same instructions, same printed encodings.A wave64 program writes and reads both registers. The translator takes the listing at its word, so from the default listing the high register keeps its old value, and a later 64-bit scalar use of the pair (
s_mov_b64 exec, s[8:9],s_and_saveexec_b64, av_cndmaskon a pair thats_mov_b64wrote) gives lanes 32..63 the wrong bits.shader_disasm.disasm(code, mcpu, backend, wave32)already takes the wave size, andshader_disasm.pyalready reads it from the FSSM header, but only the Python decoder (--backend python) used it. The llvm-mc backend, the default, ignored it. Andfspx_unpack.py --disasmandshader_library.py --disasmdid not pass it, although both have the program's dispatch state (wave32in the index they write).This pull request:
-mattr=-wavefrontsize32,+wavefrontsize64to llvm-mc whenwave32is false; the command for a wave32 program is byte for byte what it was;fspx_unpack.py --disasmandshader_library.py --disasmpass the wave size of the dispatch state. A graphics program of the pipeline library has no dispatch state and keeps the default, as before;docs/design.md, "Disassembling shaders".What changes for a build. The FidelityFX, BVH and pipeline-library steps name
shader_disasm.pyamong their tools and are redone. The game's own shaders are disassembled again only whendisasm.doneno longer matches (it records llvm-mc, not the tool), so an existing work folder keeps its listings until that step is redone; both spellings are valid input for the translator. Bydocs/design.md23,841 of the 26,503 shaders are wave64, so a fresh disassembly lists those with pairs andvcc.Not measured: the corpus. No game shader was disassembled or translated for this pull request, so there are no before and after counts of translated and
spirv-val-clean shaders. What was measured is below, on hand-written programs. #1021 reports a full-corpus run of the equivalent translator-side change on its author's stack (26,503 translated before and after); that is its measurement, not one made here.Tested
Linux (CachyOS, kernel 7.3.5), Python 3.14, LLVM
llvm-mc23.1.5. One commit on6293c1c4f.python3 -I tests/test_shader_disasm.py: 32 tests pass (30 before, 2 new).test_llvm_mc_is_told_the_fssm_wave_sizeruns the tool on a synthetic FSSM blob with a stand-in for llvm-mc that prints the-mattroption it was started with: the option is there under a wave64 header and absent under a wave32 one.test_real_llvm_mc_names_the_mask_pair_of_a_wave64_programuses the real llvm-mc and is skipped without one that has the AMDGPU target: a hand-encodedv_cmp_gt_u32_e64is listed withs[8:9]under a wave64 header and withs8under a wave32 one.python3 -I tests/test_fspx_unpack.py: 35 tests pass, 1 skipped as on the base (1 new):fspx_unpack.py --disasmwith the stand-in, once with a wave64 and once with a wave32 dispatch state.python3 -I tests/test_shader_library.py: 22 tests pass (1 new):shader_library.py --disasmwith the stand-in on a synthetic library. The wave64 compute program gets the option; the wave32 compute program and the pixel program do not.python3 -I tests/semantic/test_disasm_wave64_mask_pair.py(new, 3 tests pass): a hand-written wave64 program of nine instructions, its words given in the file, goes throughshader_disasm.disasm(), the translator and the test interpreter on 64 lanes. One test takes the Python decoder's listing and needs nothing else; it passes on the base too and is the control. One takes llvm-mc's listing and is skipped without llvm-mc. One checks that the wave32 listing of the same bytes is what it was.6293c1c4f; the threetests/test_*.pyfiles of this branch beside itstools/, andLEONIDA_TOOLS_DIRfor the semantic file): 5 tests fail. The stand-in is started without the option intest_shader_disasm.py,test_fspx_unpack.pyandtest_shader_library.py(3), the real llvm-mc listss8(1), and intest_llvm_mc_listinglanes 33..39 store 7 instead of 9 and lane 52 stores 9 instead of 7: 56 of 64 lanes right, 64 of 64 with this change.ci.ymlruns it (compileall, everytests/test_*.pyoutsidetests/semantic, the semantic suite, the tracked-file guard), on the committed tree: one failing file,tests/test_imhex_patterns.py, which fails on the base commit too and is the only one there. Semantic suite: 471 files, 6,171 tests, 0 files failed (the base: 470 files, 6,168 tests; the difference is the new file).python3 -I scripts/check_no_game_data.py: passes.A sweep that is not part of the change (
llvm-mc23.1.5, the translator of the base): 24 hand-written wave64 compute programs, one or two per affected form and three with a 64-bit scalar use of the mask, each disassembled with the default and with the wave64 option, translated natively and with--wave64-emulate(48 pairs of translations) and run on 64 lanes where the test interpreter has the instructions.v_div_scale_f32programs are refused from both (4 of 48).s[8:9]followed bys_mov_b64 exec, s[8:9](lanes 33..39 and 52 wrong, withs9preset to 0x100001), the same withs_and_saveexec_b64, andv_cndmask_b32_e64on a pair written bys_mov_b64 s[8:9], 0xff(lanes 32..39 wrong). 19 give the same 64 words from both listings, and 3 the test interpreter cannot run (an instruction it lacks).Not run: the game's shader corpus and its FSPX and pipeline-library programs (see above), llvm-mc 21 (the option is the one
runtime/test/shaders/*.asmalready name in their; mattr:lines), a GPU, native Windows or macOS, the runtime build (no C++ or build file changes).GPUs tested: none (the disassembler command line, a CPU interpreter).
AI-assisted: yes (Claude Code). The numbers above come from runs on the machine named.
Checklist
6293c1c4f, one commit.docs/design.md, "Disassembling shaders".🤖 Generated with Claude Code
Reviewed f6290b4: runs of tests/test_fspx_unpack.py (35 OK), test_shader_library.py (23 OK), test_shader_disasm.py (31 OK), test_library_shaders_stage.py (17 OK) and the new tests/semantic/test_disasm_wave64_mask_pair.py (3 OK) on the PR tree, and the same five with the PR's test files copied into a main tree — identical results, so everything this PR adds passes on unmodified main (llvm-mc tests skip: no llvm-mc here). The change it describes — the wave64 -mattr pair in shader_disasm.disasm(), and fspx_unpack.py/shader_library.py passing the dispatch state's wave size — is already on main from #984 (273b3bdf9); the branch now carries no tool diff at all, only tests and docs, and its message narrates code not in it. I would close it as already on main and salvage the three tests plus the design.md paragraph under a tests/docs-only description. AI-assisted review.
Recommendation: Close