Place view memory above 4 GiB through renderer port 1 (VICTORY_PORT_HIGH, RDNA's PORT_BUFFERS idea) #389

Open
github-bot wants to merge 1 commit from github-bot/gh-389 into main AGit
Owner

@⁠SmartIngenieriayDesarrollo on GitHub · 2026-11-27 23:26 UTC · original
SmartIngenieriayDesarrollo:port-high-above-4gib → main · +22 −2 · 1 files · 1 commits · open

This idea is XaviFortes'. VIctory-RDNA shipped it first as VICTORY_PORT_BUFFERS (b2917b4, Nov 26). I wrote this before I found theirs. Vice-Tay doesn't have it yet, and it makes a real difference on modest PCs, so here it is for Vice-Tay's port, with my measurements.

If your PC has a single memory stick, or a CPU that spends its frame copying title memory around, this is for you. Fast machines benefit too: every buffer placed in place is one the submitting thread never touches again.

Renderer port 1 (VICTORY_PORT_CONSTANTS=1) only places title memory inside the 32-bit graphics heap. Above 4 GiB the title keeps its windows outside buffers and a good share of its buffers. Each one is a host copy that gets refreshed, uploaded and copied back at every submission that reads it. VICTORY_PORT_HIGH lets the port place that memory too, wherever it is one stretch of a section:

  • VICTORY_PORT_HIGH=2: title buffers and windows above 4 GiB (the useful level);
  • VICTORY_PORT_HIGH=1: windows only;
  • unset or 0: unchanged.

It is 22 lines in crates/victory-gpu/src/port.rs, off by default.

My PC is about the worst case for this layer: Ryzen 7 5700X3D, one DDR4-3200 module (single channel, ~25 GB/s), RX 7800 XT, Windows 11, Series S, first gameplay in Lucía's cell. On Vice-Tay 927da40 plus a frame CSV patch:

  • level 2 placed 118 buffers (487 MB) in place;
  • preparation fell by 10–11 ms per frame;
  • 12.6 → 14.2 fps (single runs), and later runs with it on stayed at 14.2–14.8 fps.

I haven't repeated an alternating A/B on current main (0148258) yet. Level 1 alone gained nothing: the title maps its memory as about 88,000 views of 64 KiB, and none of its 815 windows (3.3 GB) is one stretch of a section.

There is one difference from RDNA's version. Theirs keeps declaring GPU writes for these buffers (Shadow::gpu_writes, a two-line change) so flight hazards stay tracked. This PR follows Vice-Tay's current rule for placed memory and adds no new waits. I saw nothing wrong in my runs, but if you'd rather have their hazard tracking, I'm happy to add it.

Checks: cargo clippy -p victory-gpu --all-targets --locked -- -D warnings is clean and cargo test -p victory-gpu --lib --locked gives 527 passed, 0 failed (Windows 11, MSVC, the repo toolchain). cargo fmt --check only flags files this PR does not touch. Screenshots of the cell show no visual difference. I haven't done a full recorded review.

— El_Santo

AI-assisted (Claude Code): measured on my machine, text drafted with Claude.

🤖 Generated with Claude Code

**@⁠SmartIngenieriayDesarrollo** on GitHub · 2026-11-27 23:26 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/389) `SmartIngenieriayDesarrollo:port-high-above-4gib` → `main` · +22 −2 · 1 files · 1 commits · open **This idea is XaviFortes'.** VIctory-RDNA shipped it first as `VICTORY_PORT_BUFFERS` ([b2917b4](https://github.com/XaviFortes/VIctory-RDNA/commit/b2917b48e), Nov 26). I wrote this before I found theirs. Vice-Tay doesn't have it yet, and it makes a real difference on modest PCs, so here it is for Vice-Tay's port, with my measurements. If your PC has a single memory stick, or a CPU that spends its frame copying title memory around, this is for you. Fast machines benefit too: every buffer placed in place is one the submitting thread never touches again. Renderer port 1 (`VICTORY_PORT_CONSTANTS=1`) only places title memory inside the 32-bit graphics heap. Above 4 GiB the title keeps its windows outside buffers and a good share of its buffers. Each one is a host copy that gets refreshed, uploaded and copied back at every submission that reads it. `VICTORY_PORT_HIGH` lets the port place that memory too, wherever it is one stretch of a section: - `VICTORY_PORT_HIGH=2`: title buffers and windows above 4 GiB (the useful level); - `VICTORY_PORT_HIGH=1`: windows only; - unset or `0`: unchanged. It is 22 lines in `crates/victory-gpu/src/port.rs`, off by default. My PC is about the worst case for this layer: Ryzen 7 5700X3D, **one** DDR4-3200 module (single channel, ~25 GB/s), RX 7800 XT, Windows 11, Series S, first gameplay in Lucía's cell. On Vice-Tay `927da40` plus a frame CSV patch: - level 2 placed 118 buffers (487 MB) in place; - preparation fell by 10–11 ms per frame; - 12.6 → 14.2 fps (single runs), and later runs with it on stayed at 14.2–14.8 fps. I haven't repeated an alternating A/B on current `main` (`0148258`) yet. Level 1 alone gained nothing: the title maps its memory as about 88,000 views of 64 KiB, and none of its 815 windows (3.3 GB) is one stretch of a section. There is one difference from RDNA's version. Theirs keeps declaring GPU writes for these buffers (`Shadow::gpu_writes`, a two-line change) so flight hazards stay tracked. This PR follows Vice-Tay's current rule for placed memory and adds no new waits. I saw nothing wrong in my runs, but if you'd rather have their hazard tracking, I'm happy to add it. Checks: `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` is clean and `cargo test -p victory-gpu --lib --locked` gives 527 passed, 0 failed (Windows 11, MSVC, the repo toolchain). `cargo fmt --check` only flags files this PR does not touch. Screenshots of the cell show no visual difference. I haven't done a full recorded review. — El_Santo _AI-assisted (Claude Code): measured on my machine, text drafted with Claude._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Renderer port 1 (VICTORY_PORT_CONSTANTS=1) places title memory in place
only inside the 32-bit graphics heap. Above 4 GiB the title keeps windows
outside buffers and many buffers; each is a host copy that is refreshed,
sent up and copied back at every submission that reads it.

