Intel lowmem tuning #464

Open
github-bot wants to merge 33 commits from github-bot/gh-464 into a-publier AGit
Owner

@⁠michael04flynn-sketch on GitHub · 2026-11-27 03:29 UTC · original
michael04flynn-sketch:intel-lowmem-tuning → a-publier · +1161 −45 · 21 files · 33 commits · open

No description provided.

**@⁠michael04flynn-sketch** on GitHub · 2026-11-27 03:29 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/464) `michael04flynn-sketch:intel-lowmem-tuning` → `a-publier` · +1161 −45 · 21 files · 33 commits · open *No description provided.*
scripts/play-intel-lowmem.ps1 launches the Series S console with smaller
texture, card-buffer, snapshot and staging caps to lower VRAM and RAM use.
Not measured on Intel hardware yet.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
VICTORY_PICKED_MB=8 (default 32). Found by scanning the memory knobs
in crates/victory-gpu; not a line-by-line review of the whole tree.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
When the card's use rises by 512 MB (at most four lines a second) and at
every budget change, a "card:" line gives the frame, budget, use, the
layer's host copies (title fills, others), picked heap textures, texture
and staging pool blocks (made and live), live upload and shared buffer
bytes and counts, and the pipelines first bound. Everything is read from
atomics, since the card's use is asked from inside the texture pass.

- pool: blocks made and let go are counted in atomics (Counts).
- copystat: upload and shared buffers are counted live through a COM
  object held as private data of the resource, which D3D12 releases when
  the resource is destroyed (the pattern of book.rs).
- pipeline: FIRST_BINDS.
- descriptor/host: the probe logs what the host says to a view heap size
  it refuses, to learn the limit of a driver that falls back to 1,000,000.
- copystat: the memory-map comment said every sixth line; it is 60.

Runs 6 to 9 on an Arc B390 died with 0x8007000E after the card's use rose
3.7 GB inside one frame; these counters showed 3.1 GB of it was thousands
of shared buffers (host copies of title memory), not the texture pool or
pipelines.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Indirect executions whose arguments or count the card reads in place
(renderer port 1, VICTORY_PORT_CONSTANTS=1) are clamped alone, right
before they run, after a wait for every earlier shader write, instead of
ahead in a batch or window. The records the title's culling passes write
between a batch's opening and the execution were read before they were
written, so palms and trees dropped out and lamp-lit rooms flickered.
VICTORY_PORT_CONSTANTS_ORDER=0 gives the old order; with
VICTORY_PORT_CONSTANTS_ORDER_ALONE=0 a batch opened after the last shader
that may write buffers is used instead of one execution at a time. A line
with the frame line counts those executions and the 1 MiB ranges they
read from.

The patch is the draw.rs and descriptor.rs part of upstream commits
631400f, 3e04ca0 and 15c3d0e (merged in 7ab13ed), applied unchanged; both
repositories are GPL-3.0. Renderer port 1 is off by default, so nothing
changes in a default run.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The fast class is the cores of the best efficiency class. On a Core Ultra
X9 388H that is the four performance cores: the eight efficiency cores
(same class as the four low-power ones) stayed idle for every helper
thread. With VICTORY_FAST_WIDE=1, and a fast class of under six cores,
the helper threads (stages 2 and 3) may also use the slower cores that
share the fast cores' last-level cache. The submitting thread, and the
threads a frame waits for one by one (stage 1), stay on the fast cores;
low-power cores on a cache of their own are left out. The log line "our
threads' processors" now says wide=<sets>.

ASKED now records the stage each thread asked from. With the switch off,
settle() gives every thread the sets it had before. Off by default; not
measured on a title yet.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- The profile no longer relies on knobs that did nothing: the texture
  room is 50 % (the lowest the layer takes) and the card buffer cap 128 MB,
  VICTORY_RESIDENCY=1 turns on the host-memory budgets that
  VICTORY_RESIDENCY_LIMITED already asked for, and VICTORY_INPLACE_MB is
  documented as counting only with VICTORY_INPLACE.
- -InPlace sets VICTORY_INPLACE=1 and VICTORY_INPLACE_MB=3072 so that
  title memory outside buffers is used where the title wrote it, with no
  copy (run 9 made about 3 GB of such copies in the first world frame).
  Off by default; not measured on this GPU.
