Skip to content

shader: lower native pixel raw buffer atomic add - #3217

Merged
R0Y00 merged 2 commits into
R0Y00:mainfrom
xiaoqi72665:native/phase4b-pixel-atomic
Nov 27, 2026
Merged

R0Y00 merged 2 commits into
R0Y00:mainfrom
xiaoqi72665:native/phase4b-pixel-atomic

Conversation

@xiaoqi72665

@xiaoqi72665 xiaoqi72665 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Current main integration 4b0350e, Debug and Release: 17/17 selected CTest per build (34/34, no skips/failures).
  • 13 actual draws and 4 refusal controls per adapter/config: 52 draws, 16 refusals, 3328 DWORDs and 1664 pixels checked.
  • Contended GLC old values, non-GLC, half/empty/full EXEC, unsigned wrap, last DWORD, OOB, dynamic two counters, odd raster edge, WQM with real quad-neighbor helper read both with and without GLC. WQM+GLC records old values via a second supported exact atomic and checks a valid serialization of varying increments. No expansion of exact-mask whitelist. WQM+GLC OOB and guard checks.
  • Existing raw UAV, stream, texture UAV, indirect indexed/draw/mesh, direct container and cache regressions passed. Earlier parent-based compute indexed atomic/scalar LDS replays 8/8 suite/config/adapter combinations.
  • Debug layer unavailable on this host; stock runtime lacks required SM6.6. No retail scene or performance claim.

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.

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 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@xiaoqi72665
xiaoqi72665 force-pushed the native/phase4b-pixel-atomic branch from 2ed6410 to f06fb39 Compare November 27, 2026 22:58
@xiaoqi72665
xiaoqi72665 marked this pull request as ready for review November 27, 2026 22:58

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@R0Y00
R0Y00 merged commit 9345c21 into R0Y00:main Nov 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants