Skip to content

feat(gpu): keep idle texture copies while the card has room (LEONIDA_TEXTURE_KEEP) - #53

Open
ShinniUwU wants to merge 1 commit into
ProjectLeonidaL:mainfrom
ShinniUwU:perf/texture-keep
Open

ShinniUwU wants to merge 1 commit into
ProjectLeonidaL:mainfrom
ShinniUwU:perf/texture-keep

Conversation

@ShinniUwU

Copy link
Copy Markdown
Contributor

What changed

Adds LEONIDA_TEXTURE_KEEP=1 (off by default, opt-in profile texture-keep). With it, the sweep of host copies of textures the title fills lets go only what the card needs: under 85 % of the budget only copies idle for ten minutes go; from 85 % those idle for 5 s, longest idle first, until 80 %; from 93 % those idle for 3 s until 84 % (host::vram_keep). Without it every copy idle for 1 s goes from 85 % on, and a 12 GB card sits there the whole time in the first rooms. Taken from Belobug/VIctory-Belobug-AMD 8d79927. No TODO row; new work.

How it was tested

  • Unattended runs: scripts\measure-run.ps1 before and after, two pairs (fill in Playtest below).

Checks run on this branch (after rebasing onto main with #51):

  • cargo test --workspace --locked: no failure (new unit test vram_keep_lets_go_only_what_the_card_needs)
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo xtask policy

Playtest

GPU and driver RTX 3080 12 GB, driver 621.24
CPU, RAM Ryzen 7 7800X3D, 32 GB
Windows or Wine/Proton version Windows 11 Pro 25H2 (26200)
Console profile Series X
Where in the game first rooms (unattended, Enter every 8 s)
How long 330 s a run, frame lines from 170 s
Frame time before (main) usual frame 156.5 and 145 ms
Frame time after (this branch) usual frame 142 and 130.5 ms
Run Usual frame (ms) Median (ms) Copies made again Passes with no room
main 156.5 160 14,986 96
keep 142 152 8,545 319
main 145 158 17,149 12
keep 130.5 132.5 5,674 390
  • Before and after were measured in the same place, and not on the first run after a shader change (3,225 shaders from the cache, 0 translated)
  • No crash report was written and the device was not lost
  • The picture looks the same or better: mixed. First pair: the keep run's world frame 600 shot had 4.6 % near-black pixels against 2.0 %. Second pair: alike (0.6 % against 0.0 %).

What could go wrong: passes that made no host copy for lack of room grew in both pairs (96 to 319, 12 to 390), which is how black textures show up. That is why it stays opt-in. Runs were on e8aa6152, before the rebase onto #51 and the native graphics profiles; the switch needs no change for those (any LEONIDA_* name is accepted). Measured on one card only.

AI

  • AI-assisted: the code port, the unit test, the runs and this description were done with Claude Code; I reviewed the result.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant