shader: preserve the other half in gfx1030 raw D16 loads #1275
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1282"
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-24T06:41:48Z.
Change
Lower the low and high halves of
buffer_load_ubyte_d16,buffer_load_sbyte_d16, andbuffer_load_short_d16for gfx1030. The load reads a byte or short from the rawt0, extends a byte to 16 bits, and replaces only the selected half of a known VGPR word. Both the prior word and the new result must be ready before use. The accepted address remains a verifiedidxenindex, zero scalar offset, and a naturally aligned immediate within an in-range, unswizzled source record. This does not add formatted MUBUF, native descriptor bounds, or status/cache modifiers.Follow-up to merged #1254. The patch was replayed on upstream main at
79f0f84a92edee9f2ab5f14d44a73e38ea75610fand supersedes stan495/Xbox2Windows#5.Verification
Tested clean head
f61e4f3459eb1af916304c84c442a7123b00cf57:36 passed, 0 failed, 0 skipped; both Python checks passed. The two
compute_store_aot_mubuf_d16_{hardware,warp}CTests each contributed all six new forms. Intel Arc B390 (32.0.101.8509) and Microsoft Basic Render Driver/WARP (10.0.26100.9818), Windows build 26300.9974; debug layer unavailable on both. Both backends compared all 320 words for one and three groups, including untouched gaps and tail. Clearing the preserved half failed at word 1 (8b0200bbexpected,000000bbactual for the low unsigned byte). Zero-extending the signed high byte failed there (ffa2a7f1expected,00a2a7f1actual). Rejection controls include unknown or partially known prior words, missing waits, read overrun and misaligned short offsets.Passed in Ubuntu 22.04.5 with LLVM 15.0.7. It assembles and decodes the six original wave32 fixtures and checks the synthetic container CLI against direct lowering. The GPU tests execute translated desktop DXIL.
Evidence and follow-up
The original synthetic fixtures use the repository's MIT License. The README and
docs/experiments.mddocument the tests and the input contract. Native expectations follow the AMD RDNA 2 Shader ISA, sections 8.1.6 and 12.14, MUBUF opcodes 32 to 37.This change was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:56:44Z.
Review: COMMENTED
Reviewed at
f61e4f3459eb1af916304c84c442a7123b00cf57.Verification
Linux (worktree from
origin/main):git diff --check origin/main...HEAD— cleanpython -B tests/docs_links_check.py— passed (16 Markdown files, 287 links)python -B tests/bidi_controls_check.py— passed (1072 tracked files)LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so python -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so— passed (exit 0 across all fixtures includingmubuf_d16_controlsand all sixbuffer_load_*_d16*binary roundtrips)Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at
f61e4f3459eb1af916304c84c442a7123b00cf57:--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6):2.77s(configure1.44s)ctest --preset dev -R 'compute_store_aot_mubuf_d16_warp' --parallel 4 --no-tests=error --output-on-failure): 1/1 passed (3.26s:compute_store_aot_mubuf_d16_warp3.20s)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6):0.34s(configure1.45s)ctest --preset release -R 'compute_store_aot_mubuf_d16_warp' --parallel 4 --no-tests=error --output-on-failure): 1/1 passed (3.20s:compute_store_aot_mubuf_d16_warp3.13s)Findings
tools/compute_store_aot.pylowers all sixgfx1030raw D16 MUBUF loads (buffer_load_{ubyte,sbyte,short}_d16{,_hi}) under the existingidxen/zero-scalar-offset/aligned-offset contract, requiring a known full destination word (is_word(vector.get(dst))) beforehand, sign-extendingsbyteto 16 bits via(... & 0xffffu)before shifting, preserving the untouched half (0xffffu/0xffff0000u), and bounding expression growth withALU_EXPRESSION_LIMIT.tests/compute_store_check.pycovers all six variants in bothbinary(LLVM-19) anddraw-mubuf-d16(WARP) modes, including negative controls for preserved-half clearing, signed-byte sign-extension, unknown destination input (e.g., aftertbuffer_load_format_d16_x), missing waits, misaligned short offset, and record overrun. No issues found.