Repository navigation
shader: lower native pixel raw buffer atomic add - #3217
Conversation
Reuse compute raw atomic lowering with exact pixel EXEC, helper exclusion, bounded view and GLC old-value SSA. Validate through native request publication and real GPU draws. Refs R0Y00#3216, R0Y00#3212, R0Y00#3215, R0Y00#3074, R0Y00#3198. AI-assisted.
R0Y00
left a comment
There was a problem hiding this comment.
With #3215 on main, I applied only this draft's atomic commit 2ed64102 over 4b0350ea. That applies cleanly (trial tree 76ea0130) although the existing stacked branch still shows a conflict because it carries the pre-squash parent. Applying only the child when you rebase preserves the already merged raw-store changes.
Built startup_stream_consumer d3d12_xs_shim compile_dxil native_raw_buffer_view_check native_store_replay offscreen_check. In Debug and Release /O2 the pixel atomic, raw pixel UAV, existing pixel UAV, device-free raw view, indexed atomic, and adjacent image atomic hardware selections passed 10/10 per configuration, no capability skips. The atomic fixture passed 11 actual draws and four compiler refusals on each of WARP 10.0.26100.9818 and RTX 4060 Laptop (32.0.16.1656) per build on Windows 11 26200.9974. It checks contended old-value multisets, no-return, sparse and empty EXEC, out-of-view and the odd-edge post-WQM helper-read case. The pixel fixture enabled the debug layer and reported no errors. These are source-built results on the isolated integration. Please rebase the draft onto main and include a short reproducible scope note when marking it ready.
Preserve exact coverage restrictions; record old values via a second supported raw atomic and check serialization. Document supported scope and reproduction. AI-assisted.
2ed6410 to
f06fb39
Compare
R0Y00
left a comment
There was a problem hiding this comment.
Independently reviewed f06fb399 integrated over current main 2e12dd8e (clean trial tree 55002fb5). The rebase keeps the already-merged #3215 binding. The final revision adds the WQM+GLC return and out-of-view controls plus a reproducible scope note. I traced the explicit coverage/EXEC predicate before the atomic side effect and the GLC merge of the returned value, zero for active OOB, and preserved inactive value.
Built startup_stream_consumer d3d12_xs_shim compile_dxil native_raw_buffer_view_check native_store_replay offscreen_check, then ran ctest --test-dir <build> --no-tests=error -j1 -V -R '^(native_(pixel_(atomic|raw_uav)_(warp|hardware)|raw_buffer_view_controls|.*atomic.*_hardware)|startup_(pixel_uav|stream_draw)_(warp|hardware))$'. Debug and Release /O2 each passed 12/12, no skips. On WARP 10.0.26100.9818 and RTX 4060 Laptop driver 32.0.16.1656, each configuration passed 13 actual atomic draws and four refusal controls per adapter. The two new WQM+GLC cases matched all 64 DWORDs and 32 pixels per draw, including odd-edge coverage and OOB. D3D12 debug layer enabled, Windows 11 26200.9974. The docs check and hosted Windows passed.
Scope
Refs #3216, #3212, #3215, #3074, #3198. #3215 has merged as 0b17c52. Rebased only the independent atomic commit onto main 4b0350e (77cc88a; range-diff identical). Follow-up f06fb39 adds WQM+GLC tests and documentation.
Reuse existing raw DWORD buffer atomic lowering and the raw pixel UAV runtime binding. Guard side effects with exact pixel coverage, proven EXEC and view size. GLC uses an SSA phi for old value, preserves inactive VGPRs and returns zero for active out-of-view access. Without GLC the original addend is untouched. Only proven straight-line guest blocks (including flattened mask regions); no general CFG, indexed atomics, other operations or unproven WQM. Single raw pixel UAV, direct non-indexed draw without SRVs.
Verification
Before: synthetic native raw pixel Atomic Add with and without GLC refused as graphics buffer atomic; ordinary raw store compiled.
After: native request -> offline cache -> PSO -> Draw -> GPU readback. RX 7900 XT (32.0.32029.2010) and WARP (1.0.22.0), app-local Agility 1.620.2.
Reproduce: cmake --build --preset dev --target startup_stream_consumer compile_dxil; ctest --preset dev --no-tests=error -j1 -R "^native_pixel_atomic_(warp|hardware)$" -V. Repeat release. Supported scope and reproduction are also in docs/experiments.md.
AI-assisted; Buhe.