tooling: disasm_rdna2 misspells or leaves unnamed several gfx1013 instructions, so the shader scan misreports them #931
Closed
opened 2026-11-23 17:57:32 +00:00 by MasterDomino
·
23 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
R0Y00/Xbox2Windows#931
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 MasterDomino on 2026-11-23T17:57:32Z.
Problem
tools/disasm_rdna2.pyprints several gfx1013 instructions differently from LLVM 15 or leaves them unnamed, and it stops decoding at the firsts_endpgm.tools/scan_unsupported_shaders.pydecodes binaries with it and then checks the lines withpixel_aot.lower(), whose patterns follow LLVM's spelling. So the scan reports instructions the translator does accept as unsupported, and it undercounts the others.Reproduction with a source-built input only, at
a8a88e1. Assemble with LLVM 15.0.7 (llvm-mc -arch=amdgcn -mcpu=gfx1013 -filetype=obj, thenllvm-objcopy -O binary --only-section=.text):Then decode the 60 bytes with
disasm_rdna2.disasm_rdna2(data)and withpixel_aot.disassemble(data, libLLVM-15.so):disasm_rdna2s_setreg_imm32_b32 0x881, 0x3s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3s_setreg_imm32_b32 0xf814, 0x0s_setreg_imm32_b32 hwreg(HW_REG_FLAT_SCR_LO), 0v_vop3_342 v1, s0, v2, s0v_interp_p1ll_f16 v1, v2, attr0.xv_vop3_35a v1, s0, v2, v3v_interp_p2_f16 v1, v2, attr0.x, v3v_cmp_gt_u32_e32 <unsupported SDWA>v_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORDimage_mimg_17 v1, v2, s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_1D glcimage_atomic_umax v1, v2, s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_1D glcv_vop2_28 v1, v2, v3v_add_co_ci_u32_e32 v1, vcc_lo, v2, v3, vcc_los_endpgms_endpgmv_mov_b32_e32 v1, v2Effect on the translator check.
pixel_aot.lower()acceptss_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3ands_setreg_imm32_b32 hwreg(HW_REG_FLAT_SCR_LO), 0, both handled since the MODE rounding and FLAT_SCRATCH work. It rejects the decoder's spellingss_setreg_imm32_b32 0x881, 0x3ands_setreg_imm32_b32 0xf814, 0x0withUnsupported instruction. Checked by inserting each line at the start of thetests/pixel_aot_check.pyassembly(False)program and callingtranslate().Size on one local input, the 12,101 PS records counted in #711 and #932. Only aggregates. A scan with
tools/scan_unsupported_shaders.pyreportsUnsupported instruction: s_setreg_imm32_b32as the first rejection in 2,249 records. Alls_setregin that input are the MODE[3:2] and FLAT_SCR_LO/HI forms above, which the translator handles in LLVM spelling. On a random sample of 300 records decoded over the same byte ranges, the mnemonic sequences differ from LLVM 15 in 132. The most frequent differences are thev_interp_p1ll_f16/v_interp_p2_f16pair (1,151 each), SDWA compares printed as_e32,image_atomic_umaxandv_add_co_ci_u32_e32.#745 and #746 fixed other spellings in the same decoder. This is the same class of problem.
Proposal
Make the decoder's output match LLVM 15 for these cases, one reviewable step at a time:
hwreg(...)operand ofs_setreg_imm32_b32in LLVM's symbolic form, and checks_setreg_b32/s_getreg_b32, which I didn't test.v_interp_p1ll_f16andv_interp_p2_f16with LLVM's operand syntax, and checkv_interp_p1lv_f16, which I didn't test.v_add_co_ci_u32_e32with its implicitvcc_looperands, nameimage_atomic_umax, and decode SDWA VOPC. The neighbouring carry and atomic forms are likely affected too, but I didn't test them.s_endpgm, or whether the scanner should use the_bounded_codesection bounds thatpixel_aotuses.Each step gets a fixture in
tests/rdna2_tools_check.pythat comparesdisasm_rdna2with the LLVM 15 comparison test it already has (LLVM_LIB). I could take step 1 first, since it changes the scan result the most.Alternatives
pixel_aot.disassemble) when--llvmis given, and keep the Python decoder as a fallback. This fixes the scan without touching the decoder. The decoder would still be wrong for other users, though.Verification
tests/rdna2_tools_check.pywithLLVM_LIB,LLVM_MCandLLVM_OBJCOPYset. A new case assembles the program above and requires identical text from both decoders. The negative control is that the current decoder fails it. This runs on Linux; no Windows or GPU is needed.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T18:22:28Z.
A focused first PR for symbolic HWREG spelling would be useful. Preserve the numeric fallback for unknown operands and the existing s_endpgm behavior. Please use LLVM 15 round-trips that distinguish the register, offset, and width, and include a source-built scan case that fails with the old spelling. Bounded decoding and changes to instruction boundaries can be reviewed separately.
Imported from R0Y00/Xbox2Windows. Originally posted by Batushn on 2026-11-23T18:33:54Z.
Claiming step 1 (symbolic
hwreg(...)spelling intools/disasm_rdna2.pyfors_setreg_imm32_b32,s_setreg_b32, ands_getreg_b32, preserving numeric fallback for unknown/non-gfx1013 register IDs and existings_endpgmbehavior, plus LLVM 15 round-trips and a source-built binary scan test intests/rdna2_tools_check.py). Developing on Windows 11, Python 3.12.10; LLVM 15 round-trips will be exercised by the Ubuntu CI job.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T18:44:47Z.
#951 and #956 implement the same HWREG formatter and SOPK decode. I have independently checked #951 against LLVM 15.0.7, including all 64 hardware-register IDs, and will use it as the first merge candidate. @Batushn, thanks for the independent encoding and stream-boundary tests. Please retain the useful differences for a small follow-up after #951, especially any truncated second-dword or end-of-program boundary control not already covered. If you keep the scanner's known-opcode update, please show that recognition remains separate from translation support for s_getreg_b32 and s_setreg_b32.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T19:06:21Z.
Taking step 2 now, scoped to the 16-bit interpolation names only:
disasm_rdna2decodesv_interp_p1ll_f16,v_interp_p1lv_f16andv_interp_p2_f16(VOP3 opcodes 0x342, 0x343 and 0x35a) as LLVM 15 prints them, with LLVM 15 round trips and a source-built scan case. This leaves alone the instruction-boundary ands_endpgmfollow-up from #951/#956, and the SDWA VOPC,image_atomic_*andv_add_co_ci_u32names (step 3).AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T19:16:01Z.
Step 2 is up as #970:
v_interp_p1ll_f16,v_interp_p1lv_f16andv_interp_p2_f16decode as LLVM 15 prints them. Encodings LLVM 15 refuses are reported as unsupported. It includes LLVM 15 round trips that differ in one field per line and a source-built scan case that fails with the oldv_vop3_342spelling. A local sweep of 77,920 encodings againstLLVMDisasmInstructionfound no differences. It doesn't touch the boundary work in #956.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T19:38:49Z.
Taking step 3 now, as three small PRs in this order so each stays reviewable:
v_add_co_ci_u32_e32,v_sub_co_ci_u32_e32andv_subrev_co_ci_u32_e32(todayv_vop2_28/29/2awithout the implicitvcc_looperands).image_atomic_*, 16 forms indocs/coverage/gfx1013.tsv; todayimage_mimg_NN).<unsupported SDWA>).Each will come with an LLVM 15 sweep, round trips and a source-built scan case, as for #951 and #970. Step 4 (decoding past
s_endpgm) is not included.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Batushn on 2026-11-23T19:42:05Z.
Heads-up to avoid duplicate work on step 3: #977 (VOP2 carry-in ops \_add_co_ci_u32_e32\ / \_sub_co_ci_u32_e32\ / \subrev_co_ci_u32_e32\ plus all 16 GFX10 MIMG \image_atomic*\ ops, conflict against #970 resolved) and #980 (all 124 GFX10 VOPC/VOPCX SDWA forms, LLVM 15 round-trip CI green) are both open with LLVM 15 round-trip and binary scanner tests. Step 4 (decoding past \s_endpgm) is untouched.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:45:20Z.
#977 and #980 already cover the three step-3 decode slices and are in review. @MasterDomino, please hold off on duplicate implementations. An independent LLVM 15 sweep of those candidates is useful, especially for rejected modifier and source encodings, the record length after a refusal, and recognized-versus-translated classification. Please attach any deltas to the relevant PR. The post-
s_endpgmboundary work is separate.Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T19:51:02Z.
Understood, holding off. My step-3 claim overlapped #977, which was already open; that's on me for not checking open PRs first. Sorry, @Batushn.
To avoid more parallel work on this decoder, I suggest one person owns what's left of #938 (step 4 and any further spelling fixes), and the other stays out of
disasm_rdna2.pyunless asked. @R0Y00, your call on who. Batushn already has #977 and #980 in review, so they're the obvious choice, and I'm happy to step back to review.If it helps meanwhile, I can run the independent LLVM 15 sweep you described against #977 and #980 (refused modifier and source encodings, record length after a refusal, recognized versus translated classification) and attach any deltas to those PRs.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:01:42Z.
Thanks for coordinating. #977 has landed. Please run the independent LLVM 15 sweep of #980, with refused encodings, next-record offsets, and scanner classifications as discussed. @Batushn can pick up the post-
s_endpgmboundary slice if interested. Please align on that slice here before starting it.Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:17:29Z.
Running the independent LLVM 15 sweep of #980 now that it has merged: refused modifier and source encodings, next-record offsets after a refusal, and recognized-versus-translated scanner classification. I will post any deltas here. Not touching the post-
s_endpgmslice.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:36:33Z.
Independent LLVM 15 sweep of the #980 VOPC/VOPCX SDWA decoder. This was a measurement only. I did not change
tools/disasm_rdna2.py.Setup
Commit:
ca52bbc1c01687c11ee9796e853249c6541ff43f(upstreammain, which contains the #980 mergeb92dc80).Reference: the Windows release build of LLVM 15.0.7,
C:\Program Files\LLVM\bin\LLVM-C.dll, called throughpixel_aot.disassemblewith tripleamdgcn--amdpal, CPUgfx1013and no features (LLVM's wave32 default).Environment: Windows 11, Python 3.13.1.
Encodings: every record is built from the VOP_SDWA9Be field layout. No bytes are written by hand. The sweep covers all 256 VOPC opcodes, crossed with:
sdstvalue withsdset and withsdclear;That gives 869,888 distinct 8-byte records. Each record is followed by
v_mov_b32_e32 v3, v4ands_endpgm(0403067e000081bf, checked against LLVM) so the next-record offset can be checked.Command (from a checkout at that commit):
python -B out/reports/938-sweep/sweep_980.py --repo . --llvm-lib "C:\Program Files\LLVM\bin\LLVM-C.dll". It takes 82 s with 8 worker processes.Results
disasm_rdna2docs/coverage/gfx1013.tsv.sdset;vopc_truncated(4 bytes) and the leftover bytes as data. No deltas.Deltas
All 33,135 delta records come from one of three causes.
Scalar source codes 209 to 234. LLVM refuses these records and the decoder prints
s209tos234. This affects 20,129 records across all 124 opcodes: 10,171 on src0, 9,954 on src1 and 4 on both. For example, LLVM refusesf904007cd1008606but the decoder printsv_cmp_f_f32_sdwa vcc_lo, s209, v2 src0_sel:DWORD src1_sel:DWORD. The SDWA scalar-operand check refuses only 249, 250 and 255, anddecode_s_regfalls back tos{n}for 209 to 234.neg without abs on an inline constant. This affects 12,131 records across 68 float compare mnemonics, including
v_cmp[x]_class_*. LLVM printsneg(c). The decoder prints-c, or--cwhen the constant is negative (2,703 records).f924027c81009606, LLVM printsv_cmp_lt_f32_sdwa vcc_lo, neg(1), v18 src0_sel:DWORD src1_sel:DWORD, which is operand 0x80000001. The decoder prints... -1, v18 .... That is the same text LLVM prints forf924027cc1008606, which encodes the inline constant -1 (operand 0xffffffff). Reassembling also shows the modifier is lost:llvm-mcturns LLVM'sneg(0)text forf904007c80009606back into those bytes, but turns the decoder's-0text intof904007c80008606, without the neg bit.neg(0.5)against-0.5, andneg(-0.5)against--0.5.Float inline constants (codes 240 to 248) on the 24
v_cmp[x]_{eq,ne,lt,le,gt,ge}_{i16,u16}_sdwaforms. This affects 875 records. LLVM prints the f16 bit pattern and the decoder prints the float. Forf904127df0008606, LLVM printsv_cmp_lt_i16_sdwa vcc_lo, 0x3800, v2 ...and the decoder prints... 0.5, v2 .... A round trip does not settle which spelling is right. LLVM 15.0.7llvm-mc(-triple=amdgcn--amdpal -mcpu=gfx1013 -mattr=+wavefrontsize32) rejects both texts withinvalid operand for instructionon all 875 records, so LLVM's own disassembly of these encodings does not reassemble either. I am reporting this as a spelling difference whose meaning is unconfirmed, not as a wrong value.Scanner classification
These checks use
scan_unsupported_shaders.pywith the decoder's text as input.s44and src1 =v18, with 5 to 8 variants per opcode, giving 812 encodings that both decoders decode the same way. For all 812, the per-lineis_instruction_supportedverdict matchespixel_aot.lowerrun on a known-good program (with_constants,constant_descriptor=64). 96 are supported and lowered (the 16v_cmp_*_f32_sdwaforms with DWORD selectors). The other 716 are neither.s209tos234pass the per-line check.lowerrejects all of them (KeyError), so only the per-line supported count is affected.loweraccepts. Forf924027c81009606,lowertherefore accepts an operand of -1 where the encoding means neg(1). LLVM'sneg(c)spelling passes the per-line regex, butlowerrejects it.v_cmp_f_f32_e32 <unsupported SDWA>.is_opcode_recognizedaccepts these through itsv_cmp_prefix rule. A shader that contains one is classifiedopcode_recognized_translator_rejected, the same as a valid SDWA compare that is not translated. Of the 636,510 refused records, 412,242 are recognized this way. The other 224,268 are unrecognized: these are opcodes without aVOPC_OPSentry, printed asv_vopc_NN <unsupported SDWA>. #980 did not change this behaviour. I note it because the issue asks about recognized versus translated.Negative controls
Each control patches the decoder in memory and compares it against the same LLVM results. The decoder is restored and re-checked afterwards.
VOPC_OPS[0x01]tov_cmp_le_f32_e32gives 2,081 new text deltas, all on opcode 0x01. That is every LLVM-decoded 0x01 record that had no delta before.SDWA_SEL_NAMESgives 4,569 new deltas, all on records with a WORD selector. That is every such record that had no delta before.Limits
LLVMDisasmInstruction. The #980 test notes thatprintSDWASelreachesllvm_unreachable. There is no reference text for these 372 records. The decoder refuses all 768 selector-7 records.vcc, SGPR pairs) were not.lower's verdict, not that the generated HLSL is correct.out/is gitignored). I can share it if that is useful.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:36:39Z.
@Batushn, are you taking the post-
s_endpgmboundary slice? If not, I would like to pick up what is left of #938, in focused PRs:lowersees. SDWA scalar source codes 209 to 234 should be refused, as LLVM 15 refuses them. neg without abs on an inline constant should be printed asneg(c), solowerrejects the encoding instead of reading it as a different constant. Each gets an LLVM 15 round-trip test and a negative control.s_endpgmboundary slice, scoped here before I start it.The i16/u16 float-constant spelling (delta 3) stays as it is until something settles it, since LLVM 15 does not reassemble either form.
As @R0Y00 asked above, I will not start until one of you confirms here.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:43:21Z.
Please take the two SDWA decoder deltas from the sweep first, as focused changes. Keep a synthetic accepted record and a refused record followed by a known 4-byte instruction, so the test measures both the classification and the next offset. Preserve neg on an inline constant explicitly so the lowerer can reject that encoding. Label the 209–234 refusal as the supported LLVM 15 decoder subset unless there is independent ISA evidence. The LLVM-specific i16/u16 spelling can stay unchanged.
Batushn has not claimed the post-s_endpgm slice in this thread. You can take it separately after the decoder fixes. Keep discovery of later records separate from whether the translator accepts a multi-exit program. Include a closed one-exit shader and a case with real instructions or padding after the first marker.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:47:32Z.
Taking the two SDWA decoder deltas now as two focused PRs: refusing SDWA scalar source codes 209 to 234 (labelled as the supported LLVM 15 decoder subset), and printing
neg(c)for neg without abs on an inline constant. Each test has a synthetic accepted record and a refused record followed by a known 4-byte instruction. The post-s_endpgmslice comes after those, separately. I will link the PRs here.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T22:09:53Z.
The two SDWA decoder fixes are up: #1028 (scalar codes 209 to 234 refused as the supported LLVM 15 subset) and #1029 (
neg(c)on inline constants).Below is the scope for the post-
s_endpgmslice (step 4), as asked above, before I start it. I will not begin coding it until #1028 and #1029 settle, since all three touchtools/disasm_rdna2.py.Measured on one local input (12,101 PS records, the same population as #711), aggregates only:
tools/extract_shaders.pywrites (from the code start to the last aligneds_endpgmword) is identical topixel_aot._bounded_code, the FSSM v0x101 section extent minuss_code_endpadding.s_endpgm: 5,465 have two exits and 623 have three or more. The other 5,912 have one exit as their last instruction. LLVM refuses to decode 101 records, which is unrelated.disasm_rdna2stops at the firsts_endpgmin all 6,088 of these records, so the scanner never sees that code.Proposed change, decoder only. Discovery is kept separate from translator acceptance, as asked:
disasm_rdna2keeps decoding to the end of the buffer it is given instead of breaking at the firsts_endpgm. It reports each later record with the same offsets and lengths as LLVM 15.pixel_aot.lowerstill refusesInstruction follows program end, andcontainer_codekeeps its verified two-exit rule. The scanner simply counts and classifies every decoded record. Its per-record verdict stays whateverlowersays.tests/rdna2_tools_check.py, each also compared with LLVM 15 text and next offsets whenLLVM_LIBis set:s_endpgmfollowed byv_mov_b32_e32 v1, v2, plus a two-exit program with a branch over the first exit;s_code_endwords, and the zero words the current code comment mentions;main.One question: zero words after the last
s_endpgm. LLVM 15 (llvm-mc --disassemble, gfx1013) decodess_code_endass_code_end, but treats a0x00000000word as an invalid encoding. The current decoder comment expects "4 trailing zero padding bytes after endpgm". Should such a zero tail after the final exit be refused as LLVM refuses it, as a 4-byte unknown record, or reported as padding? My default is to match LLVM, so the zero tail becomes a refused record and an unbounded buffer is visible as such. Stripping stays with callers, as_bounded_codealready does fors_code_end. The extractor's.binfiles end at the lasts_endpgm, so this case does not occur in the input measured above.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:44:34Z.
#1028 and #1029 are both on main, so the decoder-only follow-up can start. In a caller-supplied span, keep a zero word after the final exit as a four-byte refused/unknown record if LLVM 15 refuses that exact encoding. Only a caller with an established format boundary should drop it as padding. Keep s_code_end visible as a decoded record. Please preserve offsets for a branch past the first exit and a refused word, and verify that the scanner counts later decoded records while translator acceptance remains unchanged. The aggregate local count is useful context; keep the committed regressions synthetic.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T23:55:37Z.
#1055 now implements the decoder-only continuation after s_endpgm. I ran the full 97-test rdna2_tools_check suite with LLVM 15.0.7 on
edb4eb2, including the source-built branch and trailing-word case. It preserves later offsets, recognizes s_code_end at the GFX10 encoding and leaves the lowerer refusing the extra executable records. @MasterDomino, please carry forward any independent coverage from your earlier claim in that PR so there is one decoder change.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:04:39Z.
Claiming two more slices of this issue, decoding only in tools/disasm_rdna2.py: the SMEM ops (s_buffer_store_dword*, s_gl1_inv, s_dcache_inv/wb, s_memtime/realtime, s_atc_probe*) and the f16 VOP1/VOP2 opcodes. The SOPK/SOPP slice is already open as #1092. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:13:33Z.
Claiming the s_movrel* SOP1 slice (5 ops) in tools/disasm_rdna2.py, decoding only. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:00:22Z.
Claiming the VOP3 and MUBUF slice, decoding only, in tools/disasm_rdna2.py and tools/scan_unsupported_shaders.py: VOP3 opcodes 0x16b (v_mul_lo_i32), 0x172 (v_qsad_pk_u16_u8), 0x173 (v_mqsad_pk_u16_u8) and 0x202 (v_interp_mov_f32_e64), and MUBUF opcodes 0x26 and 0x27 (buffer_load_format_d16_hi_x, buffer_store_format_d16_hi_x). Environment: Linux with LLVM 19 locally, plus an extracted Debian LLVM 15.0.6 for spelling; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. LLVM 15 does not know the two MUBUF spellings for gfx1013, so those two are checked against LLVM 19 only. AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T04:37:22Z.
Reopening the last open item from this issue: D9 is still present on current
main(4926f34a), even though most of the list has landed.tools/disasm_rdna2.pystill routes VOP3 interpolation through the gfx9/VI range only:On gfx10/gfx1013 these live at 0x200 / 0x201 / 0x202 (LLVM 15
VOP3Instructions.td:1045-1047), so they fall through to the generic placeholder. Decoding the LLVM golden encoding forv_interp_p1_f32_e64 v5, v2, attr0.x([0x05,0x00,0x00,0xd6,0x00,0x04,0x02,0x00]) on currentmaingives:i.e. no mnemonic and the attribute operand rendered as a source register. Same for 0x201 and 0x202.
Confirmed already fixed on
main, so this is only the VINTRP remainder: MIMGimage_msaa_load(0x80) and theimage_sample_*_g16family now decode correctly.I am taking the 0x200-0x202 slice: map the three forms to
v_interp_p1_f32_e64/v_interp_p2_f32_e64/v_interp_mov_f32_e64, render the attribute operand asattrN.<chan>withclamp/omodwhere the encoding allows, verify the existing 0x270-0x274 branch is genuinely the VI range before keeping it, and add golden vectors taken from LLVM 15.0.7 MC tests with file/line citations. Decoding only; no translator change.Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-24T05:18:32Z.
Independent check of #1055 on Windows with LLVM 15.0.7, plus the before/after scan on the local input mentioned above. Measurement only, no project change. Nothing from my earlier claim needs to be carried forward: #1055 already covers every planned case.
Setup
upstream/mainat908c34bf, Windows 11 26H2 (build 26300.9974), Python 3.13.1.LLVM-C.dllfrom the LLVM 15.0.7 Windows install, andllvm-mc/llvm-objcopy15.0.7.breakput back indisassemble_binary. Thes_code_endname and the zero-word record from #1055 stay in place, so the comparison isolates the continuation.Decoder tests
LLVM_LIB=<LLVM-C.dll> LLVM_MC=<llvm-mc> LLVM_OBJCOPY=<llvm-objcopy> python -B tests/rdna2_tools_check.py908c34bf: 129 tests, OK, 1 skip. The skip is the expected one: LLVM 15 does not decodebuffer_load_format_d16_hi_xfor gfx1013.test_source_built_records_after_s_endpgmran and passed.test_decode_continues_past_s_endpgm,test_source_built_records_after_s_endpgm,test_binary_scan_counts_records_after_s_endpgmandtest_hwreg_truncated_literal_and_endpgm_boundaries.One local input, aggregates only
The input is 12,101 PS records (the same population as #711), re-extracted with
tools/extract_shaders.py --stage pixel --format nativeat908c34bf. As the LLVM reference, every record was walked withLLVMDisasmInstructionthe wayllvm-mcdoes it: a refused word becomes a 4-byte record and decoding continues.Records and boundaries
disasm_rdna2now returns 18,957,986 records, against 16,603,289 up to the first exit. That is 2,354,697 more. LLVM 15 returns 18,958,000.v_madmk_f32(8), VOP2 DPP8 (2), VOP2 SDWA (1) and an unnamed SOP1 with a literal (1).s_endpgm, and in 70 of them a laters_endpgmfollows. I have not checked what these bytes are or whether any branch reaches them. Non-instruction data between exits is a hypothesis only.Scanner (
tools/scan_unsupported_shaders.py --llvm <LLVM-C.dll>on the.bindirectory)lower_statusandlower_errorare identical before and after. That confirms acceptance is unchanged.v_vop3_378;s_sopk_1b/s_sopk_1c(LLVM:s_subvector_loop_begin/_end);v_vop3_378plus refused words..longand assorteds_sop1_xx/s_sopc_xx. After the first exit, our unrecognized records are:v_permlanex16_b32, 52s_subvector_loop_endand 21s_subvector_loop_begin;s_subvector_loop_*appears only in records that also contain refused words, so I would not treat it as a decoder gap yet.Two observations
0x378is unnamed indisasm_rdna2. llvm-mc 15 encodesv_permlanex16_b32 v0, v1, s0, s1as[0x00,0x00,0x78,0xd7,0x01,0x01,0x04,0x00]andv_permlane16_b32as0x377. The scanner already lists both names.v_vop3_378was the most frequent unsupported placeholder before #1055 (2,571 occurrences) and still is after it (3,185). I found no issue or PR for either opcode. If it is useful, I can take naming0x377/0x378as a decoding-only slice with LLVM 15 round trips and the source-built scan case, once you confirm.Limits
AI-assisted.