gpu: give section aliases stable backing generations and mapping leases #377

Closed
opened 2026-11-27 21:41:51 +00:00 by krofty · 5 comments
krofty commented 2026-11-27 21:41:51 +00:00 (Migrated from github.com)
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by krofty on 2026-11-27T21:41:51Z.


GPU ownership and selective publication require one stable identity for the bytes behind registered buffers, raw-address windows and mapped aliases. The current fork's in-place census keys physical pages by a reusable section handle and offset; it has no allocation incarnation or mapping epoch. Its mapping notification occurs after MapViewOfFile3 has exposed writable bytes. Those facts are insufficient to authorize suppressing eager hashes/readback safely.

Port the already-written canonical backing identity and generation primitives from Codex's shared-storage work (Snaacky/ztrx#249) to the current NVIDIA implementation, with tightly scoped mapping/allocation hooks. Do not port its old capture implementation or assume its observed versions prove GPU ownership.

Acceptance for this foundation stage:

  • Stable backing token, physical64KiB page identity, allocation incarnation, logical range and mapping epoch; handle/address/page reuse cannot resurrect an old binding.
  • Registered ranges and section aliases can resolve the same backing bytes; escaped, unknown or incomplete aliases remain explicitly unproven.
  • Mapping mutations invalidate old bindings and publish accurate epochs under the existing lifecycle exclusion. This stage must not pretend that those metadata hooks implement GPU-to-CPU ownership transfer.
  • Focused regressions for simultaneous aliases, partial ranges, reuse/remap, failed mapping and stale lease/version rejection. CPU-only/default behavior stays compatible.
  • No eager readback or comparison is skipped by this foundation alone. GPU ownership, native CPU fault publication and I/O leases require their own proven integration before suppression.

Follow-up dependency, deliberately separate from this foundation: a before-exposure CPU ownership/materialization gate outside Physical/registry locks. MapViewOfFile3 currently exposes RW bytes before the post-map notification; that race must be closed before any GPU-owned page is admitted. Separate writable section aliases make protected publication possible, but metadata versions alone are insufficient.

This is the next working stage under Snaacky/ztrx#249 toward30FPS. The preceding launch-batching experiment (#335/#358) removed about90% of maintenance dispatches but did not improve FPS, so it stays off. Target the repeated scans/roundtrip architecture instead of further small launch tuning.

