Repository navigation
shader: lower gfx1013 same-texel image loads through the UAV - #2136
Conversation
Conflicts with R0Y00#2106 (D16 image stores): the D16 and RGBA16 FLOAT checks and the same-texel UAV load checks now form one chain; the store keeps the UAV coordinate check and R0Y00#2106's two-VGPR data count; the compute harness keeps both case flags (bit 21 UAV load, bit 22 RGBA16 FLOAT) and R0Y00#2106's per-format texel size; docs, README, CMake and workflow keep both entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedin7
left a comment
There was a problem hiding this comment.
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 plus UAV_TYPED_LOAD requirement), 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.- No separate Win2025 run by me. The PR's own Windows CI is green.
Mutations (both reverted with git checkout -- .):
- Dropped the
dims[2] != 1condition. Killed: "Expected rejection: Image UAV load/store requires unique dispatch X/Y coordinates and local Z size 1". - Disabled the load/store coordinate equality check. Killed: "Expected rejection: Image UAV load and store must use the same coordinate VGPRs and values".
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
- P1: none.
- P2: none.
- nit (
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. - nit: the docstring says "one Z group" is a caller contract. It is not enforced in the translator, only in the fixture. This is documented, so I am noting it only.
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_mip without a separate SRV is now rejected.
AI-assisted; commands listed were executed locally.
|
Thanks for the review and the two mutations. On the nits:
No code change for either, so the head stays Status: ready to merge from our side. CI is green on the current head. |
|
Merged current Status: ready to merge from our side. |
tedin7
left a comment
There was a problem hiding this comment.
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...HEAD is 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.- No separate Win2025 run by me. The PR's Windows CI is green.
Mutation (reverted with git checkout -- .): removed the dims[2] != 1 condition on the UAV-load path in tools/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
- P1: none.
- P2: none.
- nit (unchanged from last review): a lone UAV load with no store is accepted, and the Z/X/Y guard only runs when a store pairs with it. This is harmless (read-only). A docstring line would pin the intent.
AI-assisted; commands listed were executed locally.
|
Ran head
The translation controls passed on each run. Typed UAV loads of the format used here work on both older GPUs. AI-assisted. |
stan495
left a comment
There was a problem hiding this comment.
Verified head b6dc5726 on Windows x64 (dev preset, MSVC 19.44.35228.0, SDK/DXC 10.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)- Hardware:
AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010) - WARP:
Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)
- Hardware:
Verdict: Approved at b6dc5726.
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).