- Before the run the script prints free RAM, commit and the five biggest
  processes, and refuses to start under -MinFreeGB (default 14) unless
  -Force is given; it prints the same after the run and passes the
  game's exit code on.
- Settings left over in the window from an earlier run (VICTORY_* except
  the path variables) are discarded, as play.ps1 does, so -InPlace or an
  older version's VICTORY_TEXTURE_BUDGET_MB cannot leak into the next run.
- The comments say what the runs measured.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The victory-gpu tests share process-wide state and one Direct3D device,
and fail at random when they run in parallel: in 10 runs of the lib tests
5 failed, each a different test (watch::*, shader builds, placed
textures), and the original code failed 3 of 8. One at a time they passed
every run (27 s against 13 s). RUST_TEST_THREADS in .cargo/config.toml
makes that the default; setting the variable still overrides it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:33:25 +00:00
probe_view_limit chose 2^22 (with raw twins), 2^21, or the portable
1,000,000 views. An Arc B390 refused both big sizes, so it got 1,000,000
although it may take more, and the title's slots past 737,855 (its 1,245,184
less the dynamic slots) read the null slot. Where 2^21 is refused, the
range up to it is now halved until it is under 16,384 views wide (at most
seven heaps made and let go) and the largest size taken is used. A host
that takes nothing above 1,000,000 gets the portable size as before.

Unit test: six host limits, a host under the portable size, and at most
seven heaps made.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A compute pipeline refused with "The parameter is incorrect" (three on an
Arc B390 in run 9) left nothing to go on without the debug layer. The
"host pipeline refused" warning now adds, for each stage, the DXIL size,
user-data dwords, root CBV/SRV/UAV counts and static samplers, and the
root parameter and sampler counts of the root signature.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 04:04 UTC · original

Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at afa56f8: cargo test --release -p victory-gpu --lib 388 passed, 1 failed, 34 ignored. The failure, views_are_made_beside_the_heap_and_copied_in, is the AMD descriptor-bytes test that #288 fixed on a-publier. This branch predates that merge, so it's not this PR. (AMD card, so the Intel tuning itself is not exercised.)

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 04:04 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/464#issuecomment-7209500267) Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at `afa56f8`: `cargo test --release -p victory-gpu --lib` 388 passed, 1 failed, 34 ignored. The failure, `views_are_made_beside_the_heap_and_copied_in`, is the AMD descriptor-bytes test that #288 fixed on `a-publier`. This branch predates that merge, so it's not this PR. (AMD card, so the Intel tuning itself is not exercised.) AI-assisted (Claude Code); no game data.
Tee everything victory.exe prints to logs/victory-<time>.log with a header
(command, git commit, GPU and driver, env values) and a footer (exit code
with crash-status names, run time, free RAM after). Keeps the newest 20
logs; -LogDir and -NoLog control it. logs/ is git-ignored.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The host now logs UMA / CacheCoherentUMA / IsolatedMMU at startup so an iGPU
run is recognisable in the log. The Intel launcher refuses to start when the
free commit (RAM + pagefile) is under -MinCommitGB (default 20, -Force
overrides) and falls back to the other build when only one exists.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Run log 2026-11-27 (Arc B390, UMA, 31 GB): free RAM fell from 17.9 GB to
2.9 GB inside the first world frame (frame 1217: 3.2 GB of shared buffer
copies, a 2 GB title-filled texture, card use 5.1 -> 8.1 GB of an 8.2 GB
budget that moved with free RAM), then a host command list failed to close
with E_OUTOFMEMORY and the device was removed (0x887A0005).

- residency: on a UMA GPU memory pressure starts under 6 GiB free (leaves
  above 8) instead of 3 (5). The host reports UMA at startup.
- scripts/memlog.ps1 writes a per-second RAM/commit/victory.exe timeline
  next to each run log (.mem.csv).
