GPU: cap command lists per submission (VICTORY_SUBMIT_MAX_RUNS) #1462

Open
Bebrik229 wants to merge 1 commit from upstream-pr/1463 into main
Bebrik229 commented 2026-11-24 18:13:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bebrik229 on 2026-11-24T18:13:32Z.


A title frame's runs go to the queue in one ExecuteCommandLists call and the host waits on the fence, so a batch of heavy compute work stalls the device for its whole duration: on an RTX 5070 a 28-list batch held the GPU for ~63 s and Windows removed the device (0x887A0006) after the ~2 s reset threshold, ending the run.

VICTORY_SUBMIT_MAX_RUNS splits the batch into chunks of runs, keeping each submission's worst-case GPU time bounded; the default keeps every run in one call as before. The per-list timing path (VICTORY_GPU_TIMING) still submits each run on its own.

Observed on the Grand Theft Auto VI title: a deterministic 28-run batch of compute lists took 63 s on the GPU and removed the device twice; with the cap at 4 the same content submits in bounded chunks.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6588407116 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1463). Originally posted by [Bebrik229](https://github.com/Bebrik229) on 2026-11-24T18:13:32Z. --- A title frame's runs go to the queue in one `ExecuteCommandLists` call and the host waits on the fence, so a batch of heavy compute work stalls the device for its whole duration: on an RTX 5070 a 28-list batch held the GPU for ~63 s and Windows removed the device (0x887A0006) after the ~2 s reset threshold, ending the run. `VICTORY_SUBMIT_MAX_RUNS` splits the batch into chunks of runs, keeping each submission's worst-case GPU time bounded; the default keeps every run in one call as before. The per-list timing path (`VICTORY_GPU_TIMING`) still submits each run on its own. Observed on the Grand Theft Auto VI title: a deterministic 28-run batch of compute lists took 63 s on the GPU and removed the device twice; with the cap at 4 the same content submits in bounded chunks.
pfhandler commented 2026-11-24 21:03:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pfhandler on 2026-11-24T20:50:18Z.


Local patches for two issues hit while running GTA VI 1.0.2.1 through VIctory on Linux (GE-Proton 11-14, vkd3d-proton 3.2.0, RTX 4060 Ti 8 GB):

  • VICTORY_NO_HOST_PAD=1 — a connected host pad (e.g. DualShock appearing as XInput pad 0) keeps the keyboard stand-in pad from being enumerated. Hiding the host pad lets VICTORY_KEYS drive the title again.
  • VICTORY_MODE=1920x1080 — the DXGI output mode list is fixed at the console's 3840x2160. Reporting 1920x1080 instead keeps the title's render targets and VRAM use down on smaller hosts (Series S profile + 1080p settled around 3.5 GB VRAM here).

Both are local uncommitted diffs, posted here for reuse. Tested only on the configuration above.

diff --git a/crates/victory-gpu/src/dxgi.rs b/crates/victory-gpu/src/dxgi.rs
index c7f7c45..2535b68 100644
--- a/crates/victory-gpu/src/dxgi.rs
+++ b/crates/victory-gpu/src/dxgi.rs
@@ -219,6 +219,19 @@ struct Mode {
 }
 const _: () = assert!(size_of::<Mode>() == 32);
 
+/// The console's fixed output mode, overridable for hosts smaller than the
+/// console's 4K target: `VICTORY_MODE=1920x1080` reports that instead.
+fn mode_size() -> (u32, u32) {
+    const DEFAULT: (u32, u32) = (3840, 2160);
+    let Some(text) = std::env::var_os("VICTORY_MODE") else {
+        return DEFAULT;
+    };
+    let text = text.to_string_lossy();
+    text.split_once('x')
+        .and_then(|(w, h)| Some((w.trim().parse().ok()?, h.trim().parse().ok()?)))
+        .unwrap_or(DEFAULT)
+}
+
 /// The console's mode list: one 4K mode at 60 Hz (Grand Theft Auto VI looks
 /// for a 120 Hz one to allow 120 Hz frame intervals).
 /// shortcut: fixed mode, not the host display's; report the host's rates if
@@ -242,9 +255,10 @@ extern "system" fn modes(
         return MORE_DATA;
     }
     *count = 1;
+    let (width, height) = mode_size();
     let mode = Mode {
-        width: 3840,
-        height: 2160,
+        width,
+        height,
         refresh: [60, 1],
         format: 0,
         scanlines: 1, // progressive
diff --git a/crates/victory-hle/src/modules/gameinput.rs b/crates/victory-hle/src/modules/gameinput.rs
index a411bd0..da8d66c 100644
--- a/crates/victory-hle/src/modules/gameinput.rs
+++ b/crates/victory-hle/src/modules/gameinput.rs
@@ -1134,6 +1134,11 @@ mod host {
 
     impl Source for Host {
         fn pad(&mut self, slot: usize) -> Option<PadState> {
+            // The keyboard stand-in pad only exists while no host pad is
+            // connected; this hides a host pad the title mis-handles.
+            if std::env::var_os("VICTORY_NO_HOST_PAD").is_some() {
+                return None;
+            }
             if self.empty_until[slot].is_some_and(|until| Instant::now() < until) {
                 return None;
             }
<!-- greyfinch-sync:Marvisak/VIctory:comment:7144123348 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1463#issuecomment-7144123348). Originally posted by [pfhandler](https://github.com/pfhandler) on 2026-11-24T20:50:18Z. --- Local patches for two issues hit while running GTA VI 1.0.2.1 through VIctory on Linux (GE-Proton 11-14, vkd3d-proton 3.2.0, RTX 4060 Ti 8 GB): - `VICTORY_NO_HOST_PAD=1` — a connected host pad (e.g. DualShock appearing as XInput pad 0) keeps the keyboard stand-in pad from being enumerated. Hiding the host pad lets `VICTORY_KEYS` drive the title again. - `VICTORY_MODE=1920x1080` — the DXGI output mode list is fixed at the console's 3840x2160. Reporting 1920x1080 instead keeps the title's render targets and VRAM use down on smaller hosts (Series S profile + 1080p settled around 3.5 GB VRAM here). Both are local uncommitted diffs, posted here for reuse. Tested only on the configuration above. ```diff diff --git a/crates/victory-gpu/src/dxgi.rs b/crates/victory-gpu/src/dxgi.rs index c7f7c45..2535b68 100644 --- a/crates/victory-gpu/src/dxgi.rs +++ b/crates/victory-gpu/src/dxgi.rs @@ -219,6 +219,19 @@ struct Mode { } const _: () = assert!(size_of::<Mode>() == 32); +/// The console's fixed output mode, overridable for hosts smaller than the +/// console's 4K target: `VICTORY_MODE=1920x1080` reports that instead. +fn mode_size() -> (u32, u32) { + const DEFAULT: (u32, u32) = (3840, 2160); + let Some(text) = std::env::var_os("VICTORY_MODE") else { + return DEFAULT; + }; + let text = text.to_string_lossy(); + text.split_once('x') + .and_then(|(w, h)| Some((w.trim().parse().ok()?, h.trim().parse().ok()?))) + .unwrap_or(DEFAULT) +} + /// The console's mode list: one 4K mode at 60 Hz (Grand Theft Auto VI looks /// for a 120 Hz one to allow 120 Hz frame intervals). /// shortcut: fixed mode, not the host display's; report the host's rates if @@ -242,9 +255,10 @@ extern "system" fn modes( return MORE_DATA; } *count = 1; + let (width, height) = mode_size(); let mode = Mode { - width: 3840, - height: 2160, + width, + height, refresh: [60, 1], format: 0, scanlines: 1, // progressive diff --git a/crates/victory-hle/src/modules/gameinput.rs b/crates/victory-hle/src/modules/gameinput.rs index a411bd0..da8d66c 100644 --- a/crates/victory-hle/src/modules/gameinput.rs +++ b/crates/victory-hle/src/modules/gameinput.rs @@ -1134,6 +1134,11 @@ mod host { impl Source for Host { fn pad(&mut self, slot: usize) -> Option<PadState> { + // The keyboard stand-in pad only exists while no host pad is + // connected; this hides a host pad the title mis-handles. + if std::env::var_os("VICTORY_NO_HOST_PAD").is_some() { + return None; + } if self.empty_until[slot].is_some_and(|until| Instant::now() < until) { return None; } ```
mercuryVM commented 2026-11-24 23:04:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T22:49:47Z.

Review: APPROVED


Tested 68f23d9 on Windows 11, RTX 5070, MSVC: builds, cargo test --workspace --no-fail-fast 644 passed, 0 failed (on our fork main), clippy -D warnings clean with and without --all-features.

  • With VICTORY_SUBMIT_MAX_RUNS unset, max_submit_runs() is usize::MAX, so bounds.chunks yields one group covering every list. The default submission is exactly as before.
  • Chunk boundaries come from firsts, so each run's prelude stays in the same ExecuteCommandLists call as its list. Splitting between runs is a configuration the VICTORY_GPU_TIMING path already exercises, including the state decay between calls.
  • Good catch gating the slow-group report on timing(). It indexes runs[i] by group, which only lines up when there is one run per group.
  • Nit: an unparseable value silently means "all". A one-time tracing::warn! for a set but invalid VICTORY_SUBMIT_MAX_RUNS would save a confused run.

Merged into our fork's main.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6048627453 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1463#pullrequestreview-6048627453). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T22:49:47Z. **Review:** APPROVED --- Tested 68f23d9 on Windows 11, RTX 5070, MSVC: builds, `cargo test --workspace --no-fail-fast` 644 passed, 0 failed (on our fork main), clippy `-D warnings` clean with and without `--all-features`. - With `VICTORY_SUBMIT_MAX_RUNS` unset, `max_submit_runs()` is `usize::MAX`, so `bounds.chunks` yields one group covering every list. The default submission is exactly as before. - Chunk boundaries come from `firsts`, so each run's prelude stays in the same `ExecuteCommandLists` call as its list. Splitting between runs is a configuration the `VICTORY_GPU_TIMING` path already exercises, including the state decay between calls. - Good catch gating the slow-group report on `timing()`. It indexes `runs[i]` by group, which only lines up when there is one run per group. - Nit: an unparseable value silently means "all". A one-time `tracing::warn!` for a set but invalid `VICTORY_SUBMIT_MAX_RUNS` would save a confused run. Merged into our fork's main. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 02:06:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:29:04Z.


Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-gpu/src/host.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149598047 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1463#issuecomment-7149598047). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:29:04Z. --- <!-- victory-triage v1 head=68f23d9e41f9bfb1b1d1ba58d20efb7d4384f892 verdict=needs-rebase at=2026-11-25T01:29:02Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-gpu/src/host.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1463:upstream-pr/1463'
git switch 'upstream-pr/1463'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1463'
git switch 'upstream-pr/1463'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1463'
git switch 'upstream-pr/1463'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1463'
git switch 'main'
git merge --squash 'upstream-pr/1463'
git switch 'main'
git merge --ff-only 'upstream-pr/1463'
git switch 'main'
git merge 'upstream-pr/1463'
git push origin 'main'
Sign in to join this conversation.
No reviewers
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
Marvisak/VIctory!1462
No description provided.