GPU diagnostics: DRED command notes call VirtualQuery per draw, world frames ~10x slower (fix on a fork) #913
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#913
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Vaximous on GitHub · 2026-11-24 14:02 UTC · original
Diagnostics-only: this affects only
--features diagnosticsbuilds that run with device-removed data on.Problem
With DRED command notes on, world frames took 9-12 s instead of under 1 s. Most of the recording threads' time went to
VirtualQuery.Cause:
describeincrates/victory-gpu/src/draw.rsruns for every draw and dispatch (throughop_text→reads). For a constant view, it first askstexture::committed, which usesVirtualQuery, before it reads 16 bytes. In the title's big pools each query walks the region's pages, about 1 ms per call, and a world frame makes thousands of them.Fix
first_wordsreads the 16 bytes withhost::read_into(ReadProcessMemory). That call fails on an unmapped page and does not walk the region. Output is unchanged. One file,crates/victory-gpu/src/draw.rs, +15/-3, all inside#[cfg(feature = "diagnostics")].Branch
https://github.com/Vaximous/VIctory/compare/main...fix/dred-notes-readprocessmemory — commit f4b6a96, based on
ffe310e.Tested
cargo test -p victory-gpu --features diagnostics: 53 passed, 0 failed, 1 ignored. Clippy-D warningsis clean with and withoutdiagnostics.VirtualQuery, and frames took 9-12 s. WithReadProcessMemoryinstead, frames were back under 1 s. Main only has the constant-view path, so the gain there may be smaller.Related
texture::committedis also used on hot non-diagnostic paths (host.rs,list.rs), and #322, #388 and #119 remove region queries there. This issue is only about the DRED note.AI use
Written with Claude Code (Claude Opus 5.5); tested locally.
@MichaelSmithAI on GitHub · 2026-11-24 14:05 UTC · original
On a #898-based integration, the Wine 11.22 formatter test passed with #913. A backed 16-byte constant view retained its exact four-float text, including negative zero. A 12-byte view kept the existing short description. The production diff also applies cleanly to all 16 source revisions used for our #898 comparison builds. Only the one integration ran the formatter test.
The 9–12 s to under 1 s frame-time result remains specific to your Windows integration, which also inspected placed buffer views. We have no local title timing for the constant-view-only change.
@Marvisak on GitHub · 2026-11-25 06:51 UTC · original
Automated triage for the maintainers.
Confirmed on current
main: incrates/victory-gpu/src/draw.rs, the diagnostics description of a view (thesmallclosure used for DRED command notes) callscrate::texture::committedbefore reading up to 64 bytes of title memory, once per described view on every draw and dispatch. How much that costs on plainmainis not measured; the 9–12 s frames were on an integration build that also describes placed buffer views. I found no open pull request forf4b6a96; pull requests are open to everyone now, so please open one against currentmain.Generated by Claude Code
@BaggyALPHA on GitHub · 2026-11-26 06:57 UTC · original
Three things on this, measured on
main63bcca4: the case this issue names is already fixed upstream, a sibling call still is not, and on this card device-removed data does not merely slow the run — it reliably hangs the device. The remainingVirtualQuerycall is not the cause of that.RTX 3080 (Ampere) / Windows 11, release build with
--features diagnostics, keyless start-up,VICTORY_LOG=info.1. The constant-view case is fixed on
maindescribeno longer asksVirtualQueryfor a constant view's first 16 bytes; it reads them through the kernel, with a comment giving this issue's reasoning:git log -Sputs that in6d021fe("GPU: world frame cost"). So the fork branch here (f4b6a96, based onffe310e) now conflicts withmainin exactly that hunk and is redundant for the case it targets.2. A sibling call in the same function still goes through
VirtualQueryThe
smallclosure in the samedescribe, for buffers of 64 bytes or less (exposure, counters), still asks first:That is
crates/victory-gpu/src/draw.rs:1964on63bcca4, and it runs per draw like the other one, so the pattern this issue describes is not fully gone.3. With device-removed data on, this card does not slow down — it hangs
This is the part I did not expect, and it is not in the issue:
VICTORY_LOG=infoonly+ VICTORY_D3D12_DRED=1Every removal is
0x887A0006("the GPU will not respond to more commands"), with noE_OUTOFMEMORYanywhere in any log. Same build, same card, same keyless path; the only difference is the switch. Without it the run presents 4,096 frames in ~142 s; with it the device is gone inside ~75 s. Device-removed data also costs 4-6 GB of commit here, which on a 32 GB box is not nothing.What is not the cause
I assumed the surviving call in (2) explained (3) and tested it rather than posting it: patching that
smallclosure to read through the kernel too, exactly as the constant-view case now does, does not help — 2 runs out of 2 still hang, at frames 1,225 and 1,267, with commit 23.6-23.8 GB. So on this card the dominant cost of device-removed data is somewhere else: the remaining per-draw note building, or D3D12's own auto-breadcrumb and page-fault tracking. I have not identified it, and I would rather say so than name a culprit I have not shown.Why it matters beyond performance
Hang reports in this project are routinely gathered with
VICTORY_D3D12_DRED=1on, because that is what names the stopped command. On this configuration that switch is the difference between a run that completes and a run whose device is removed, so a hang observed with it on may not be the hang a user hits without it. That does not make existing reports wrong — they are mostly in the world, far deeper than anything above, and many report the hang with DRED off as well. It does mean the switch belongs in the environment list of a hang report, and that a report where the hang appears only with DRED on is worth re-running without it.Not claimed: no world run (keyless start-up reaches an early screen at about 13 draws a frame, nowhere near the world), no profiling of where the time actually goes, and one card and driver only.
Counts, timings and code references only; no game files, no program hashes or paths. AI-assisted (Claude Code); all runs as described on this host.
@BaggyALPHA on GitHub · 2026-11-26 07:04 UTC · original · edited 2026-11-26 07:28 UTC
Correcting my comment above within the hour: device-removed data is not what hangs this card. I wrote that "the only difference is the switch", and that was wrong — a run with it off hangs too, once host commit gets as high. The variable is memory, not the diagnostic.
What broke the claim: the next run I did was
main63bcca4withVICTORY_D3D12_DRED=1unset, and it was removed at a peak commit of 23,599 MB. So I went back over every run of the title I have on this host and tabulated peak process commit against the outcome.0x887A0006)Separation is complete, with a 153 MB gap between the highest run that completed and the lowest that did not, and the switch sits on both sides of it: two of the seven removals had device-removed data off (18,722 MB and 23,599 MB), five had it on. Device-removed data does cost 4-6 GB of commit here, which is a real finding for this issue, but its role in the removals was to carry runs over that line, not to cause them.
So the useful part of my earlier comment is the memory cost; the causal claim about hangs should be struck. Apologies for the noise — I posted it on a 13-against-3 split without the one arm that would have tested it.
What the corrected picture does and does not support.
2/2,3/3,18/18) and noE_OUTOFMEMORYin any log, on either side of the line.Still true from the earlier comment, and unaffected: the constant-view case this issue names is fixed on
mainin6d021fe, so the fork branch conflicts there and is redundant for it; thesmallclosure atdraw.rs:1964still asksVirtualQueryper draw; and patching that out does not stop the removals (2 runs of 2 still removed), so it is not the dominant cost on this card.And the practical note I would still make to anyone diagnosing a hang, in a weaker form than I first put it: device-removed data costs several GB of commit, so on a memory-constrained host it can move a run across the line above. Worth recording the switch and the peak commit in a hang report, not because the switch causes hangs, but because it changes how close the run is to that boundary.
Counts and timings only; no game files, no program hashes or paths. AI-assisted (Claude Code); all 27 runs on this host, RTX 3080 / Windows 11.
Edit, later the same day — two fixes, both against me:
What stands from this comment: device-removed data costs 4-6 GB of commit here, it is not what causes the removals, the constant-view case is fixed on
mainin6d021fe, and thesmallclosure atdraw.rs:1964still asksVirtualQueryper draw.