perf(gpu/hwrt): incremental BLAS remap table, pooled staging, IB validation cache, and feedback throttling (Wave 10A) #427
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/427"
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?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:14:13Z.
Summary
Implements Wave 10A HW-RT CPU preparation optimizations across
crates/victory-gpu/src/hwrt.rs,crates/victory-gpu/src/hwrt/budget.rs, andcrates/victory-gpu/src/hwrt/decoders.rsto eliminate submission-thread stalls and redundant CPU/GPU prep overhead during BLAS and TLAS builds.Changes
Incremental GPU-Resident BLAS Remap Table, Exact Version Invalidation & CoW
BlasRefsas_map_versionbumps from record-timealloc_or_reuse_as, record-timeexecute_copy, and TLAS-onlyshow/show_copyupdates (the remap table only depends onshownBLASes,queue.waiting, andlru.evicted).BlasHashTablewith O(1) in-place upserts and circular backshift deletion (< 64-probe invariant preserved, matchingREMAP_HLSLbinary layout 100% identically) and eliminated the duplicateknown: HashSet<u64>allocation intable_entries.choose_table_cap) and a persistent GPU-residentDEFAULTremap buffer (GpuBlasTable) updated byPATCH_TABLE_HLSL(mode 0: 16-byte no-op header,mode 1: dirty-slot scatter patch,mode 2: full copy on initial sync / capacity change / burst overflow), removing per-TLAS 0.5–2 MiB write-combinedmemcpys on the submission thread.Vec<Arc<HostAs>>+Vec<u64>table snapshots with copy-on-write 256-slotChunkedRefs(BlasRefs) so incremental TLAS updates share untouched chunks without re-cloning all liveArc<HostAs>entries.Pooled BLAS Staging & Decoder Scratch Reuse
list.plane_upload(exact_len, (0, 0), ...)inflush_blas_waveswithlist.scratch_held(len)+ immediate copy on the recording worker thread (stage.clear()retaining capacity), eliminating exact-sizeSPARE.takemisses,CreateCommittedResourcestorms, and submit-thread WC copies.decode_title_quant24_vbanddecode_title_meshlet_ib, hoisting the quant24 component swizzle out of the per-vertex loop.BLAS Refit Fast-Path, Epoch-Gated
validated_ibsCache,Arc<OwnedBuild>& Feedback/Stats Throttlingvalidated_ibson(shadow_id, !gpu_written, watch::writes_since)epoch so all builds, refits, and rehydrates can safely hit the cache without serving stale data when an index buffer is modified, using a reusable thread-local scan buffer.clamp_ibdispatch andworkallocation whenever every scanned index is strictly< eff_vcand the shadow is not GPU-written (preservingGeomKeyconsistency across builds and refits).HostAs::geom_keysasArc<[GeomKey]>and added zero-allocationgeom_keys_matchon refits.OwnedBuildinArc<OwnedBuild>across recording, backlog, andBlasLru(recipes/evicted), normalizing lazily only when materializing an evicted rebuild (take_wanted/take_evicted).cached_meshlet_ibforis_rehydrate == truebuilds.g_used.StoreinREMAP_HLSLwithif (stamp != 0u)and throttled TLAS LRUFeedbackreadbacks (should_sample_feedback: every 8 frames at >=70% VRAM budget or with evicted BLASes, every 16 frames when idle, disabled when budget is 0), switchedBlasLru::wantedfromVectoHashSet<u64>, gatedpool.statsreadback copies to logging cadence (should_read_stats), and separatedtlas_poolfromas_poolso BLAS eviction does not drain warm TLAS buffers.Verification
cargo test -p victory-gpu --lib hwrt -- --skip postbuild_uav_shader --test-threads=1— 51 passed, 0 failed (including new unit tests forBlasHashTablewrap-around backshift fuzzing,choose_table_caphysteresis,CachedBlasTableGenericCoW chunks & patch encoding,DirtyBlasoverflow,ValidatedIbepoch gating &should_skip_clamp_ib,geom_keys_match,PATCH_TABLE_HLSL/REMAP_HLSLcompilation,should_sample_feedback/should_read_stats,marked_chunked, andBlasLruArcsharing).cargo clippy --workspace --all-targets -- -D warnings— passed.cargo clippy --workspace --all-targets --all-features -- -D warnings— passed.cargo xtask policy— passed (365 files ok).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:32:08Z.
Triage (
48235827, CIcheckPASS,MERGEABLE):+1,903/-477acrosshwrt.rs,hwrt/budget.rs,hwrt/decoders.rs, zero new toggles), however Gate 2 Adversarial Audit (#282comment7405972309) flagged2 [P0]+2 [P1]merge blockers (including persistentGpuBlasTabledesync / GPU UAF ifalloc_or_reuse_asfails afterlist.plane_upload).triage: needs workpending fixes + Gate 2 clean re-audit + Gate 3VICTORY_HW_RT=1verification.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T09:01:55Z.
Updated triage (
00fb5f86, rebased onto25d75651, CIIN_PROGRESS,MERGEABLE):#282comment7406514018):VERIFIED CLEAN (0 P0, 0 P1)— all 4 prior findings resolved cleanly.triage: needs work->triage: needs gpu test— awaiting CIcheckPASS + Gate 3VICTORY_HW_RT=1GPU verification before merging.