GPU: constant buffer views of at most 64 KiB #24

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

@⁠NuraadGit on GitHub · 2026-11-24 20:22 UTC · original
NuraadGit:gpu/constant-view-64k → main · +40 −2 · 1 files · 1 commits · open

The fix I described in #5, as a PR on 1684989. The same change is Marvisak/VIctory#1640 (the code is the same there).

A constant buffer view of more than 65,536 bytes removes the host device (0x887A0001). The size from the title's descriptor went to CreateConstantBufferView as it was. The heap keeps old contents in slots the title doesn't use, and a view is made for each. In two runs on an RTX 2080 that ended that way, the last 64 views (your the host device went while buffer views of the heap were made list) included constant buffer views of 969,472 and 896,256 bytes. This caps them at 64 KiB, which is all a shader can index.

Test. an_oversized_constant_buffer_view_leaves_the_device_alive makes both sizes through make and one through constant_at, and checks the device after each. Without the cap it fails at the first ("a view of 969472 bytes"); with it, it passes. cargo test -p victory-gpu --lib on an RTX 2080: 111 passed, 1 ignored. cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.

Not shown: I haven't run the title with this yet, and a third run with the same removal had no oversized view in its list, so it may not be the only cause. A probe on the same card shows that a view not on a 256-byte address, or of a size that isn't a multiple of 256, also removes the device; make already guards against both.

AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.

