GPU: queries run on the host GPU #3138
No reviewers
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!3138
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3138"
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?
@FoxxoOwO on GitHub · 2026-11-26 09:52 UTC · original
FoxxoOwO:gpu/queries-host-2→main· +267 −25 · 5 files · 2 commits · openReplaces #2354, which no longer merges (conflict in
crates/victory-gpu/src/host.rs) and had the timestamp overflow from its review. Rebased ontomain63bcca4.Rebase. Both sides added a field to
Deferred(waitsfrom main,resolveshere), so both are kept.Timestamp fix (the review's finding).
crates/victory-gpu/src/host.rsscaled withat.saturating_mul(TIMESTAMP_FREQUENCY) / host, and both reviewed tick counts overflow u64 before the division, so every guest timestamp came out identical. Scaling now goes throughtitle_ticks(at, host_hz)in u128:timestamps_scale_to_the_title_clockpins both intervals from the review: 26,509,312 ticks on a 1 GHz host → 2,650,931, and 254,637 on a 10 MHz host → 2,546,370, plus a zero frequency.The README row no longer lists real queries as missing.
@steven-seagull27 on GitHub · 2026-11-26 10:40 UTC · original · edited 2026-11-26 10:47 UTC
I ran a guest timestamp heap through
EndQueryandResolveQueryDataon native Windows. Both the RTX 5080 and inbox WARP rejected the command list atCloseon1a7750b7in two runs each. With the D3D12 debug layer enabled, the error was0x80070057, “Query type does not match query heap type.” The test stopped before submitting that list.Host::query_heapreceives the guest heap descriptor’s kind. A timestamp heap is 1, while anEndQuerytimestamp operation is 2. At this revision heap kind 1 creates an occlusion heap. I corrected the three supported heap mappings and kept the operation mapping intact. The test resolves the same two native slots through the guest path and directly on the same queue, and checks the words on either side of the guest destination. Heap enum · Operation enumWith that correction, the new timestamp scaling on this PR agrees with the native readback. Two runs per adapter gave exact timestamps and preserved both guard words. One interval per adapter is shown below. Guest deltas are in the title’s 100 MHz clock.
For comparison, with the same heap correction on parent
eed5cb69, both RTX timestamps saturated to18446744073, giving a zero interval. WARP’s absolute ticks in these runs were still below the old overflow threshold and matched on the parent. Heap fix and opt-in GPU regressionSet
VICTORY_D3D12_WARP=1for the software comparison.I also checked the other affected mapping using empty query intervals. The unmodified head refused a pipeline-statistics heap (kind 2, operation 3) on both adapters with the same debug-layer error. With the patch, all 88 bytes of the guest statistics matched the native result on each device, and both neighboring guards stayed intact. Ordinary and binary occlusion queries (heap 0, operations 0 and 1) matched the native results before and after the patch on both adapters.
AI-assisted implementation and verification using synthetic queries.
@Dukestar69 on GitHub · 2026-11-26 12:30 UTC · original · approved these changes
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib query:: -- --test-threads=1: 3/3 passed on RTX 5090 and WARP.cargo test -p victory-gpu --lib list:: -- --test-threads=1: 4/4 passed;queue::: passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly executes timestamp/occlusion queries on the host GPU and resolves them back to title memory.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.