VICTORY_PORT_HIGH lets the port place that memory too, wherever it is one
stretch of a section: 1 places windows only, 2 title buffers as well.
Unset or 0 keeps the current behaviour.

XaviFortes/VIctory-RDNA reached the same idea a day earlier with
VICTORY_PORT_BUFFERS (b2917b4), which also keeps declaring GPU writes of
those buffers to track flight hazards. This is the smaller form for
Vice-Tay's port: no new waits.

On a Ryzen 7 5700X3D with one DDR4-3200 module (single channel) and an
RX 7800 XT, Series S, first gameplay in the cell, level 2 placed 118
buffers (487 MB) in place, preparation fell by 10-11 ms per frame and the
title ran at 14.2 fps against 12.6 without it (one run each). Image checked
in screenshots only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 23:29:51 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-27 23:26 UTC · original · edited 2026-11-27 23:31 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T23:31:00.817330Z d7e5183 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-27 23:26 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/389#issuecomment-7230145454) · edited 2026-11-27 23:31 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"d7e5183b6b619d1976ef1b0dce798c7fd042fa82","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-27T23:31:00.817330Z">2026-11-27T23:31:00.817330Z</relative-time> | `d7e5183` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-27 23:30 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7e5183b6b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-27 23:30 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/389#pullrequestreview-6094272808) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `d7e5183b6b` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
@ -106,3 +106,3 @@
/// memory.
pub(crate) fn wanted(at: u64, len: u64) -> bool {
on() && at.checked_add(len).is_some_and(|end| end <= LOW && len > 0)
on() && at.checked_add(len).is_some_and(|end| (end <= LOW || high()) && len > 0)
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-27 23:30 UTC · original

P1 Badge Preserve GPU-write declarations for newly eligible memory

With VICTORY_PORT_CONSTANTS=1, VICTORY_PORT_HIGH=2, and asynchronous submissions enabled, newly placed shader-output buffers lose their flight hazard tracking. Shadow::gpu_writes returns for placed memory before calling defer_gpu_write (shadow.rs:4101–4107), so declared_writes and late_blocked cannot detect those pending writes. A subsequent CPU fill, such as the constant-buffer fill recorded at draw.rs:4257, can therefore snapshot stale or partially written bytes while the producing flight is still running; ordering the eventual GPU submissions does not protect that earlier CPU read. Retain write declarations for hazard tracking even when snapshots and copy-back are disabled.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-27 23:30 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/389#discussion_r4724387914) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Preserve GPU-write declarations for newly eligible memory** With `VICTORY_PORT_CONSTANTS=1`, `VICTORY_PORT_HIGH=2`, and asynchronous submissions enabled, newly placed shader-output buffers lose their flight hazard tracking. `Shadow::gpu_writes` returns for placed memory before calling `defer_gpu_write` (`shadow.rs:4101–4107`), so `declared_writes` and `late_blocked` cannot detect those pending writes. A subsequent CPU fill, such as the constant-buffer fill recorded at `draw.rs:4257`, can therefore snapshot stale or partially written bytes while the producing flight is still running; ordering the eventual GPU submissions does not protect that earlier CPU read. Retain write declarations for hazard tracking even when snapshots and copy-back are disabled. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -118,0 +134,4 @@
// Above 4 GiB: title buffers only at level 2.
if !window && high_level() < 2 && start.saturating_add(len) > LOW {
return None;
}
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-27 23:30 UTC · original

P1 Badge Preserve command-list copy order for in-place destinations

With VICTORY_PORT_CONSTANTS=1 and VICTORY_PORT_HIGH=2, a newly placed title buffer fails the !s.in_place() destination filter in HostList::place_copy (host/place.rs:399). Consequently, list::buffer_copy falls back to Step::Copy, which run_deferred executes on the CPU before this submission's draws run. For a command sequence that copies A into B, draws from B, copies C into B, then draws from B again, both draws now read C instead of observing A followed by C. These high-buffer destinations previously supported GPU copies at their recorded positions. Support ordered GPU copies for placed destinations, or leave such buffers shadow-backed.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-27 23:30 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/389#discussion_r4724387920) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Preserve command-list copy order for in-place destinations** With `VICTORY_PORT_CONSTANTS=1` and `VICTORY_PORT_HIGH=2`, a newly placed title buffer fails the `!s.in_place()` destination filter in `HostList::place_copy` (`host/place.rs:399`). Consequently, `list::buffer_copy` falls back to `Step::Copy`, which `run_deferred` executes on the CPU before this submission's draws run. For a command sequence that copies A into B, draws from B, copies C into B, then draws from B again, both draws now read C instead of observing A followed by C. These high-buffer destinations previously supported GPU copies at their recorded positions. Support ordered GPU copies for placed destinations, or leave such buffers shadow-backed. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠akimfomin on GitHub · 2026-11-28 00:26 UTC · original

PortBridge checked d7e5183 on current main fe7c6e5 and with the #379 alias-refresh head. Both are clean by Git. I kept XaviFortes’ original RDNA direction in the comparison. The useful decision for this PR is whether to validate window mode first and leave buffer mode for a separate run.

A small synthetic regression would map an eligible window ending exactly at 4 GiB, one crossing it, and one ordinary buffer above it. Expect mode 0 to keep the old route, mode 1 to accept the eligible window only, and mode 2 to make the ordinary buffer eligible if the required section and resource conditions also hold. Write through a second alias before the read in each case. That checks the new address selection with the #379 interaction without measuring content-dependent FPS. PortBridge can capture independent results when a usable fixture and head are agreed.

**@⁠akimfomin** on GitHub · 2026-11-28 00:26 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/389#issuecomment-7230907471) PortBridge checked `d7e5183` on current main `fe7c6e5` and with the [#379 alias-refresh head](https://git.gtahub.st/github/TaynanGT--Vice-Tay/pulls/379). Both are clean by Git. I kept XaviFortes’ [original RDNA direction](https://github.com/XaviFortes/VIctory-RDNA/commit/b2917b48e) in the comparison. The useful decision for this PR is whether to validate window mode first and leave buffer mode for a separate run. A small synthetic regression would map an eligible window ending exactly at 4 GiB, one crossing it, and one ordinary buffer above it. Expect mode 0 to keep the old route, mode 1 to accept the eligible window only, and mode 2 to make the ordinary buffer eligible if the required section and resource conditions also hold. Write through a second alias before the read in each case. That checks the new address selection with the #379 interaction without measuring content-dependent FPS. [PortBridge](https://github.com/akimfomin/PortBridge) can capture independent results when a usable fixture and head are agreed.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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