- launcher: -MinFreeGB default 20; names the device-removed exit code.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Second Arc B390 run: card use rose from 5.4 to 8.1 GB in the first world
frame against a budget of 8.1 to 8.6 GB, with 4.6 GB of RAM still free. On a
shared-memory GPU the texture floor is 1 GiB instead of 2 (VICTORY_TEXTURE_FLOOR_MB
overrides), leaving about 1 GB more for the buffer-copy burst.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Intel UMA: smaller texture floor, second-run findings
Third Arc B390 run died at frame 734 with 'min > max. min = 0, max = -156250'
(clamp in the per-core CPU meter) and the panic aborted the process. The share
is now computed by busy_percent (a look with a non-positive span is an idle
core, unit-tested) and the panel's per-frame work runs under catch_unwind so a
display failure cannot end a run.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Panel: fix a crash in the CPU meter on hybrid CPUs
Fourth B390 run: card budget was 14,978 MB (it follows free RAM on UMA), the
queue made 2,451 MB of title-filled copies, and the first world frame took the
working set from 6.4 to 19.8 GB; free RAM reached 1.2 GB and the device was
removed after a 3.4 s stall. -TextureCapMB sets VICTORY_TEXTURE_BUDGET_MB.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Intel launcher: texture-copy cap and higher free-RAM floor
Fifth B390 run: free RAM stayed above 6.9 GB; the device was removed as hung
(0x887A0006) with 'no breadcrumbs' because the launcher did not set
VICTORY_D3D12_DRED as play.ps1 does. Default is now light; the launcher reads
the log after the run and prints the TdrDelay command on a hang (not run for
the user) or points at the memory timeline on out of memory.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Intel launcher: DRED breadcrumbs and post-run diagnosis
Sixth B390 run: DRED shows list 448 stopped at 53 of 86 commands, indirect mesh
executions, 3.6 s into frame 1252; TdrDelay is the default 2 s. Read-only
registry check before the run and the first named command after it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Intel launcher: TdrDelay check and hang diagnosis; sixth run
Runs 6 and 7 with device-removed data both stop at the same indirect mesh draw
([mesh 85eaffa59a3a6ecf, pixel b352dd911b665364]) 3.2-3.7 s into a list, also
with TdrDelay 30 in the registry. lower.rs marks mesh outputs past 32 KiB as a
known gap to close if one hangs; VICTORY_MESH_OUTPUT_STRICT=1 closes it.
The post-run diagnosis now reads the breadcrumbs for the first unfinished
command (checked against both real logs).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Intel launcher: mesh-output strict, -SkipPipelines, unfinished-command diagnosis
Seventh run statistics: card about 25 % busy, frames waited on the submitting
thread, 2.6 GB a frame of title buffer copies compared on the CPU, threads on
4 fast cores of 16. VICTORY_FAST_WIDE=1 (the code's opt-in for a 4P+8E part) and
VICTORY_CARD_BUFFERS_MB 512 (was 128) are on by default; the launcher prints the
last card-busy figure and the MB compared on the CPU.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Seventh run: lowest free RAM 6.2 GB, peak working set 18.0 GB, card use 8.3 GB
(3.2 GB shared buffer copies, 1.8 GB texture blocks, 2.1 GB host copies). The
1024 MB cap took title-filled texture copies from 2,451 to 1,039 MB. Card buffer
copies trade CPU compare time for system memory on this GPU, so the launcher
offers three presets and prints free RAM / working set after a run.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Intel launcher: Lean/Balanced/Fast profiles and memory figures
Clippy (-D warnings) failed on four existing items: two unannotated transmutes
(descriptor_sites.rs, panel.rs), a needless &mut in watch.rs, and the
diagnostics-only Staging::size that nothing reads. The depth-bounds test drew
through the hosted runner's software adapter, which reports the feature and
does not filter by it, so it skips there like it does without the feature.
Clippy is clean with and without --all-features; 440 victory-gpu and 54
victory-loader tests pass on the Arc B390.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Intel launcher: CPU/GPU balance (wide helper cores, 512 MB card buffers)
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/host/panel.rs
  • crates/victory-gpu/src/texture.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/464/head:github-bot/gh-464'
git switch 'github-bot/gh-464'

Merge

Merge the changes and update on Forgejo.
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-464'
git switch 'github-bot/gh-464'
git rebase 'a-publier'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-464'
git switch 'github-bot/gh-464'
git rebase 'a-publier'
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-464'
git switch 'a-publier'
git merge --squash 'github-bot/gh-464'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-464'
git switch 'a-publier'
git merge 'github-bot/gh-464'
git push origin 'a-publier'
This discussion has been locked. Commenting is limited to contributors.
No description provided.