Shaders: an atomic subtraction on group memory is a compare-exchange loop on NVIDIA (port of Marvisak/VIctory#3619) #1939
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1939
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1939"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@futurepro62 on GitHub · 2026-11-29 03:35 UTC · original
futurepro62:atomic-sub-loops-nvidia→main· +247 −0 · 6 files · 1 commits · merged 2026-11-30 14:12 UTCPort of Marvisak/VIctory#3619 by @notquiteog (commit
47bdeca, author kept) onto this fork'smain.Problem
On NVIDIA cards one of the title's compute pipelines is never made:
weatherParticle:CS_BeginUpdate(compute7f61193d2c0e5f22). The driver refuses it withE_OUTOFMEMORYin every run:So its dispatches are dropped. Upstream found the cause: NVIDIA's compiler rejects an atomic subtraction on group-shared memory (
atomicrmw sub, oratomicrmw addof a negated value). It isn't really memory.Change (as upstream, adapted)
Module::atomic_subtracts(emit/bitcode.rs) rewrites those atomics as a compare-exchange loop with the same result. It runs inShader::finishbefore the flags are read (emit/shader.rs).0x10DE,host::default_adapter_vendor).VICTORY_ATOMIC_SUB_LOOP=1or=0overrides it. Other hosts get exactly today's code.shader_cache.rsdiffers from upstream's.host_settings()is added next toKEYED, and the switch goes intobuild()'s key bytes (atomic_sub_loops=), so translations made with and without it are never mixed.victory translatesets it only withVICTORY_ATOMIC_SUB_LOOP=1, because that tool doesn't linkvictory-gpuhere.Testing
On this branch (
main568c5e5+ this commit):cargo build --release --locked -p victory: ok (the warnings are all in files this doesn't touch).cargo test --release --locked -p victory-gpu --lib shader_cache: 4 passed, 0 failed (includes the keyed-switch tests).cargo test --release --locked -p victory-shader --lib atomic: 8 passed, 0 failed.VICTORY_HOST_WAVE=32 VICTORY_VIEW_LIMIT=1000000 [VICTORY_ATOMIC_SUB_LOOP=1] victory translate <game>/shaders.rpf --validate --list. Both give 25,616 validated and 0 validator errors. Exactly one program changes output,weatherParticle:CS_BeginUpdate(7f61193d2c0e5f22), and none is lost.In game, on a local build that is not this branch. Fork
main9300875(2026-11-28 morning) + #339 + #348 (with the fallback-order fix posted there) + this port (1f10565, the same change). Currentmainwasn't played. Earlier today it dropped 75 compute programs on this card (#1435), which made it a poor place to judge a weather effect; that count is down to 2 on568c5e5.victory warm --these <the pipeline>with the port:made ... 1. Without it, every attempt was refused.victory warm, about 76 minutes of play: nopipeline refusedline, no device removal. Frame-time median 71.4 ms (the frame-generation pacing on this setup), mean 71.9 ms, as without the port.Upstream report from the same tests: Marvisak/VIctory#3619 (comment of 2026-11-29).
🤖 Generated with Claude Code
@tupacfan04 on GitHub · 2026-11-29 06:57 UTC · original
Tested on an RTX 5070 12 GB (driver 621.40, Windows 11): this cures the refusal here.
Cherry-picked onto main
e1f2eb6(author kept), freshvictory preload, then four 6-minute Series X runs (1440p, DLSS Quality, no frame generation, 30 cap, ray tracing on).host pipeline refused ... (0x8007000E) shaders=[compute 7f61193d2c0e5f22]e1f2eb6Tests on the cherry-pick: GPU 628 passed, shader 399 passed (8 ignored,
atomic_subtractions_become_loopsamong those passing), loader 50 passed.Three notes from reading the diff, none blocking:
VICTORY_ATOMIC_SUB_LOOP=1is set.atomic_sub_loops=joins the cache key, so everyone on NVIDIA needs a new preload after this lands. Worth a line in the release notes.I could not judge the weather particles by eye (unattended runs), only that the pipeline is now made.
🤖 Generated with Claude Code
@nick0451 on GitHub · 2026-11-29 12:57 UTC · original
Heads-up for merging: merged onto current main
829188e9, this branch (b6ce5d7e) no longer builds:So
Rmw::Subisn't in main'sbitcode::Rmwany more (or never was on this base). It needs a rebase onto main, or the variant added with it. (Seen while building a batch of shader PRs on main + one local fix; GitHub shows no conflict, because the break is semantic, not textual.)🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-29 17:33:22 +00:00
@tyr0nsur on GitHub · 2026-11-30 20:26 UTC · original
This PR shows as merged (merge commit
d62c7d55, 2026-11-30 14:12), but that commit is not in the currentmainhistory (e1251c31), andatomic_subtracts/VICTORY_ATOMIC_SUB_LOOPare not in the tree.mainhasLower::lds_subfords_sub_u32instead, andRmw::Subis gone, so a cherry-pick ofb6ce5d7eno longer builds. Meanwhile every RTX 50 log I could find from the v2026.11.30 builds still refuses7f61193d2c0e5f22withE_OUTOFMEMORY, while the one RTX 4060 run that asked for it made it. Details and the per-log table are in #4450.AI-assisted with Claude Code.