shader: lower gfx1013 same-texel image loads through the UAV #2128
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2136"
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 Jess-Doit on 2026-11-25T01:25:43Z.
Refs #1545.
Change
Lower one full-mask gfx1013 2D
image_loadfrom the store's mip-zeroR32G32B32A32_FLOATdescriptor toasuint(outputData[uint2(x, y)])onRWTexture2D<float4>atu0. The translator checks the descriptor provenance, requires the load before the store, and matches both coordinate VGPR numbers and tracked values. The destination must use dispatch X/Y with local Z size 1. The caller supplies a single Z dispatch group. Loaded words become available afters_waitcnt vmcnt(0).The fixture uses the same RGBA32 FLOAT UAV for load and store and skips with exit 77 without
TypedUAVLoadAdditionalFormatsor the required typed-load and typed-store format bits. D3D12 typed UAV loadsTests
The shader rotates RGBA to GBAR in 16 unique mip-zero texels over two X groups. The independent CPU reference compares all 1,344 words in three mips, including 1,280 untouched sentinels. The pure-Python checks pin the declaration, read, store and their order. LLVM 15 reassembles the recorded words, disassembles both image instructions and verifies the synthetic container CLI translation. The existing explicit-mip SRV fixture also passed its binary round trip.
3f800001, actual00000000.Image UAV load and store must use the same coordinate VGPRs and values.Image UAV load/store requires unique dispatch X/Y coordinates and local Z size 1.Image UAV load must precede the image store.Only one image UAV load is supportedorExpected at least one observable store.Vector load result used or overwritten before s_waitcnt vmcnt(0).Unsupported compute instruction.image_load_mip requires a separate SRV.Verification
Tested commit
62b0c31105069e6bf0614bd6391857a793e49204on Windows 10 22H2, build 19045.6456, with DXC 1.9.2602.17 and LLVM 15.0.7llvm-mc. The GTX 1060 6GB used driver 32.0.15.6094. In-box WARP used Microsoft Basic Render Driver 10.0.19041.5794. The D3D12 debug layer was enabled and reported zero warnings and errors for the fixture and its control on both adapters.dev)release)Set
VULKAN_SDKto the Vulkan SDK 1.4.363.0 installation. Use a Python environment withrequirements-dev.txtinstalled.The local binary checks used LLVM 15.0.7 for assembly, llvm-objcopy to extract
.textand libLLVM 15.0.0 to disassemble. The Windows DLL can be extracted toout/libLLVM-15.dll. LLVMSharp Windows runtime packageLimits
The supported launch covers one Z plane and in-bounds, unaliased texels. The measurements cover normal binary32 words on desktop D3D12. Special floating-point values, native console execution and inter-thread ordering are outside the measurement.
After merging main at
5581b4b0(which brought #2106's D16 stores into the same rules, at headdaec8615), I reran the image selection: 33/33 in dev and 33/33 in release on the GTX 1060 and WARP, debug layer on, no skips. The LLVM 15--binarychecks of this fixture and of the D16, 2D and image-atomic fixtures pass too.Caller contract the translator cannot check: the dispatch must have a single Z group, because the translator proves unique destinations from the dispatch X and Y IDs within one Z plane.
AI-assisted (Codex, driven with Claude Code; Claude Code reviewed the change, merged main and reran the checks).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:40:54Z.
Review: COMMENTED
Review of head
daec8615816d4c8886318462ef3cace66ecdaa17(comment only).Scope read:
tools/compute_store_aot.py(UAV-load branch, address pairing, Z/X/Y uniqueness guard),tests/compute_mimg_image_uav_load.s,tests/compute_check.cpp(new selector bit 21 plusUAV_TYPED_LOADrequirement), CMake test registration, Windows workflow entry.Commands run locally (Linux):
git diff --stat origin/main...HEAD: 8 files, +282/-14.python3 tests/compute_mimg_image_uav_load_check.py: "Same-texel UAV load translation controls passed".python3 tests/docs_links_check.py: passed (399 links).python3 tests/bidi_controls_check.py: passed.git diff --check origin/main...HEAD: clean.--binary llvm-mc-15 ...mode: not run.llvm-mc-15andlibLLVM-15.so.1are not installed on this host. CI job "Assemble and translate gfx1013 fixtures" passed, and so did Windows build/test.Mutations (both reverted with
git checkout -- .):dims[2] != 1condition. Killed: "Expected rejection: Image UAV load/store requires unique dispatch X/Y coordinates and local Z size 1".Checks: CI green (Linux checks, fixtures, Windows). Title is neutral. No model names in the diff. Mergeable state was reported as UNKNOWN when I looked.
Findings
tools/compute_store_aot.py, UAV-load branch): a lone UAV load with no later store is accepted and lowered. That is harmless, since it is a read-only access. But the Z-size/uniqueness guard only runs when a store pairs with it. A short docstring line saying so, or a rejection test for it, would pin the intent.Semantics look right. A same-texel read before the write is race-free when X/Y are injective and Z is a single plane. Ordering is enforced ("must precede the store").
image_load_mipwithout a separate SRV is now rejected.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-25T01:58:17Z.
Thanks for the review and the two mutations.
On the nits:
image_outputset, u0 is the image UAV, so a program whose only access is the load has no observable store. The control attests/compute_mimg_image_uav_load_check.py:60removes theimage_storefrom the fixture and expectsExpected at least one observable store. So the uniqueness guard never needs to run for an unpaired load, because no translation is produced.(2, 1, 1).No code change for either, so the head stays
daec8615.Status: ready to merge from our side. CI is green on the current head.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:15:43Z.
Review: COMMENTED
Re-review of head
b6dc5726d8c812aadc1473f0c83eefdfa8a584d1(comment only).What changed since my last review (
daec8615): only a merge of upstream main. The PR's own diff is unchanged:git diff --stat origin/main...HEADis still 8 files, +282/-14. The earlier read of the UAV-load branch, fixture and selector bit therefore still applies.Commands run locally (Linux):
python3 tests/compute_mimg_image_uav_load_check.py: "Same-texel UAV load translation controls passed".python3 tests/docs_links_check.py: passed (18 files, 407 links).python3 tests/bidi_controls_check.py: passed (1484 files).git diff --check origin/main...HEAD: clean.gh pr checks 2136: Linux checks, fixture assemble/translate and Windows build/test all pass. The /O2 job and chart publish were skipped.gh pr view: MERGEABLE, title neutral, no model names in the diff.--binary llvm-mc-15mode not run locally (tool not installed here). The CI fixture job covers it.Mutation (reverted with
git checkout -- .): removed thedims[2] != 1condition on the UAV-load path intools/compute_store_aot.py(line 2235). Killed with "Expected rejection: Image UAV load/store requires unique dispatch X/Y coordinates and local Z size 1".Findings
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-25T05:10:50Z.
Merged current
main(681d01f5) atb6dc5726to clear the conflict. OnlyCMakeLists.txtconflicted: main's form-coverage environment is kept, along with both typed-UAV-load registrations. Re-run on Windows 10 19045 with the debug layer on (0 D3D12 warnings or errors): GTX 1060 + WARP, 10 passed, 0 failed, 0 skipped.compute_store_check.py binary(LLVM 15), docs links, bidi andgit diff --checkalso pass. The texture-case flag bits are unchanged.Status: ready to merge from our side.
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T05:50:47Z.
Ran head
b6dc5726on three more adapters, Maxwell and Gen9 included. All pass. Windows 11 build 26100, debug layer unavailable.drop UAV readcontrolcompute_store_aot_gfx1013_image_uav_load_warp..._hardware(XBOX2WINDOWS_ADAPTER=Quadro)..._hardware(XBOX2WINDOWS_ADAPTER=Intel)The translation controls passed on each run. Typed UAV loads of the format used here work on both older GPUs.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T06:34:58Z.
Review: APPROVED
Verified head
b6dc5726on Windows x64 (devpreset, MSVC19.44.35228.0, SDK/DXC10.0.26100.0):python -B tests/compute_mimg_image_uav_load_check.py-> passedcmake --build --preset dev --target offscreen_check-> succeededctest --preset dev --no-tests=error -R '^compute_store_aot_gfx1013_image_uav_load_' -V-> 2/2 passed (compute_store_aot_gfx1013_image_uav_load_hardware,compute_store_aot_gfx1013_image_uav_load_warp;groups=2 view_mip=0 compared_words=1344 mismatches=0,drop UAV readfailed as expected with 64 mismatches,debug_errors=0 debug_warnings=0)AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010)Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)Verdict: Approved at
b6dc5726.