shader: lower s_load_dword and s_load_dwordx2 descriptor fetches in pixel_aot #903
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/910"
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 rasptum on 2026-11-23T16:49:48Z.
Claim: GPU VA / descriptor milestone (issue #132 bucket). Interface:
tools/pixel_aot.pylower(..., pointer_constants=...)and the CLI--pointer-constant SGPR POINTER_OFFSET DWORDS OFFSET. There is no open SMEM issue, so the claim is here.What changes
pixel_aotnow lowerss_load_dwordands_load_dwordx2when they fetch a table pointer that a laters_load_dwordx4uses to reach a constant-buffer descriptor in a nested table.pointer_constants: entries of (entry SGPR, pointer byte offset, pointer dwords 1|2, descriptor byte offset). The parent table is named as inextra_constants. Entries map in order to the cbuffer slots after theextra_constantsones, asuint4under the integer export andfloat4otherwise.s_load_dwordx2reads a 2-dword pointer as a full 64-bit address. The descriptor fetch must use the loaded high word unchanged.s_load_dwordreads a 1-dword pointer (the low word). The program must then set the high word to a tracked zero.s_waitcnt lgkmcnt(0). No new lowering table is added: the existings_load_dwordx4descriptor branch accepts the new table marker.glc/dlc, odd or out-of-range destination pairs, and contracts whose pointer overlaps another pointer, a constant descriptor or a texture descriptor in the same table.write_caseintests/pixel_aot_check.pymay now combine the extra-buffer flag (bit 3) with the integer render-target flag (bit 0). The renderer already accepted that combination; it needed no C++ change.SMEM coverage:
s_load_dwordands_load_dwordx2joins_load_dwordx4,s_load_dwordx8and the threes_buffer_load_dword{,x2,x4}forms. The new CTest records them throughFORM_COVERAGE_RECORD.Tests
New CTest
pixel_aot_smem_pointers_{warp,hardware}(tests/pixel_aot_check.py draw-smem-pointers). It readsb1word 2 through a 64-bit pointer andb2words 5 and 6 through a 32-bit pointer, plusb0word 3. All reads go throughR32G32B32A32_UINTand are compared bit for bit. Every other buffer word is a sentinel naming its buffer and index. The two word sets include a quiet NaN payload, a binary32 denormal, negative zero, all ones and zero.Negative controls, each verified as a reported mismatch:
b1andb2exchanged;b0sentinel;b1word 3 in place of word 2.The CPU controls (
check_smem_pointer_controls, run in every mode) cover the refusals listed above, among them mutated descriptor offsets, mutated or unaligned pointer offsets, width swaps, a missing wait, a missing or clobbered high word, and contract overlaps. The fixture is also part of the LLVM binary round trip.Results
Commit
2137118(rebased onca0cc0e). Windows 10 Pro 19045.6466, D3D12 debug layer enabled (debug_layer=enabledon both backends). WARP: Microsoft Basic Render Driver,d3d10warp.dll10.0.19041.5794. Hardware: NVIDIA GeForce RTX 3060, driver 32.0.15.9636. DXC from Windows SDK 10.0.26100.0.pixel_aot_smem_pointers_warppixel_aot_smem_pointers_hardwareNo capability skips.
Regression run
ctest --preset {dev,release} --no-tests=error -R '^pixel_aot_' -j 3: 96 of 98 pass on both presets, no skips. The two failures arepixel_aot_blend_scalar_hardware(channel 03fa04000vs3fa0c000on the RTX 3060) andpixel_aot_title_loads_warp. Both fail the same way with the base commit's Python files (fc89b9e) against the same renderer, so they predate this change. They are not touched here.Python and binary checks on
2137118:Binary mode ran locally with LLVM 15.0.7 on Windows:
clang --target=amdgcn--amdpal -x assemblerstood in forllvm-mc, with-mattr=±wavefrontsize64mapped to-m[no-]wavefrontsize64, plusllvm-objcopy.exeandLLVM-C.dll.docs/experiments.mddocuments the contract, the refusals and the measured result next to thethree-buffersfixture.Scope: these are explicit desktop bindings supplied by the caller. The translator does not infer how a title lays out nested tables. This does not establish title startup or execution.
Overlap: checked against the 29 open PRs on 2026-11-23, right before pushing (
pr_overlap_check.py --autoplus the opcode, contract and CTest names). No overlap, and the branch is current withmain.🤖 Generated with Claude Code