WIP: [pr-feature][memory] DARNER_TILE_HEAP_MB: a smaller Series X streaming heap (off by default) #11

Manually merged
TrustNo1 merged 0 commits from Jesper-A/Darner:pr5-tile-heap into main 2026-12-03 18:36:06 +00:00
Contributor

Re-filed from CodeFloe #326 (the CodeFloe repo is gone; nothing was migrated). Same branch and commit.

Base: the branch is on f2bccf656, the main commit it was cut from. main is now dd2f061d5. Not rebased (we rebase only if you ask). A text-only trial merge (git merge-tree --write-tree trustno1/main pr5-tile-heap) conflicts in README.md and apps/darner/src/heap_budget.rs (main changed that file in f3080a50a, Series S 3840x2160 output); apps/darner/src/run.rs merges cleanly.

Contributor role (optional)

  • Fluxer ID:

What it changes

Series X asks for a 6,236 MiB streaming (tile) heap at start. All title memory is pinned RAM here, so a PC with 16 GB of RAM is left with little free.

New: DARNER_TILE_HEAP_MB (1024 to 6236; not set = the title's own size) replaces the size in the one instruction that loads it. It is fitted into apps/darner/src/heap_budget.rs like the render-target heap and the scene pool: the retail build and the stock bytes are checked first, other builds are refused with a log line, and the patched image gets its own folder (tileheap<MB>). Below 1024 the title stops in System Init (as the author found). Off by default; a README row is added.

Credit: port of lobomfz/VIctory-xmem PR #264 (author Simo), the loader switch only; the fork's run.sh default is not ported. That is a PR in the xmem fork, not a Darner number.

The author's numbers, theirs and not measured by us (RX 9070 16 GB, Ryzen 7 5700X3D, 16 GB RAM): stock 6236 MiB was killed for lack of memory with 127-151 MB free; 3977 ran through with at least 1,808 MB free and p99 80 ms against 150-238 ms.

Unverified: the stock instruction bytes at +0x24796bc come from the fork. They have not been checked against a real retail image: the test that does so (shrinks_the_tile_heap) skips itself when no image is given, and it was skipped. If the bytes are wrong, the switch refuses to patch (it checks the stock bytes first), so the expected failure is "refused", not a corrupt image. That has not been shown on a real image either.

Spec dependence

  • Likely general: the patch itself (one fixed instruction, retail build only; any other build is refused).
  • May depend on our setup: nothing measured by us; the memory benefit depends on how much RAM the PC has.
  • Untested elsewhere: the Series S profile, the streaming cost, and every GPU (the original author's only numbers are from an RX 9070).

How it was tested

  • Tested revision: 23cbdc591 on base f2bccf656 (not rebased on the current main, dd2f061d5).
  • Commands and results:
    • darner tests (-p darner): 107 passed, 1 ignored. They cover size parsing (floor 1024, ceiling 6236) and the instruction bytes.
    • clippy (-p darner): clean with -A clippy::unnecessary_lazy_evaluations -A clippy::manual_is_multiple_of (two lints allowed, not from this change).
    • cargo xtask policy: ok.
  • The three gates: cargo clippy --workspace --all-targets --locked -- -D warnings pending; the same with --all-features pending; cargo test --workspace --locked pending. There is no CI upstream, and nothing here claims one.
  • Gameplay, when relevant: not run in the game.
  • Before and after, when relevant: none from us.
  • Shader wave sizes tested, when relevant: not relevant.
  • Coverage gaps: the stock-byte check on a retail image was skipped (see above); no run with the switch on; the streaming cost of a smaller heap is unmeasured.

Checklist

  • This PR contains one change based on main (base f2bccf656).
  • The diff follows docs/asset-policy.md (cargo xtask policy ok).
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found for DARNER_TILE_HEAP_MB. On 2026-12-03 this host had 3 issues and 5 pull requests in total (#3 by another contributor; #5 to #8 are ours, re-filed today); none is about the streaming heap (issue #1 is about frame generation and texture memory on a 6 GB card, a different allocation). The one open pull request (#3, ray tracing mode in F1) changes host/menu.rs, host/panel.rs and hwrt.rs: none of this change's files. Our own earlier CodeFloe PR on the Series S output (CodeFloe #313, not migrated) edited heap_budget.rs too; main now has our Series S commit f3080a50a, which changes heap_budget.rs and causes the conflict above.
  • Our own re-filed PRs that touch the same files: #8 (texture LOD bias) and #6 (radial wheel hold), both only README.md. Different changes; whichever lands first, the others take the new rows when they are rebased.

This change was made with AI assistance (Claude Code).

Re-filed from CodeFloe #326 (the CodeFloe repo is gone; nothing was migrated). Same branch and commit. **Base:** the branch is on `f2bccf656`, the `main` commit it was cut from. `main` is now `dd2f061d5`. Not rebased (we rebase only if you ask). A text-only trial merge (`git merge-tree --write-tree trustno1/main pr5-tile-heap`) **conflicts** in `README.md` and `apps/darner/src/heap_budget.rs` (`main` changed that file in f3080a50a, Series S 3840x2160 output); `apps/darner/src/run.rs` merges cleanly. ## Contributor role (optional) - Fluxer ID: ## What it changes Series X asks for a 6,236 MiB streaming (tile) heap at start. All title memory is pinned RAM here, so a PC with 16 GB of RAM is left with little free. New: `DARNER_TILE_HEAP_MB` (1024 to 6236; not set = the title's own size) replaces the size in the one instruction that loads it. It is fitted into `apps/darner/src/heap_budget.rs` like the render-target heap and the scene pool: the retail build and the stock bytes are checked first, other builds are refused with a log line, and the patched image gets its own folder (`tileheap<MB>`). Below 1024 the title stops in System Init (as the author found). Off by default; a README row is added. Credit: port of lobomfz/VIctory-xmem PR #264 (author Simo), the loader switch only; the fork's `run.sh` default is not ported. That is a PR in the xmem fork, not a Darner number. The author's numbers, theirs and not measured by us (RX 9070 16 GB, Ryzen 7 5700X3D, 16 GB RAM): stock 6236 MiB was killed for lack of memory with 127-151 MB free; 3977 ran through with at least 1,808 MB free and p99 80 ms against 150-238 ms. **Unverified:** the stock instruction bytes at +0x24796bc come from the fork. They have not been checked against a real retail image: the test that does so (`shrinks_the_tile_heap`) skips itself when no image is given, and it was skipped. If the bytes are wrong, the switch refuses to patch (it checks the stock bytes first), so the expected failure is "refused", not a corrupt image. That has not been shown on a real image either. ### Spec dependence - **Likely general:** the patch itself (one fixed instruction, retail build only; any other build is refused). - **May depend on our setup:** nothing measured by us; the memory benefit depends on how much RAM the PC has. - **Untested elsewhere:** the Series S profile, the streaming cost, and every GPU (the original author's only numbers are from an RX 9070). ## How it was tested - Tested revision: 23cbdc591 on base f2bccf656 (not rebased on the current `main`, `dd2f061d5`). - Commands and results: - darner tests (`-p darner`): 107 passed, 1 ignored. They cover size parsing (floor 1024, ceiling 6236) and the instruction bytes. - clippy (`-p darner`): clean with `-A clippy::unnecessary_lazy_evaluations -A clippy::manual_is_multiple_of` (two lints allowed, not from this change). - `cargo xtask policy`: ok. - The three gates: `cargo clippy --workspace --all-targets --locked -- -D warnings` pending; the same with `--all-features` pending; `cargo test --workspace --locked` pending. There is no CI upstream, and nothing here claims one. - Gameplay, when relevant: not run in the game. - Before and after, when relevant: none from us. - Shader wave sizes tested, when relevant: not relevant. - Coverage gaps: the stock-byte check on a retail image was skipped (see above); no run with the switch on; the streaming cost of a smaller heap is unmeasured. ## Checklist - [x] This PR contains one change based on `main` (base f2bccf656). - [x] The diff follows `docs/asset-policy.md` (`cargo xtask policy` ok). - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found for `DARNER_TILE_HEAP_MB`. On 2026-12-03 this host had 3 issues and 5 pull requests in total (#3 by another contributor; #5 to #8 are ours, re-filed today); none is about the streaming heap (issue #1 is about frame generation and texture memory on a 6 GB card, a different allocation). The one open pull request (#3, ray tracing mode in F1) changes `host/menu.rs`, `host/panel.rs` and `hwrt.rs`: none of this change's files. Our own earlier CodeFloe PR on the Series S output (CodeFloe #313, not migrated) edited `heap_budget.rs` too; `main` now has our Series S commit f3080a50a, which changes `heap_budget.rs` and causes the conflict above. - Our own re-filed PRs that touch the same files: #8 (texture LOD bias) and #6 (radial wheel hold), both only `README.md`. Different changes; whichever lands first, the others take the new rows when they are rebased. This change was made with AI assistance (Claude Code).
Port of lobomfz/VIctory-xmem PR #264 (author Simo), the loader switch
only; the fork's run.sh default is not ported.

Series X asks for a 6,236 MiB streaming (tile) heap at start; all title
memory is pinned RAM here, so a PC with 16 GB of RAM is left with little
free. DARNER_TILE_HEAP_MB (1024 to 6236, not set = the title's own size)
replaces the size in the one instruction that loads it. It is fitted into
heap_budget.rs like the render-target heap and scene pool: retail build
and stock bytes are checked first, other builds are refused with a log
line, and the patched image has its own folder (tileheap<MB>). Below 1024
the title stops in System Init.

The author's numbers (theirs, not measured by us; RX 9070 16 GB, Ryzen 7
5700X3D, 16 GB RAM): stock 6236 MiB was OOM-killed with 127-151 MB free;
3977 ran through with at least 1,808 MB free and p99 80 ms against
150-238 ms.

Tests: range parsing (floor 1024, ceiling 6236), the instruction bytes,
and a stock-byte check on the retail image when one is supplied.

This change was made with AI assistance (Claude Code).
TrustNo1 manually merged commit 273d42acca into main 2026-12-03 18:36:06 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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
TrustNo1/Darner!11
No description provided.