shader: lower indexed gfx1030 raw subword loads #1218
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1225"
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 stan495 on 2026-11-24T04:22:55Z.
Change
Lower
buffer_load_ubyte,buffer_load_sbyte,buffer_load_ushortandbuffer_load_sshortin the gfx1030 compute store profile. Read the containing DWORD from the caller-bound rawt0and extract and extend the selected field. Accept only verifiedidxen, a zero scalar offset, naturally aligned immediates, DWORD-aligned source records, and descriptor/result waits. The caller must provide valid, unswizzled, stable, in-range records disjoint fromu0. This does not emulate native bounds or add D16, cache/status modifiers, or pixel bindings.Verification
Tested clean head
8080458752a782d8bd5677d2b78a0ce8eaaae07dafter merging upstream3a156358b4d4a26b1243148e52a61a7f2329b164. The conflict resolution retains both the raw subword loads in this PR and the multichannel typed loads from #1206.8 passed, 0 failed, 0 skipped. Both
compute_store_aot_mubuf_subword_{hardware,warp}runs contributed all four new gfx1030 MUBUF forms. Intel Arc B390 GPU (32.0.101.8509) and Microsoft Basic Render Driver/WARP (10.0.26100.9818), Windows build 26300.9974; debug layer unavailable on both. Each translated DXIL program matched all 320 CPU-reference words after one and three groups, including gaps and the untouched tail. The first wrong-byte control failed at word 1 (000000a7expected,000000f1actual); the signed-byte zero-extension control failed there withffffffbbexpected and000000bbactual. Additional controls include a misaligned halfword, a record overrun, and use before either wait.Both Python checks passed. The binary command passed in Ubuntu 22.04 with LLVM 15.0.7: all four wave32 programs assembled and disassembled, and the synthetic container CLI emitted the same HLSL as direct lowering. The same JUnit and records also confirmed that all four upstream typed-load forms passed on both backends. Neither the binary round trip nor the desktop DXIL dispatch is native GPU execution of the original RDNA2 programs.
Evidence and follow-up
The original synthetic fixtures are submitted under the repository's MIT License. Indexed gfx1030 raw subword reads documents the assumptions and reproduction. This compute-only profile does not implement the pixel bound-buffer contract in #319, and it does not depend on the typed MTBUF changes.
This change was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:27:34Z.
Review: COMMENTED
Reviewed commit
bd2fd808(CMakeLists.txt,README.md,docs/experiments.md,tools/compute_store_aot.py,tests/compute_store_check.py).Findings
tools/compute_store_aot.py):widthis1(ubyte/sbyte) or2(ushort/sshort), andoffset % widthenforces natural alignment (offset <= 4095).source_strideis already constrained to4 <= source_stride <= 0x3fffandsource_stride % 4 == 0at entry (lower), sooffset + width <= source_stridewith natural alignment guarantees(offset & ~3) + 4 <= source_stride; the enclosing DWORD load attid.{axis} * source_stride + (offset & ~3)stays within the source element.((inputData.Load(...) >> ((offset % 4) * 8)u) & mask)and two's-complement sign extension((field ^ sign) - sign)forsbyte/sshortproduce the expected 32-bit unsigned/sign-extended representations, stored intoloading[dst]so use befores_waitcnt vmcnt(0)is rejected.glc,tfe,_d16), non-zero scalar offset,offen/idxen offen, non-gfx1030targets, UAV descriptor reads, and missinglgkmcnt(0)/vmcnt(0)waits are rejected and covered bymubuf_subword_controls.README.mdanddocs/experiments.mdare title-neutral and accurately state the assumptions and scope.Checks (Linux / LLVM 19)
/root/.local/share/x2w-rev-venv/bin/python -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: passed./root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py: passed (form coverage checks passed)./root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: passed (self-test passed; 16 Markdown files, 275 links)./root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: passed (self-test passed; 1018 files).git diff HEAD~1 --check: passed.compute_store_aot_mubuf_subword_{warp,hardware}) were not run locally.