Repository navigation
Conversation
fuzeofficlal
left a comment
There was a problem hiding this comment.
LGTM — verified against origin/main (63bcca43) on Windows x64 (RTX 5090 + dxil.dll and WARP).
- Guarding
global_atomic_*on(lo & 3) == 0/(off & 3) == 0combined with the existing EXEC guard (crates/victory-shader/src/emit/lower.rs:1012-1035) cleanly skipsself.memorylookup/dirty marking,atomicBinOp.i32, andmark_view_writeon misaligned lanes, returning0on activeglc = 1lanes while preserving inactive EXEC lanes' prior VGPRs. - Covers all supported 32-bit
global_atomic_*forms (swap/add/sub/smin/umin/smax/umax/and/or/xor, plusfmin/fmaxwhen!glc); 64-bit_x2andcmpswapremain rejected earlier. - Minor non-blocking test note (P3): In
unaligned_global_atomics_are_dropped_and_return_zero(crates/victory-shader/src/emit/memory_tests.rs:372), pre-seedingv6with a nonzero sentinel before the misaligned call would distinguish returning zero from leaving the zero-initialized register untouched. - Checks:
cargo test --locked -p victory-shader --lib -- --test-threads=1 emit::memory_tests:: emit::lower::: 38 passed, 0 failed underVICTORY_WARP=0(skippingheap_direct_texture_reads_mark_their_heap_index); 39 passed, 0 failed underVICTORY_WARP=1(includingunaligned_global_atomics_are_dropped_and_return_zero).cargo clippy -p victory-shader --all-targets --locked -- -D warnings(default and--all-features): clean.cargo xtask policy: 191 files ok (lower.rs= 521,458 B);rustfmt --edition 2024: clean on changed hunks.
Synthetic tests only; no game data used.
|
AMD check at
Synthetic shaders only, no game files. AI-assisted. |
|
Ran the unaligned-global-atomic test at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by The one matching test is Not tested: real unaligned AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on Windows (RTX 5090 + WARP):
- Guarding global 32-bit atomics with
(addr & 3) == 0cleanly drops unaligned accesses and returns zero to active GLC lanes cargo test -p victory-shader --lib unaligned_global_atomics_are_dropped_and_return_zeropassed on RTX 5090 and underVICTORY_WARP=1cargo clippy -p victory-shader --all-targets -- -D warningspassed with 0 warningscargo xtask policypassed (191 files ok)
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
On RDNA2 (
gfx1036, measured natively in wave32 and wave64 in Leonidadocs/design.md), 32-bitglobal_atomic*enforces natural dword alignment ((addr & 3) == 0), matchingbuffer_atomic*(#3389). An unaligned atomic leaves memory untouched, returns0to activeglclanes, and preservesvdst/vdataon inactive lanes. Without a guard, D3D12/WARP executesatomicBinOp.i32at the dword-truncated address.Changes
crates/victory-shader/src/emit/lower.rs(Lower::flat_write,521,458bytes /+895vsmain,2,830bytes below the524,288limit):(lo & 3) == 0for title memory and(off & 3) == 0(withroot_view_offsetapplied) for root views beforebegin_guarded(access_guard)andself.memory(so dropped accesses do not dirty-mark pages).0viaend_guardedon active unalignedglclanes while keeping inactive lanes untouched viaself.write(inst, Reg::V(reg), r, guard).Lower::flat_write/memory_tests.rswith Shaders: lower 32-bit and 64-bit integer global atomics (cmpswap, csub, inc, dec, _x2) #1915 (needs rebase); happy to rebase and extend_x2to(addr & 7) == 0once Shaders: lower 32-bit and 64-bit integer global atomics (cmpswap, csub, inc, dec, _x2) #1915 lands.crates/victory-shader/src/emit/memory_tests.rs:unaligned_global_atomics_are_dropped_and_return_zero.Verification
main): https://github.com/Moon0755/VIctory/actions/runs/45895433559 (failure— 302 passed, 1 failed solely onunaligned_global_atomics_are_dropped_and_return_zero, writing[0, 14, ...]and returning7)fbd2a99): https://github.com/Moon0755/VIctory/actions/runs/45897735457 (success— 303 passed / 0 failed, Clippy + diagnostics Clippy clean,policy::tests::repository_passes_policy ... ok)WARP,AMD Radeon(TM) Graphics, andNVIDIA GeForce RTX 2060 with Max-Q Design— all fail without the fix and pass onfbd2a99.— Devin & Neon