**@⁠NuraadGit** on GitHub · 2026-11-24 20:22 UTC · [original](https://github.com/fxceless/victory-fork/pull/24) `NuraadGit:gpu/constant-view-64k` → `main` · +40 −2 · 1 files · 1 commits · open The fix I described in #5, as a PR on `1684989`. The same change is Marvisak/VIctory#1640 (the code is the same there). A constant buffer view of more than 65,536 bytes removes the host device (`0x887A0001`). The size from the title's descriptor went to `CreateConstantBufferView` as it was. The heap keeps old contents in slots the title doesn't use, and a view is made for each. In two runs on an RTX 2080 that ended that way, the last 64 views (your `the host device went while buffer views of the heap were made` list) included constant buffer views of 969,472 and 896,256 bytes. This caps them at 64 KiB, which is all a shader can index. **Test.** `an_oversized_constant_buffer_view_leaves_the_device_alive` makes both sizes through `make` and one through `constant_at`, and checks the device after each. Without the cap it fails at the first ("a view of 969472 bytes"); with it, it passes. `cargo test -p victory-gpu --lib` on an RTX 2080: 111 passed, 1 ignored. `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean. **Not shown:** I haven't run the title with this yet, and a third run with the same removal had no oversized view in its list, so it may not be the only cause. A probe on the same card shows that a view not on a 256-byte address, or of a size that isn't a multiple of 256, also removes the device; `make` already guards against both. AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.
The host removes the device for a constant buffer view of more than 65,536
bytes. The title's view heap holds larger sizes in slots it does not use,
and the size went to the host as it was.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:34:49 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 20:22 UTC · original · edited 2026-11-24 20:24 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-24T20:24:32.214968Z 1d2f476 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-24 20:22 UTC · [original](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7143455524) · edited 2026-11-24 20:24 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"1d2f4763029c3e488cfeafada1d9e1d8aa3a3dbc","has_any_findings":false,"has_unresolved_findings":false,"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-24T20:24:32.214968Z">2026-11-24T20:24:32.214968Z</relative-time> | `1d2f476` | 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

@⁠rafaconvaitis on GitHub · 2026-11-24 20:45 UTC · original

Independent Windows 11 result on an RTX 4070 (driver 32.0.16.1664), Series X mode, pinned 578d459 with local adapter selection and test input. One run reached the lit prologue and later reported DXGI_ERROR_INVALID_CALL (0x887A0001) during the buffer-view mirror pass. The last 64 sampled views included an aligned CBV of 1,228,032 bytes. At removal, 105,231 submissions had started and finished, with no submission in flight. The sample does not identify which creation call triggered removal.

In a synthetic D3D12 WARP probe with the debug layer, the same aligned, 1,228,032-byte backing allocation left the device at S_OK with a 65,536-byte view. Asking for a 1,228,032-byte view produced message 650 and 0x887A0001 before any GPU submission. That corroborates the API failure at the observed size. A separate 30m56s run without this PR reached controllable gameplay and had neither device removal nor message 650. I have not tested the cap from this PR in the title. The in-title trigger remains unconfirmed.

AI-assisted capture and log analysis. No title data attached.

**@⁠rafaconvaitis** on GitHub · 2026-11-24 20:45 UTC · [original](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7144016878) Independent Windows 11 result on an RTX 4070 (driver 32.0.16.1664), Series X mode, pinned `578d459` with local adapter selection and test input. One run reached the lit prologue and later reported `DXGI_ERROR_INVALID_CALL` (`0x887A0001`) during the buffer-view mirror pass. The last 64 sampled views included an aligned CBV of 1,228,032 bytes. At removal, 105,231 submissions had started and finished, with no submission in flight. The sample does not identify which creation call triggered removal. In a synthetic D3D12 WARP probe with the debug layer, the same aligned, 1,228,032-byte backing allocation left the device at `S_OK` with a 65,536-byte view. Asking for a 1,228,032-byte view produced message 650 and `0x887A0001` before any GPU submission. That corroborates the API failure at the observed size. A separate 30m56s run without this PR reached controllable gameplay and had neither device removal nor message 650. I have not tested the cap from this PR in the title. The in-title trigger remains unconfirmed. AI-assisted capture and log analysis. No title data attached.
Author
Owner

@⁠NuraadGit on GitHub · 2026-11-24 20:50 UTC · original

In-title result for this, on an RTX 2080 (7b0f736 + this change + a diagnostics-only present log, no loop limit, Series X profile).

  • One session of 17 min 42 s (frame 3,822), ended by me, with 0 device removals.
  • 3 min 15 s in, the cap cut a view of 955,136 bytes at 0x7fe8ba580000. The line is logged once per run, so later ones would not show.
  • Before this change, three runs here ended in 0x887A0001 about 5 to 6.5 minutes after launch, two of them with a view like this among the 64 made last. The probe (in Marvisak/VIctory#1640) shows that making one removes the device.

It is one session, so it shows that such a view does turn up in the title and that the device stays, not how often the old build would have ended.

AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.

**@⁠NuraadGit** on GitHub · 2026-11-24 20:50 UTC · [original](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7144129713) In-title result for this, on an RTX 2080 (`7b0f736` + this change + a diagnostics-only present log, no loop limit, Series X profile). - One session of 17 min 42 s (frame 3,822), ended by me, with 0 device removals. - 3 min 15 s in, the cap cut a view of 955,136 bytes at `0x7fe8ba580000`. The line is logged once per run, so later ones would not show. - Before this change, three runs here ended in `0x887A0001` about 5 to 6.5 minutes after launch, two of them with a view like this among the 64 made last. The probe (in Marvisak/VIctory#1640) shows that making one removes the device. It is one session, so it shows that such a view does turn up in the title and that the device stays, not how often the old build would have ended. AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.
Author
Owner

@⁠adriaespii on GitHub · 2026-11-24 21:04 UTC · original

Independent test run on commit 1d2f476 (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 497 passed, 0 failed, 7 ignored (victory-gpu: 111 passed, 0 failed, 1 ignored; victory-shader: 210 passed, 0 failed, 2 ignored)
  • Not tested: live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

**@⁠adriaespii** on GitHub · 2026-11-24 21:04 UTC · [original](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7144433612) Independent test run on commit `1d2f476` (AMD RDNA4): - **Hardware:** AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (`x86_64-pc-windows-msvc`) - `cargo clippy --workspace --all-targets -- -D warnings`: 0 warnings - `cargo test --workspace`: 497 passed, 0 failed, 7 ignored (`victory-gpu`: 111 passed, 0 failed, 1 ignored; `victory-shader`: 210 passed, 0 failed, 2 ignored) - **Not tested:** live game run (no game files on this machine) *AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.*
Author
Owner

@⁠arminkhaleghirod on GitHub · 2026-11-24 21:18 UTC · original

Ran the game with this (1d2f476) on an RTX 4080, Windows 11, Series X profile, default settings. 5.5 min from boot into the opening cutscene. No device loss, no 0x887A0001. 0.7–1.8 fps in the cutscene.

**@⁠arminkhaleghirod** on GitHub · 2026-11-24 21:18 UTC · [original](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7144750716) Ran the game with this (1d2f476) on an RTX 4080, Windows 11, Series X profile, default settings. 5.5 min from boot into the opening cutscene. No device loss, no `0x887A0001`. 0.7–1.8 fps in the cutscene.
Author
Owner

@⁠Aminou973 on GitHub · 2026-11-24 22:20 UTC · original

Confirmed on an RTX 3080 10 GB (Windows 11, driver 621.14). Without this change the device is removed with INVALID_CALL at frames 2,498 and 3,387 (debug layer: CreateConstantBufferView: Size of 2785536 exceeds maximum constant buffer view size). With the same clamp there is no removal over 3,400–4,400 frames and the prologue renders (details in #72). AI-assisted.

**@⁠Aminou973** on GitHub · 2026-11-24 22:20 UTC · [original](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7146117283) Confirmed on an RTX 3080 10 GB (Windows 11, driver 621.14). Without this change the device is removed with `INVALID_CALL` at frames 2,498 and 3,387 (debug layer: `CreateConstantBufferView: Size of 2785536 exceeds maximum constant buffer view size`). With the same clamp there is no removal over 3,400–4,400 frames and the prologue renders (details in #72). AI-assisted.
Author
Owner

@⁠ericomeehan on GitHub · 2026-11-24 23:28 UTC · original

The evidence in this thread is unusually strong: four cards with before/after runs, and the debug layer naming the oversized view, so the cause looks settled.

One small test thing: in an_oversized_constant_buffer_view_leaves_the_device_alive, the three constant_bytes asserts come after the let Some(host) = host() else { return; } early return, so on a machine without a GPU (CI runners, for one) the test passes without checking the rounding at all. A separate CPU-only test for constant_bytes (480 → 512, 64 KiB → 64 KiB, u32::MAX → 64 KiB) would get those checked everywhere. The same applies to the port in Marvisak/VIctory#1640.

Written with an AI assistant (Claude).

**@⁠ericomeehan** on GitHub · 2026-11-24 23:28 UTC · [original](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7147435298) The evidence in this thread is unusually strong: four cards with before/after runs, and the debug layer naming the oversized view, so the cause looks settled. One small test thing: in `an_oversized_constant_buffer_view_leaves_the_device_alive`, the three `constant_bytes` asserts come after the `let Some(host) = host() else { return; }` early return, so on a machine without a GPU (CI runners, for one) the test passes without checking the rounding at all. A separate CPU-only test for `constant_bytes` (480 → 512, 64 KiB → 64 KiB, `u32::MAX` → 64 KiB) would get those checked everywhere. The same applies to the port in Marvisak/VIctory#1640. Written with an AI assistant (Claude).
Author
Owner

@⁠tippythetaidum on GitHub · 2026-11-25 11:52 UTC · original

Test report on current main (f85101b), RTX 5080 16 GB, driver 621.14, Windows 11, Series X profile, diagnostics build, default settings (so the relay is on).

Without this change, f85101b loses the device at world entry here: 2 runs of 2.

Run Tree Result
A f85101b device removed (0x887A0001) 2 min 1 s after launch, as the opening cutscene starts; "the host device went while buffer views of the heap were made"
B f85101b, VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1 device removed 2 min 10 s after launch; the debug layer's last message before RemoveDevice is the one below
C f85101b + this PR's commit cherry-picked (applies clean) full 11 min (stopped by my timeout), 80,000+ submissions, 4,037 frames, 0 device removals, through the opening cutscene into the prison interior

Run B, the two lines in order:

D3D12: ID3D12Device::CreateConstantBufferView: Size of 1406720 exceeds maximum constant buffer view size of 65536. id=650 severity=1
D3D12: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_INVALID_CALL: ...). id=232 severity=1

Note for anyone reading run A's kind of log: the list of the last 64 views in the "buffer views of the heap were made" error did not contain the oversized view (its largest Constant was 480 bytes), so that list alone can miss the cause; the debug layer names it.

an_oversized_constant_buffer_view_leaves_the_device_alive passes on this card with the commit on f85101b.

Not shown: runs A and C each ran once at default settings. All three trees also carried a local diagnostics-only counter of mine (it reads the lists' copy steps and does not touch descriptor views). Frame rate in run C's last five minutes: median 4.6 fps in 5-second readings (diagnostics build).

AI-assisted (Claude Code): runs, log reading and this text. Counts and log lines only, nothing from the game attached.

**@⁠tippythetaidum** on GitHub · 2026-11-25 11:52 UTC · [original](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7161622144) Test report on current `main` (`f85101b`), RTX 5080 16 GB, driver 621.14, Windows 11, Series X profile, diagnostics build, default settings (so the relay is on). **Without this change, `f85101b` loses the device at world entry here: 2 runs of 2.** | Run | Tree | Result | |---|---|---| | A | `f85101b` | device removed (`0x887A0001`) 2 min 1 s after launch, as the opening cutscene starts; "the host device went while buffer views of the heap were made" | | B | `f85101b`, `VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1` | device removed 2 min 10 s after launch; the debug layer's last message before `RemoveDevice` is the one below | | C | `f85101b` + this PR's commit cherry-picked (applies clean) | full 11 min (stopped by my timeout), 80,000+ submissions, 4,037 frames, **0 device removals**, through the opening cutscene into the prison interior | Run B, the two lines in order: ``` D3D12: ID3D12Device::CreateConstantBufferView: Size of 1406720 exceeds maximum constant buffer view size of 65536. id=650 severity=1 D3D12: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_INVALID_CALL: ...). id=232 severity=1 ``` Note for anyone reading run A's kind of log: the list of the last 64 views in the "buffer views of the heap were made" error did not contain the oversized view (its largest `Constant` was 480 bytes), so that list alone can miss the cause; the debug layer names it. `an_oversized_constant_buffer_view_leaves_the_device_alive` passes on this card with the commit on `f85101b`. Not shown: runs A and C each ran once at default settings. All three trees also carried a local diagnostics-only counter of mine (it reads the lists' copy steps and does not touch descriptor views). Frame rate in run C's last five minutes: median 4.6 fps in 5-second readings (diagnostics build). AI-assisted (Claude Code): runs, log reading and this text. Counts and log lines only, nothing from the game attached.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.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/24/head:github-bot/gh-24'
git switch 'github-bot/gh-24'

Merge

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