Repository navigation
perf(gpu): opt-in fast bindless maps and per-page buffer-view resolution (VICTORY_QUICK_SYNC) - #538
gdemontalivet wants to merge 1 commit into
Conversation
|
With The cause: The writes are refreshed from the same copy's bytes, so the order probably does not matter in game. Could you either sort what Found by Claude Code (Claude Opus 5.5) running the Wine suites on an M5 Pro. |
cae43c5 to
a49788e
Compare
|
I merged main into this branch and ran victory-gpu under Wine on a real GPU: all tests pass (575). On GitHub's Windows run (the software adapter) it fails every time, and main passes there. Each time the host device is removed partway through the run ( |
|
The WARP failure looks like the new GPU test's own inputs, not a fault in the quick path. In the CI log the first panic is quick.rs:568:40:
A minimal fix keeps both cases where they are valid (under Wine): // Native D3D12 (WARP): no RGB32 typed views (WARP loses the device on them) and
// raw views 16-byte aligned. Under Wine the 3-channel view is widened and any
// dword start works, which is what this test is for.
let native = !crate::under_wine();
let placed_at: u64 = if native { 32 } else { 28 };
// slot 3: ... ((mem + placed_at) as u32, ((mem + placed_at) >> 32) as u32)
// slot 4: format 3 (R32G32B32A32_UINT) when native, else 7 (R32G32B32_UINT)
// expected: placed_raw.Load(0) = 0xA000_0000 + placed_at / 4;
// widened[1].xyz = 4, 5, 6 when native (RGBA32 element 1), else 3, 4, 5
Found by Claude Code (Claude Opus 5.5) from the CI log and the test's inputs; not reproduced on WARP here. |
…ion (VICTORY_QUICK_SYNC) Add opt-in VICTORY_QUICK_SYNC (default off; supports 1, maps, views) layered onto batched heap sync and VICTORY_CENSUS_FAST=1: - Part A (census_maps.rs + bindless.rs): multiply-and-fold FoldHasher (Hashing) and hash-backed RangesMap replacing BTreeMap in bindless::Viewed when enabled, preserving UnorderedIndex / SnapshotCache (VICTORY_CENSUS_FAST=1), pragyaangaur#613 hull_generation invariance across interior view edits, deterministic BTreeMap-equivalent ordering in widened_writes_into when RangesMap is hash-backed, and sorting range copy keys before dedup in diagnostics. - Part B (descriptor/host/quick.rs + descriptor/host.rs): resolve each unique buffer SRV, placed buffer SRV, or aligned CBV record once per synced 64 KiB page outside HostHeap::made (including 3-channel widening, raw_structured lowering, held source, stride, view address, and bindless::Seen), then stamp matching slots via StagingHeap templates, keep_batch, and Viewed::set_batch_resolved while preserving pragyaangaur#640 page-span live reads, pragyaangaur#618 deferred show-after, and SyncStat / VICTORY_VIEW_PROBE telemetry. Textures, UAVs, samplers, placed textures, and refused/edge-case views stay on the standard path. - Add unit and live GPU equivalence tests comparing quick sync against standard sync across all view kinds, VICTORY_CENSUS_FAST=1, deterministic widened_writes_into ordering, and both Wine and native D3D12 (WARP) alignment/format rules.
|
Rebased onto
Verified locally: |
15fc943 to
75efbe4
Compare
|
Thank you for the rebase onto main earlier. #675 (VICTORY_DISJOINT_SPANS, also from gdemontalivet) has now merged and changes the same |
Summary
Adds opt-in
VICTORY_QUICK_SYNC=1(off by default; also acceptsmaps,views, ormaps,views) to speed upsync_heapsdescriptor mirroring and bindless range bookkeeping on Apple Silicon / Wine:crates/victory-gpu/src/census_maps.rs(new, portablestd):Hashing::Fold) andRangesMap(Tree/Hash) replacing theBTreeMapandRandomStateHashMapinsidebindless::Viewedwhenmapsis enabled, preserving#529(VICTORY_CENSUS_FAST=1)UnorderedIndexandwidened_writes_intosemantics.crates/victory-gpu/src/descriptor/host/quick.rs&descriptor/host.rs:quick::resolve) into#439'sHostHeap::mirror_synced_batch: resolves each unique[tag, i, generation]buffer SRV, placed buffer SRV, or aligned dword-multiple CBV once per 64 KiB page outsideHostHeap::made, then stamps all matching slots viaStagingHeap+CopyDescriptorsandViewed::set_batch_resolved.mirrorpath.crates/victory-gpu/src/descriptor.rs:set_view_gen(i, generation)fromViews::entry_kepttorecordunderVIEWS.write(), fixing a parallel-test isolation race.Verification
cargo xtask policy: passed (297 files ok;host.rs314,921 B,descriptor/host.rs251,122 B).cargo clippy --target x86_64-pc-windows-gnullvm --workspace --all-targets -- -D warnings(default and--features diagnostics): 0 warnings.cargo test -p victory-gpu --lib census: 9 passed, 0 failed.descriptor:: bindless:: census quick): 77 passed, 0 failed both with default env and withVICTORY_QUICK_SYNC=1 VICTORY_CENSUS_FAST=1(including new CBV/SRV/structured/placed/widened GPU readback equivalence and concurrent-rewrite tests).VICTORY_QUICK_SYNC=0: median world frame692.5 ms,prep283.4 ms,heap_slots51.7 ms,+48..+901.229 FPS(34.17 s),+8..+901.295 FPS(63.33 s).VICTORY_QUICK_SYNC=1: median world frame611.8 ms(-11.7%),prep214.5 ms(-24.3%),heap_slots42.8 ms(-17.2%),+48..+901.493 FPS(28.14 s,+21.5%),+8..+901.431 FPS(57.32 s,+10.5%).