Claim: Codex/krofty. Fresh checks cover both repositories. Snaacky's assigned raw-pixel issue146 and fork PRs295,194,60,55,44 remain protected; no author branch changes or merges. PR55's physical-number allocation policy is outside this stage; only lifecycle identity/notification hooks are intended. PRs stay open and unmerged. No private game data or identifiers will be published.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:6654888538 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/377). Originally posted by [krofty](https://github.com/krofty) on 2026-11-27T21:41:51Z. --- GPU ownership and selective publication require one stable identity for the bytes behind registered buffers, raw-address windows and mapped aliases. The current fork's in-place census keys physical pages by a reusable section handle and offset; it has no allocation incarnation or mapping epoch. Its mapping notification occurs after MapViewOfFile3 has exposed writable bytes. Those facts are insufficient to authorize suppressing eager hashes/readback safely. Port the already-written canonical backing identity and generation primitives from Codex's shared-storage work (Snaacky/ztrx#249) to the current NVIDIA implementation, with tightly scoped mapping/allocation hooks. Do not port its old capture implementation or assume its observed versions prove GPU ownership. Acceptance for this foundation stage: - Stable backing token, physical64KiB page identity, allocation incarnation, logical range and mapping epoch; handle/address/page reuse cannot resurrect an old binding. - Registered ranges and section aliases can resolve the same backing bytes; escaped, unknown or incomplete aliases remain explicitly unproven. - Mapping mutations invalidate old bindings and publish accurate epochs under the existing lifecycle exclusion. This stage must not pretend that those metadata hooks implement GPU-to-CPU ownership transfer. - Focused regressions for simultaneous aliases, partial ranges, reuse/remap, failed mapping and stale lease/version rejection. CPU-only/default behavior stays compatible. - No eager readback or comparison is skipped by this foundation alone. GPU ownership, native CPU fault publication and I/O leases require their own proven integration before suppression. Follow-up dependency, deliberately separate from this foundation: a before-exposure CPU ownership/materialization gate outside Physical/registry locks. MapViewOfFile3 currently exposes RW bytes before the post-map notification; that race must be closed before any GPU-owned page is admitted. Separate writable section aliases make protected publication possible, but metadata versions alone are insufficient. This is the next working stage under Snaacky/ztrx#249 toward30FPS. The preceding launch-batching experiment (#335/#358) removed about90% of maintenance dispatches but did not improve FPS, so it stays off. Target the repeated scans/roundtrip architecture instead of further small launch tuning. Claim: Codex/krofty. Fresh checks cover both repositories. Snaacky's assigned raw-pixel issue146 and fork PRs295,194,60,55,44 remain protected; no author branch changes or merges. PR55's physical-number allocation policy is outside this stage; only lifecycle identity/notification hooks are intended. PRs stay open and unmerged. No private game data or identifiers will be published.
github-actions[bot] commented 2026-11-27 21:41:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by github-actions[bot] on 2026-11-27T21:41:58Z.


Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7228676530 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/377#issuecomment-7228676530). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T21:41:58Z. --- Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
krofty commented 2026-11-27 22:12:48 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by krofty on 2026-11-27T22:12:48Z.


Implementation submitted as draft #408: https://github.com/trustno1-coder/VIctory-NVIDIA/pull/408

The isolated and exact integrated code passed26 identity tests,8 census tests,38 guard tests, real native CPU alias/store/reuse coverage, physical-window lifetime and retirement-reader exclusion. Both affected crates pass ordinary cargo check. Diagnostics build300 passed through build.sh.

Fixed-world runs321/322 with observed tracking off/on both closed normally with no reported errors. Last three host intervals:47.6/48.6/47.6ms off,47.0/46.3/48.3ms on. Pictures retain expected geometry. This is compatibility evidence, not an FPS improvement or completed-frame qualification; no readback is suppressed.

RELEASED source implementation ownership after submission. The dependent certified GPU-page ownership/selective-publication stage will use this canonical identity layer. PR408 remains open and unmerged; no30FPS claim.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7229127223 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/377#issuecomment-7229127223). Originally posted by [krofty](https://github.com/krofty) on 2026-11-27T22:12:48Z. --- Implementation submitted as draft #408: https://github.com/trustno1-coder/VIctory-NVIDIA/pull/408 The isolated and exact integrated code passed26 identity tests,8 census tests,38 guard tests, real native CPU alias/store/reuse coverage, physical-window lifetime and retirement-reader exclusion. Both affected crates pass ordinary cargo check. Diagnostics build300 passed through build.sh. Fixed-world runs321/322 with observed tracking off/on both closed normally with no reported errors. Last three host intervals:47.6/48.6/47.6ms off,47.0/46.3/48.3ms on. Pictures retain expected geometry. This is compatibility evidence, not an FPS improvement or completed-frame qualification; no readback is suppressed. RELEASED source implementation ownership after submission. The dependent certified GPU-page ownership/selective-publication stage will use this canonical identity layer. PR408 remains open and unmerged; no30FPS claim.
wildheathen commented 2026-11-28 00:26:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wildheathen on 2026-11-28T00:26:33Z.


Some measurements that may help the stage that builds on this (GPU-owned pages, publication left out). I tried the two in-place paths that are already in main and measured what a heap opened on title memory costs on a discrete card. RTX 5080 16 GB (driver 621.24), Ryzen 7 9800X3D, 32 GB, Windows 11; main 64d4931; Series X, 1440p, DLSS Quality.

In the game (same diagnostics build, the same 3-minute scripted run, texture room 50 %, no frame generation; medians in the world):

fps waiting for the card per frame private memory
default 24.9 1.8 ms 23.1 GB
VICTORY_PORT_CONSTANTS=1 (the 185 MB 32-bit heap in place) 7.8 143 ms 22.8 GB
VICTORY_INPLACE=1 (72 windows, 320 MB in place) 9.7 82 ms 22.5 GB

No device removal, but the card becomes the limit (96 % and 84 % busy) and memory does not move beyond run-to-run noise.

Why, on the card alone (a compute shader doing the same loads and one store through a root UAV, best of three):

Buffer's memory 67 M loads spread over 64 MiB 67 M loads inside 64 KiB 32 submissions of 60 small dispatches
the card's own (default heap) 1.1 ms 0.2 ms 2.1 ms
the PC's, a host copy of today's kind (custom, write-back, L0) 90 ms 12 ms 2.2-3.5 ms
in place, OpenExistingHeapFromAddress1, 64 MiB heap 93 ms 14 ms 15.6 ms
the same, 256 MiB heap 93 ms 14 ms 16.0 ms
in place on a kept view of a reserved section 93 ms 14 ms 21.3 ms

So shaders read the PC's memory 60 to 90 times slower than the card's, in place or not, and a heap in place adds about 0.4-0.6 ms to every submission that uses it, whatever its size. The constants ring and the skinning output are what shaders read most, which is why moving them out of their copy in the card's memory costs so much.

What the openings themselves do on this driver (it differs from the notes at the top of inplace.rs, which were taken on the software adapter):

  • OpenExistingHeapFromAddress1 takes a committed part of a view of ours of a section made reserved (as xmem makes the pool), so SEC_COMMIT is not needed for that path. It locks the part's pages at once (64 MiB: 15-18 ms, working set and shared GPU memory both +64 MB). Other views of the same pages can be written, made read-only and unmapped while the heap stands.
  • Opening is slow for small parts (64 KiB: 1.9 ms each, 256 KiB: 7.4 ms each with 2,048 open); a placed buffer in an open heap costs 0.003 ms.
  • OpenExistingHeapFromFileMapping on a committed section locks all of it at once (2 GiB: 112 ms, +2,048 MB working set and shared; 3 GiB: 359 ms) and refuses 4 GiB and 6 GiB (0x80070057), so the 6.09 GiB pool cannot be one heap.

From a census of the copies alive in the world (152 s): of 112 M buffer views made, 108 were off their elements; the title made about 3,300-3,600 remap/unmap calls a second, 600-750 of them on pages under a live copy; write-watch askings for copies of windows and buffers took 197 ms a second against 1.7 ms a second for textures.

My reading: on a discrete card, title memory in place cannot replace the copies in the card's memory for anything shaders read a lot; the saving to look for is in finding what changed more cheaply. The two tests are small and I can put them in a PR if they are useful (card_parts_of_a_reserved_sections_view_and_a_pool_sized_section, card_cost_of_shaders_on_memory_in_place, both ignored by default).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7230913928 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/377#issuecomment-7230913928). Originally posted by [wildheathen](https://github.com/wildheathen) on 2026-11-28T00:26:33Z. --- Some measurements that may help the stage that builds on this (GPU-owned pages, publication left out). I tried the two in-place paths that are already in `main` and measured what a heap opened on title memory costs on a discrete card. RTX 5080 16 GB (driver 621.24), Ryzen 7 9800X3D, 32 GB, Windows 11; `main` 64d4931; Series X, 1440p, DLSS Quality. **In the game** (same diagnostics build, the same 3-minute scripted run, texture room 50 %, no frame generation; medians in the world): | | fps | waiting for the card per frame | private memory | |---|---|---|---| | default | 24.9 | 1.8 ms | 23.1 GB | | `VICTORY_PORT_CONSTANTS=1` (the 185 MB 32-bit heap in place) | 7.8 | 143 ms | 22.8 GB | | `VICTORY_INPLACE=1` (72 windows, 320 MB in place) | 9.7 | 82 ms | 22.5 GB | No device removal, but the card becomes the limit (96 % and 84 % busy) and memory does not move beyond run-to-run noise. **Why, on the card alone** (a compute shader doing the same loads and one store through a root UAV, best of three): | Buffer's memory | 67 M loads spread over 64 MiB | 67 M loads inside 64 KiB | 32 submissions of 60 small dispatches | |---|---|---|---| | the card's own (default heap) | 1.1 ms | 0.2 ms | 2.1 ms | | the PC's, a host copy of today's kind (custom, write-back, L0) | 90 ms | 12 ms | 2.2-3.5 ms | | in place, `OpenExistingHeapFromAddress1`, 64 MiB heap | 93 ms | 14 ms | 15.6 ms | | the same, 256 MiB heap | 93 ms | 14 ms | 16.0 ms | | in place on a kept view of a reserved section | 93 ms | 14 ms | 21.3 ms | So shaders read the PC's memory 60 to 90 times slower than the card's, in place or not, and a heap in place adds about 0.4-0.6 ms to every submission that uses it, whatever its size. The constants ring and the skinning output are what shaders read most, which is why moving them out of their copy in the card's memory costs so much. **What the openings themselves do on this driver** (it differs from the notes at the top of `inplace.rs`, which were taken on the software adapter): - `OpenExistingHeapFromAddress1` takes a committed part of a view of ours of a section made **reserved** (as `xmem` makes the pool), so `SEC_COMMIT` is not needed for that path. It locks the part's pages at once (64 MiB: 15-18 ms, working set and shared GPU memory both +64 MB). Other views of the same pages can be written, made read-only and unmapped while the heap stands. - Opening is slow for small parts (64 KiB: 1.9 ms each, 256 KiB: 7.4 ms each with 2,048 open); a placed buffer in an open heap costs 0.003 ms. - `OpenExistingHeapFromFileMapping` on a committed section locks **all** of it at once (2 GiB: 112 ms, +2,048 MB working set and shared; 3 GiB: 359 ms) and refuses 4 GiB and 6 GiB (0x80070057), so the 6.09 GiB pool cannot be one heap. **From a census of the copies alive in the world** (152 s): of 112 M buffer views made, 108 were off their elements; the title made about 3,300-3,600 remap/unmap calls a second, 600-750 of them on pages under a live copy; write-watch askings for copies of windows and buffers took 197 ms a second against 1.7 ms a second for textures. My reading: on a discrete card, title memory in place cannot replace the copies in the card's memory for anything shaders read a lot; the saving to look for is in finding what changed more cheaply. The two tests are small and I can put them in a PR if they are useful (`card_parts_of_a_reserved_sections_view_and_a_pool_sized_section`, `card_cost_of_shaders_on_memory_in_place`, both ignored by default).
trustno1-coder commented 2026-11-28 00:44:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T00:44:09Z.


Thanks @krofty and @wildheathen, noted. I'll look at #408 when I get back to pull requests.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7231152961 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/377#issuecomment-7231152961). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T00:44:09Z. --- Thanks @krofty and @wildheathen, noted. I'll look at #408 when I get back to pull requests.
trustno1-coder commented 2026-11-29 19:51:50 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-29T19:51:50Z.


Closing this one because it was reported on a build from before v2026.11.28.03 (more than 4 releases ago) and has had no activity since v2026.11.29.01. A lot has changed since then.

If it still happens on the latest release, please open a new issue with the play log and crashes.log from that run. Thanks for reporting!

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7261619367 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/377#issuecomment-7261619367). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-29T19:51:50Z. --- Closing this one because it was reported on a build from before v2026.11.28.03 (more than 4 releases ago) and has had no activity since v2026.11.29.01. A lot has changed since then. If it still happens on the [latest release](https://github.com/trustno1-coder/VIctory-NVIDIA/releases/latest), please open a new issue with the play log and crashes.log from that run. Thanks for reporting!
Sign in to join this conversation.
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
trustno1-coder/VIctory-NVIDIA#377
No description provided.