Shaders: a 64-bit texture add carries out of the low dword #3135

Open
github-bot wants to merge 1 commit from github-bot/gh-3135 into main AGit
Owner

@⁠FoxxoOwO on GitHub · 2026-11-26 09:42 UTC · original
FoxxoOwO:shader/wide-image-atomic-add-test → main · +52 −0 · 1 files · 1 commits · open

Split out of #2241 as its triage asked: the lowering that PR described is already on main (commit 0b35b7f), and image_atomics_of_64_bits already covers umax, swap and cmpswap. What that test does not cover is an add: the R32G32 view's two dwords are one i64, so the adds every lane makes to one texel carry into the high dword instead of wrapping in place the way two separate 32-bit atomics would.

  • Built with the existing image_atomic and lower_cs32 helpers, not new ones.
  • No rustfmt-only churn in unrelated tests.
  • No cmpswap test (already covered).
  • Checked on hardware and WARP: cargo test -p victory-shader wide_image_atomic_add passes on both.

#2241 can be closed.

**@⁠FoxxoOwO** on GitHub · 2026-11-26 09:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/3135) `FoxxoOwO:shader/wide-image-atomic-add-test` → `main` · +52 −0 · 1 files · 1 commits · open Split out of #2241 as its triage asked: the lowering that PR described is already on `main` (commit `0b35b7f`), and `image_atomics_of_64_bits` already covers umax, swap and cmpswap. What that test does not cover is an add: the R32G32 view's two dwords are one i64, so the adds every lane makes to one texel carry into the high dword instead of wrapping in place the way two separate 32-bit atomics would. - Built with the existing `image_atomic` and `lower_cs32` helpers, not new ones. - No rustfmt-only churn in unrelated tests. - No cmpswap test (already covered). - Checked on hardware and WARP: `cargo test -p victory-shader wide_image_atomic_add` passes on both. #2241 can be closed.
The lowering of 64-bit image atomics is already on main (commit 0b35b7f)
and image_atomics_of_64_bits covers umax, swap and cmpswap. What that test
does not cover is an add: the R32G32 view's two dwords are one i64, so the
adds every lane makes to one texel carry into the high dword instead of
wrapping in place the way two separate 32-bit atomics would.

Built with the existing image_atomic and lower_cs32 helpers; checked on
hardware and WARP.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:08:17 +00:00
Author
Owner

@⁠smaxxey on GitHub · 2026-11-26 10:02 UTC · original

Ran this on an RTX 4060 Laptop GPU (Ada, driver 32.0.16.1742), Windows 11 26300, Rust 1.98.1. No game files. Head 9e22db3 merged locally onto main 63bcca4, then cargo test -p victory-shader --lib --locked -- --test-threads=1 --nocapture image_atomic, three runs.

  • wide_image_atomic_add: ok in 3 of 3, on the hardware device and on WARP (no "skipped" line, so the hardware path ran and this card takes the 64-bit typed atomics in the heap).
  • image_atomics_of_64_bits: ok in 3 of 3.

The test does tell a carry from a wrap: the expected texel is [0xFFFFFBE0, 63], so an add that wrapped within the low dword would leave the high dword at 0 and fail.

Tested with Claude Code's help.

**@⁠smaxxey** on GitHub · 2026-11-26 10:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/3135#issuecomment-7188834754) Ran this on an **RTX 4060 Laptop GPU** (Ada, driver 32.0.16.1742), Windows 11 26300, Rust 1.98.1. No game files. Head `9e22db3` merged locally onto `main` 63bcca4, then `cargo test -p victory-shader --lib --locked -- --test-threads=1 --nocapture image_atomic`, three runs. - `wide_image_atomic_add`: ok in 3 of 3, on the hardware device and on WARP (no "skipped" line, so the hardware path ran and this card takes the 64-bit typed atomics in the heap). - `image_atomics_of_64_bits`: ok in 3 of 3. The test does tell a carry from a wrap: the expected texel is `[0xFFFFFBE0, 63]`, so an add that wrapped within the low dword would leave the high dword at 0 and fail. Tested with Claude Code's help.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 12:31 UTC · original · approved these changes

Verified on RTX 5090 & WARP against origin/main (63bcca4):

  • cargo test -p victory-shader --lib image_atomic -- --test-threads=1: 2/2 passed on RTX 5090 and WARP (including wide_image_atomic_add).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Clean synthetic GPU test verifying 64-bit texture atomic add carry-out from the low dword.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 12:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/3135#pullrequestreview-6074167902) · **approved these changes** Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-shader --lib image_atomic -- --test-threads=1`: 2/2 passed on RTX 5090 and WARP (including `wide_image_atomic_add`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Clean synthetic GPU test verifying 64-bit texture atomic add carry-out from the low dword. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3135/head:github-bot/gh-3135'
git switch 'github-bot/gh-3135'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3135'
git switch 'github-bot/gh-3135'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3135'
git switch 'github-bot/gh-3135'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3135'
git switch 'main'
git merge --squash 'github-bot/gh-3135'
git switch 'main'
git merge --ff-only 'github-bot/gh-3135'
git switch 'main'
git merge 'github-bot/gh-3135'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3135
No description provided.