Skip to content

GPU: a command queue's SuspendX and ResumeX succeed - #3225

Open
JurajSimicevic wants to merge 1 commit into
Marvisak:mainfrom
JurajSimicevic:queue/suspend-resume
Open

JurajSimicevic wants to merge 1 commit into
Marvisak:mainfrom
JurajSimicevic:queue/suspend-resume

Conversation

@JurajSimicevic

Copy link
Copy Markdown

Problem

When the title is suspended (window close, or a relaunch through lifecycle::end_title), Grand Theft Auto VI's suspend routine calls the command queue's SuspendX(0) at slot 0xb8. Nothing is written there, so every suspend logs method not implemented object="command queue" slot=0xb8 and the call returns E_NOTIMPL. #1080 noted it and left it as a follow-up. queue.rs already names 0xb8/0xc0 as suspend and resume, from the title's calls.

Change

  • SuspendX(flags) and ResumeX() return S_OK. On the console, a suspend stops the queue's GPU work and ResumeX restarts it (Microsoft's public GDK sample DeviceResourcesGXDK.cpp calls SuspendX(0) on suspend and ResumeX() on resume). Here there is nothing to stop. Our submissions have run when Execute returns, work held for a wait runs as soon as the wait is met, and a suspended title is never resumed, because the process ends.
  • METHODS gets them at 0xa8/0xb0 in the older layout, so newer_slot puts them at 0xb8/0xc0, where Grand Theft Auto VI calls them.
  • New test queue::tests::queues_suspend_and_resume: the slots in both layouts, and both calls through a queue's own table return S_OK.

crates/victory-gpu/src/queue.rs only.

Tested

  • cargo test -p victory-gpu --lib queue::: 6 passed, among them the new test.
  • cargo test --workspace --locked: 569 passed. On this card (RTX 5080) two tests of victory-gpu fail, as they do on main on every NVIDIA host: dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views (the 1,000,000-view cap; GPU and shaders: a host that caps its view heaps gets heaps at its ca… #2461 and GPU: view heaps on hosts capped below 2^21 descriptors #1779 address it). The victory-shader test binary exits with STATUS_ACCESS_VIOLATION while its tests run in parallel. That crate doesn't depend on victory-gpu and is the same as on main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with --all-features: clean. No new rustfmt hunks.
  • In the title: RTX 5080, diag build of main 63bcca4 with this change, RUST_LOG=info,victory_gpu::queue=debug. The window was closed at the menu:
13:41:22.921  lifecycle: window closed: suspending the title constrained=1 routines=2
13:41:23.022  queue: command queue suspended flags=0
13:41:23.023  lifecycle: title suspended; ending the title

No method not implemented line for the command queue. The title calls SuspendX once, 0.1 s after the close, and finishes suspending right after.

In the world at 0.5 fps it doesn't get that far. In my earlier runs on main, the title reached this call only after the 1 s deadline in lifecycle.rs had passed (title did not finish suspending in time, then the slot=0xb8 line). There, this change makes no difference.

Claim: #1633 (#1633 (comment)).

No game data: log lines and counts only.

AI-assisted.

🤖 Generated with Claude Code

Grand Theft Auto VI's suspend routine calls the command queue's
SuspendX(0) at 0xb8, which had no method: every window close or
relaunch logged "method not implemented" for the command queue and the
call answered E_NOTIMPL (noted in Marvisak#1080). SuspendX and ResumeX now
succeed. On the console they stop and restart the queue's GPU work; here
submissions have run when Execute returns, work held for a wait runs
once the wait is met, and a suspended title is never resumed, so there
is nothing to stop.

They sit at 0xa8/0xb0 in the older queue layout, so newer queues have
them at 0xb8/0xc0, where the title calls them.

New test: queue::tests::queues_suspend_and_resume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on RTX 5090 against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib queue:: -- --test-threads=1: 6/6 passed (including queues_suspend_and_resume).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly implements SuspendX and ResumeX on command queues.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

vanya890 added a commit to vanya890/VIctory that referenced this pull request Nov 26, 2026
Import upstream Marvisak#3225: implement queue SuspendX and ResumeX
@oni-swr

oni-swr commented Nov 26, 2026

Copy link
Copy Markdown

WARP verification at head db63d1f2 (main 63bcca43 as control).

  • New test queue::tests::queues_suspend_and_resume: passes on the head.
  • Full victory-gpu lib suite on the head: 247 passed, 1 ignored in 4 of 5 runs. In the other run, descriptor::host::tests::a_slot_rewritten_while_its_view_is_prepared_views_the_new_record failed once (it passed in the next 3 runs). This PR only touches queue.rs, so I read it as a flake in an unrelated test, not something this PR causes. I did not chase it. Main passed 246 of 246 in 3 of 3 runs.
  • Control: main's code with the test's behaviour part only (slot calls at 0xa8/0xb0 and 0xb8/0xc0; the symbol-identity asserts can't build on main) fails: SuspendX returns E_NOTIMPL (-2147467263) instead of S_OK.

Software adapter (WARP, Microsoft Basic Render Driver), not a physical GPU. Synthetic tests only, no game files. Run with VICTORY_WARP=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib --features diagnostics -j 4 and dxil.dll available. Test report only, no code changes.

AI-assisted: verification by Claude Code (Claude Sonnet 5.5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants