GPU: allow memory fault budget to recover per frame and exempt title buffers (#102) #126

Open
ESAT586 wants to merge 1 commit from upstream-pr/126 into main
ESAT586 commented 2026-11-26 05:27:20 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by ESAT586 on 2026-11-26T05:27:20Z.


Addresses part 2 of #102 (fault budget exhaustion).

Problem

In crates/victory-gpu/src/memory.rs, self.faulted only ever incremented inside ake_faults() (FAULTS = 128 per frame, FAULTS_ALL = 2048 total) and never recovered. Once 2,048 faulted pages were mapped—even if many resolved to legitimate title buffers via shadow::in_buffer—fault-mapping stopped permanently for the remainder of the session (had no copy every frame in #102).

Fix (crates/victory-gpu/src/memory.rs)

  • Per-frame leaky-bucket recovery (FAULT_RECOVER = 16): Decay self.faulted by 16 at the start of ake_faults() (called once per frame). This keeps the original FAULTS = 128 per-frame limit and FAULTS_ALL = 2048 initial burst ceiling (preserving the
    un light-4 runaway-ray guard), while allowing new world regions to keep mapping pages across a long session instead of locking at 0 permanently.
  • Exempt existing title buffers from stray-fault charge: Only increment self.faulted when self.map(page) actually placed a page in an arena (self.pages.contains_key(&page)), not when the page resolved directly to a tracked title buffer.
  • Added unit test ault_budget_enforces_burst_cap_and_recovers_across_frames.

Verification (zero game data)

  • cargo test -p victory-gpu --lib --locked -- memory::tests on RTX 3060 Ti 8 GB: 3/3 passed
  • VICTORY_WARP=1 cargo test -p victory-gpu --lib --locked -- memory::tests: 3/3 passed
  • cargo clippy -p victory-gpu --lib --tests --locked: 0 warnings in memory.rs
  • cargo xtask policy --staged: 1 files ok

(Authored and verified with Gemini 4 Neon — High Mode, AI coding agent — with zero game data.)

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6620173770 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/126). Originally posted by [ESAT586](https://github.com/ESAT586) on 2026-11-26T05:27:20Z. --- Addresses part 2 of #102 (fault budget exhaustion). ### Problem In crates/victory-gpu/src/memory.rs, self.faulted only ever incremented inside ake_faults() (FAULTS = 128 per frame, FAULTS_ALL = 2048 total) and never recovered. Once 2,048 faulted pages were mapped—even if many resolved to legitimate title buffers via shadow::in_buffer—fault-mapping stopped permanently for the remainder of the session (had no copy every frame in #102). ### Fix (crates/victory-gpu/src/memory.rs) - **Per-frame leaky-bucket recovery (FAULT_RECOVER = 16):** Decay self.faulted by 16 at the start of ake_faults() (called once per frame). This keeps the original FAULTS = 128 per-frame limit and FAULTS_ALL = 2048 initial burst ceiling (preserving the un light-4 runaway-ray guard), while allowing new world regions to keep mapping pages across a long session instead of locking at 0 permanently. - **Exempt existing title buffers from stray-fault charge:** Only increment self.faulted when self.map(page) actually placed a page in an arena (self.pages.contains_key(&page)), not when the page resolved directly to a tracked title buffer. - Added unit test ault_budget_enforces_burst_cap_and_recovers_across_frames. ### Verification (zero game data) - cargo test -p victory-gpu --lib --locked -- memory::tests on RTX 3060 Ti 8 GB: **3/3 passed** - VICTORY_WARP=1 cargo test -p victory-gpu --lib --locked -- memory::tests: **3/3 passed** - cargo clippy -p victory-gpu --lib --tests --locked: **0 warnings in memory.rs** - cargo xtask policy --staged: **1 files ok** *(Authored and verified with Gemini 4 Neon — High Mode, AI coding agent — with zero game data.)*
avatarmanz commented 2026-11-26 07:36:18 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by avatarmanz on 2026-11-26T07:36:18Z.


Left open: changes the fault-page budget for every card; needs an in-game check first.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7185635863 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/126#issuecomment-7185635863). Originally posted by [avatarmanz](https://github.com/avatarmanz) on 2026-11-26T07:36:18Z. --- Left open: changes the fault-page budget for every card; needs an in-game check first.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/126:upstream-pr/126'
git switch 'upstream-pr/126'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/126'
git switch 'upstream-pr/126'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/126'
git switch 'upstream-pr/126'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/126'
git switch 'main'
git merge --squash 'upstream-pr/126'
git switch 'main'
git merge --ff-only 'upstream-pr/126'
git switch 'main'
git merge 'upstream-pr/126'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
avatarmanz/VIctory-7900XTX!126
No description provided.