[Audit] Deep Code & Telemetry Findings #282
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?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-01T11:52:12Z.
Deep read-only static code and telemetry audit across
victory-gpu,victory-hle,victory-formats, andvictory-shader, cross-checked against plain--release60s captures,--features diagnostics90s captures, and currentmain(fd5a4206, post-#278/#279/#281).All
file:linecitations are verified againstmainfd5a4206. Work already merged in#278/#279/#281or covered by open PRs (#265,#266,#269,#270) is excluded. Every proposed fix is a default-on architectural replacement (no opt-in switch bloat).Pass 1 — Command-List Translation & Draw Hot Path
1. [Tier-1] Global Lock Contention (
RETIRED+HostHeap::next) & D3D12 Call Explosion in Dynamic Descriptor Tablescrates/victory-gpu/src/descriptor/host.rs:4026-4052(keep_inner) ->crates/victory-gpu/src/host.rs:784-794(retire_resource);descriptor/host.rs:2512-2550(HostHeap::dynamic),descriptor/host.rs:3858-3874(HostHeap::release),crates/victory-gpu/src/draw.rs:599-620(State::tables_done);descriptor/host.rs:3953, 4194-4245, 4291(make_listed,constant_at,copy_to).--releasebaseline (eb9dc68d):list::thinspends428.9 ms/frameacross 8 workers (88.5% saturated,155submitted lists still untranslated at submit time). Doubling workers to 16 regresses FPS16.5 -> 15.0and inflates total worker CPU time+57%(428.9 -> 675.4 ms/frame,13.6 us/call), proving severe cross-thread lock contention.17,512dynamic tables/frame and12.0 ms/framejust scanning insideHostHeap::next.RETIREDmutex (bury_lag()is 16/64, never 0). MeanwhileHostHeap::next: Mutex<(u32, Vec<bool>)>is locked35,024×/frame(17,512 allocs + 17,512 unbatched per-table releases viaSHADER_HEAPS.read()+self.next.lock()), linearly scanning up to 262,144boolbytes.make_listedandcopy_toemitCopyDescriptorsSimple(1, ...)one slot at a time plus per-slothost::settle(), andconstant_at(descriptor/host.rs:4242) unconditionally creates a raw SRV twin (CreateShaderResourceView+CopyDescriptorsSimple(1)) for every CBV slot (4 D3D12 COM calls/CBV).~2–5 ms/framewall +~150–250 ms/frameworker CPU +~3.2 ms/frameon relay thread (host.rs:7099).ID3D12Resources in a per-list/thread-localVecand flush once per list close intoRETIRED(~600× fewer global locks).Vec<bool>inHostHeap::nextwith aVec<u64>bitset (32 KiB, L1-resident) + per-list 256–512-slot bump slab + single batchedrelease_batch()intables_done()(oneSHADER_HEAPS.read()+ one lock per list).CopyDescriptorsper table (hoistinghost::settle()once per table) and skip the CBV raw SRV twin unless the boundTableGroupreads that slot as raw bytes.2. [Tier-1 Bug]
VICTORY_FRESH_OPENFast Path Fails 100.0% of the Time (1-Line Ordering Bug)crates/victory-gpu/src/list.rs:848(resetcallswith_state(this, ...)->list.rs:152-154->list.rs:240-244host_list(this)->crates/victory-gpu/src/host.rs:8958title_call()), checked againstcrates/victory-gpu/src/host.rs:8850-8862(still_left_open()).list.rs:848callswith_state(this, ...), which invokeshost_list(this)->list.title_call()(incrementingtitle_callsby 1) beforehost.reset()checksstill_left_open()(calls == self.title_calls() + 1). Becausetitle_callswas already incremented, the predicate is mathematically alwaysfalse.--releasebaseline confirms233.6left open,0.0resets found them so,234.18closed after all. Diagnostics attributes23.7 ms/frametolists reset.~3–8 ms/frameworker CPU (~234 redundantClose()+ 234allocator.Reset()+ 234list.Reset()per frame).crates/victory-gpu/src/list.rs:848fromwith_state(this, ...)towith_state_on(host_list_held(this), this, ...)sostill_left_open()observes the pre-reset call count.3. Host Command-List Pool Thrash & 4.17 GiB Private-Bytes Churn Under RAM Pressure
crates/victory-gpu/src/list.rs:312-347(IDLE_MOST,pressure_idle_cap,trim_on_pressure),list.rs:411-450(recycle),crates/victory-gpu/src/host.rs:802-808(bury_lag),crates/victory-gpu/src/list/thin.rs:412, 428-436(BACKS).13 host lists made 6.0 ms/framecontinuously (12,741total created,1,071alive,private bytes grew 4,172 MB), while baseline release tripshost memory pressuretrims every 1s.list/thin.rsBACKSretains hidden idleHostLists detached fromIDLE, and allocator recycling is delayed bybury_lag(16/64) instead of actual GPU fence completion (FINISHED).~2–6 ms/frameCPU + multi-GiB commit churn.HostListlazily insideback_list()rather than eagerly indetach_parts(eliminating ~150–300 hiddenHostLists inBACKS), recycle command allocators immediately on GPU fence completion (FINISHED), and floortrim_on_pressureat1.5×rolling per-frame list demand unless commit is critical.4. Zero Redundant-Bind Deduplication for Root Constants, Static Heap SRVs, VBs, and IBs
crates/victory-gpu/src/draw.rs:1911-1950(IASetVertexBuffers/IASetIndexBuffer+shadow::find_any/refresh),draw.rs:2122-2286(SetGraphicsRoot32BitConstants+ static heapSet*RootShaderResourceView).IASetVertexBuffers, root 32-bit constants, and invariant static heap SRVs (SLOT_STRIDES,SLOT_TABLE_STRIDES,SLOT_VIEW_ADDRESSES,SLOT_CODE_TABLE,SLOT_MEMORY) across stages — ~40k–70k redundant D3D12 COM calls/frame.~1–2 ms/framewall /~15–30 ms/frameworker CPU.(compute, param), invalidated on root-signature change orreplay().Pass 1 Do-Not-Chase Kill List
VICTORY_INDIRECT_MERGE: Baseline logs0 / 5,447indirect executions eligible to merge.VICTORY_WAIT_SHARE=1: Probed14.3 fpsvs16.5 fpsbaseline (GPU 0.0 ms, CPU-bound).VICTORY_THIN_THREADSabove 8 before fixing P1-1: 16 threads regressed16.5 -> 15.0 fps(+57% worker lock contention).0.2 ms/frame; >99% of "dropped without a host pipeline" are intentional RT/BVH skips.Pass 2 — Submission, Copyback, Shadow & Watch Pipeline
1. [Tier-1] Global
GUARDSMutex Held Across KernelVirtualProtect()+ TLB Shootdowns (Why Closed PR#280Wasn't Enough)crates/victory-gpu/src/watch.rs:2387, 2420, 2514-2562(ask_guards->protect/cover),watch.rs:2797, 2825(writing/kernel_writing),watch.rs:3631(VEHon_write).guardswaited62.80 ms/frameacross 189 waits:watch.rs:2387=35.18 ms,watch.rs:2420=10.16 ms,watch.rs:2825=4.37 ms(with read-only1614+2362waiting26.35 msbehind2387). Plain--releaselogsland::guards = 6.60 ms/frame(spiking to25.49 ms).#280empirically proved that making only the read-side fast paths (publish()/guard()clean/held) lock-free only cut 35% of wait time and left wall-clockpreparing(30.9 -> 31.35 ms) andcopyback(12.5 -> 12.3 ms) flat because ~65% of the lock hold time is kernelVirtualProtect()+ cross-core TLB shootdowns executed while holding the single globalGUARDSmutex, serializing the submitting thread, all 4 copyback merge threads, and title VEH faults on unrelated memory ranges.~4–9 ms/framewall acrosspreparing(write watch 6.0 ms) andcopyback(land::guards 6.6 ms).GUARDSinto a 64-way address-striped array ((block >> 6) & 63, locked in ascending stripe index order for multi-stripe ranges) so aVirtualProtect+ TLB shootdown in one 4 MiB stripe never stalls unrelated stripes, combined with lock-free read fast paths once write-side serialization is eliminated.2. [Tier-1] Serial Per-List
HostList::prelude()Allocator/List Resets Hiding inlists' stepscrates/victory-gpu/src/host.rs:8059(for list in runs->list.prelude(&uploads)),host.rs:9275-9410(prelude()).lists' steps = 16.7 ms(refreshes 8.6 + copies/fills 1.4 = 10.0 ms, leaving6.7 ms/frameunaccounted). Even after#279coalesced refreshes,5.2 ms/frameremains inlists' steps"other".177preludes alive/frame:prelude()pops a separate(ID3D12CommandAllocator, ID3D12GraphicsCommandList), heap-allocates 4Vecs + 1HashMap, and executesallocator.Reset()+list.Reset()+ResourceBarrier()+list.Close()serially on the submitting thread for every list.~4–6 ms/frameon the serial submitting thread.ID3D12CommandAllocator(~18allocator.Reset()/frame instead of ~177), merge adjacent non-conflicting preludes into one prelude list, and reuse scratch buffers onBatch.3. [Tier-1] Coarse Per-Shadow
mergingWrite Lock & Unskipped 174 MiB Heap Refreshescrates/victory-gpu/src/shadow.rs:4794-4908(merge_under_writes),shadow.rs:5065-5082(nothing_new_with),shadow.rs:3784-3795(stale_pages_in_atomic),shadow.rs:5225-5275(copy_stale),shadow.rs:5965, 6007(merging.read()).0x1c110000+0xae00000) refreshed9.8×/frame(1,778.91 MB/frame,5.68 ms/framealone) becausenothing_new_withbails whenever any pending GPU write overlaps the 174 MiB heap (true almost continuously due to skinning dispatches), forcingstale_pages_in_atomicandcopy_staleto scan all 2,784 blocks + binary search.merge_under_writesholdsself.merging.write()over the entire 174 MiB shadow while diffing ~109 pages, emitting34,788micro-runs (118,821scatter words,under flights = 2.9 ms), and callingcard_changed_runs109× under the exclusive lock — blocking the 4 copyback threads4.37 ms/frameonself.merging.read().~3–5 ms/framepreparing +~2–4 ms/framecopyback.Shadow::merginginto a 64-wayRwLockarray indexed byblock & 63; flushcard_changed_runsonce after releasing the lock; maintainuncopied_pages: AtomicUsizesostale_pages_in_atomic/copy_stalerun inO(|written|)instead ofO(pages log |written|); coalesce adjacent micro-runs within a 64-byte gap.4. Post-
#279card_steps::fill_to()O(L) Linear Scan & 7,225 Per-Fill Mutex Locks + Unbatchedrelease_tables()inrelay_landcrates/victory-gpu/src/host/card_steps.rs:521-568(does_of),card_steps.rs:618-624, 1242(fill_to),card_steps.rs:1359-1370(late::on()3rd walk);crates/victory-gpu/src/host.rs:7099(detached.release_tables()).#279movedCopyBufferRegioninto compute gather (card_stepsdropped9.3 -> 5.8 ms/frame),fill_to()still linearly scansrunsand re-lockslist.deferred()for every fill step, andlate::on()locks and walks all lists a third time. Separately,host.rs:7099runs outsideland::stat::GATHERand accounts for the3.19 ms/frameunaccounted gap on the relay thread (16.6 mstotal vs13.41 msinstrumented).~1.5–2.5 ms/frameincard_steps+~3.2 ms/frameon relay thread (latter solved by P1-1's batched release).(list_idx, FillTo)directly insidedoes_of()(single pass coveringlate::on()fills as well).Pass 2 Do-Not-Chase Kill List
host::mapped()holdingASIDEacrossWaitForSingleObject: Already fixed onmain(host.rs:456-467dropsASIDEbeforeaside_waitand coalesces waiters onASIDE_CV).0.6/frame(10.5 mstotal over 60s).take_snapshots()/quiet.rs:0.1 ms/frameand already skipping~246 MB/frame.VICTORY_SUBMIT_SPLIToffline: Regressed to13.9 fpsand+549 MBVRAM over-budget.Pass 3 — VRAM, Textures, Aliases & Visual Correctness (Verified Post-
#281)1. [Tier-1 Correctness —
#150Root Cause] Dual Visual Bug Still Present onmain(fd5a4206)crates/victory-formats/src/bcpack.rs:519-524(and reference testbcpack.rs:1942-1945).crates/victory-gpu/src/list/thin.rs+crates/victory-gpu/src/draw.rs:340, 2762, 2884-2970, 3045-3114.rotation()(bcpack.rs:1290) is already guarded to BC7 modes 4/5, dictionary table loading atbcpack.rs:519-524still skips au16(r.u16();) and reads only&mut ix.ix.as_flattened_mut()[..31]. The format takes that word as pixel 0's index across all 32i16slots (ix.ix.as_flattened_mut()), shifting every BC7 dictionary-coded block's pixel indices by 1 texel -> colored specks/confetti on textures.VICTORY_THIN=1, decoration-bake draws have no cross-list ordering barrier. Any list recorded after a bake list can be picked up first by one of the 8 translation workers and claim due texture slots into its later-submitted command list; when the bake draw executesearly_textures()+bring_bake_sources(), those slots are no longer due or still show a stand-in/stale bytes (baseline logsother_bytes=13, showed_another_view=3; longer sessions logother_bytes=489, showed_another_view=117), permanently baking colored noise blocks for the scene.#150(~0 ms steady-state cost; only ~2–6 bake draws/frame).r.u16();and populate all 32 slots (for v in ix.ix.as_flattened_mut()) inbcpack.rs:519-524(and1942-1945).list/thin.rs, detect bake-pipeline binds viadraw::bake_pipeline(default-on, no switch bloat), drain prior recordings, and translate bake draws inline in submission order until another pipeline is bound.2. [Tier-1 VRAM —
#149Root Cause] Double Eviction Dead-End:slot_evict()Blocks 100% of Streamed Textures &evict_idle_host()Skips Pinned Unmapped Texturescrates/victory-gpu/src/descriptor/host.rs:3477(slots_showing_from_raws),descriptor/host.rs:3630-3634(tabled_lately),descriptor/host.rs:1113-1125(seen_since),crates/victory-gpu/src/descriptor.rs:1911-1968(evictable_slots),crates/victory-gpu/src/resource.rs:2672-2679(evict_idle_host),resource.rs:2880-2896, 2989(VICTORY_SLOT_EVICT/slot_evict).descriptor/host.rs:3477computeslet ok = i < count && !sampler && tabled_lately(i);. Every bindless texture picked by index (>95% of streamed VRAM textures) hasstamp == 0, sotabled_lately(i)is alwaysfalse->evictable_slotsclassifies 100% of them asblocked. Even tabled textures idle> 240frames flip totabled_lately == false(blocked), while newer ones hitseen_since == true(kept).all=43109 raws=30393 evictable=0 kept=0 blocked=30393(7.90 msspent finding 0 evictable slots), matching#149'sreclaim: 0over 19 minutes.evict_idle_host()(resource.rs:2679) requiresreferences(&host.texture) == 1, which is alwaysfalsewhile anyHostHeap::kept[slot]holds a COM reference (pinning unmapped placed textures indefinitely). Even with#281'spoolsmallcutting 60s VRAM6,803 -> 6,030 MB, longer sessions still fill VRAM monotonically to permanentroom=falsewith zero reclaim.500–2,000+ MBdynamic VRAM reclamation on 8–12 GiB GPUs (resolving#149), with zero overhead on 16+ GiB GPUs below budget.stamp(removingtabled_lately(i)fromok), runslot_evictautomatically when DXGIused > 85%of budget (default-on reactive policy, no opt-in switch), and allowevict_idle_hoston unmapped placed textures to reset theirHostHeap::keptslot to null/neutral before releasing the resource.3. Why
levels_on_demandRegresses Both FPS (-1.5 fps/+10 ms) & VRAM (+213 MB) on Top of#281'spoolsmall, PlusshadowCard Budget Crowding 8 GiB Cardscrates/victory-gpu/src/tiles.rs:194-226(parse_floor_for/floor),tiles.rs:534-557(uploaded_on),tiles.rs:303(host::resident);crates/victory-gpu/src/shadow.rs:205-219(default_card_limits_mb).poolsmallalone achieves15.8 fps, VRAM6,030 MB,room_false=0%,final_waiting=2,178, whereas addinglevels_on_demandregresses to14.3 fps,preparing +10 ms(heaps/sweep 7.1–9.3 ms), VRAM6,243 MB(+213 MBworse),final_waiting=3,310(+1,132worse).tiles.rs:194lowers the tiled floor to256 KiBon<= 9 GiBGPUs, pulling thousands of medium textures out of#281's 4 KiB-packedpoolinto 64 KiB-tiletiles::POOL— losing sub-64 KiB packing, duplicating 64 MiB heap slack across two separate pools, and running serialUpdateTileMappings+texture_views_remade()on the submitting thread (tiles.rs:534-557).shadow.rs:205-219allows up to1,474 MiBof card-resident shadow buffers on an 8 GiB card (1,356 MiBobserved = ~20% of 6.7 GiB DXGI budget), crowding out textures before tiled mips are even needed.~200–600 MBVRAM headroom on 8 GiB cards + prevents+10 mspreparingregression.tiles::floor()to>= 2 MiB(restricting tiled reserved resources to large 2K/4K mip-streamed textures while< 2 MiBstays in 4 KiBpoolsmall), batchUpdateTileMappingsper submission, and makeshadowcard-buffer limits dynamically reactive to DXGI texture headroom (demoting idle card shadows when texture pressure exceeds 80% of budget).4.
21,648Committed Buffers Driving15,000SynchronousMakeResident(3.91s) +16,200mapped()(1.28s) Stallscrates/victory-gpu/src/ahead.rs:219, 227;crates/victory-gpu/src/host.rs:13441-13442(shared_buffer_with),host.rs:13531-13532(mapped_card_buffer),host.rs:13607-13608(uav_buffer_with).10,482shared buffers (5,265 MB) +11,166card buffers (1,958 MB) allocated as individual committed D3D12 resources. Even WITHpoolsmallactive (only 33 texture pool blocks),mapped()STILL runs16,200times (1,277.6 ms) andresident()runs15,000times (3,911.7 ms,28.06 ms/s) —5.18sof per-buffer WDDM residency + aside copy-queue fence waits, plus ~20k kernel residency allocations inflating Dxgkrnl submission overhead.>95%reduction inMakeResident/mapped()stalls (~4–5s/60s saved across threads + reduced WDDMExecuteCommandListsoverhead).aheadbuffers (and small<= 4 MiBshadow buffers) as placed resources inside 64 MiBID3D12Heapblocks (mirroringpool.rs: 1MakeResident+ 1mapped()per 1,024 buffers), or batchMakeResident(32, ...)+ 1mapped()fence per refill batch.Pass 3 Do-Not-Chase Kill List
#235).VICTORY_LEVELS_ON_DEMAND=1at 256 KiB floor on top of#281'spoolsmall: Empirically regresses both VRAM (+213 MB) and FPS (-1.5 fps).VICTORY_RENDER_XOR&VICTORY_UNORDERED_NOW_KB: Already implemented onmain(crates/victory-formats/src/texture.rs:576,crates/victory-gpu/src/resource.rs:1774, 4021).Pass 4 — Concurrency, Deadlocks & HLE/Shader Structural Hazards
1. [Tier-1 Freeze/Deadlock Hazard —
#148] Unprotected Critical GPU Pipeline Workers & UnboundedWaitForSingleObject(INFINITE)/LINE_LANDED.wait()crates/victory-gpu/src/host.rs:5125-5142(wait_host_fence:WaitForSingleObject(event, INFINITE)),host.rs:5339-5399(relay_worker:line.settling = trueatL5372,relay_landatL5388with NOcatch_unwindor RAII guard, cleared only atL7253),host.rs:5260-5299(relay_wait_most: unboundedLINE_LANDED.wait(line), escape hatch atL5282requires!line.settling),host.rs:5149-5199(late_helper: nocatch_unwind),crates/victory-gpu/src/queue/behind.rs:275-312(Line::serve: nocatch_unwindwhiledrain()/wait_presents()wait unbounded onself.moved),host.rs:604(wait_asked:WaitForSingleObject(e, INFINITE)under globalWAITINGmutex).sender()(host.rs:4423),list/thin.rs:464, anddescriptor.rs:344-377, none of the three primary GPU completion/submission workers catch panics or clean up state on unwind. If any panic occurs insiderelay_land(e.g.,texback::land,shadow::land_card,card_steps),line.settlingstaystrueforever,relay_workersilently exits, everyLate::Signalstops, and every caller ofHost::settle/fence::block_untilhangs permanently atLINE_LANDED.wait()(host.rs:5298). Likewise, if a cross-queue/Streamline FG2x stall holds a fence without triggering OS TDR,wait_host_fence(host.rs:5132) blocks silently forever with zero timeout or diagnostic output whilexmemkeeps ticking0 noted— matching the exact#148symptom profile.#148-class) and guarantees actionable DRED/queue-state diagnostics on any GPU fence stall.relay_worker,late_helper, andbehind::Line::serveincatch_unwind->host::fail(...)plus an RAIISettlingGuardclearingline.settling = falseand notifyingLINE_LANDED; replaceINFINITEinwait_host_fence()(host.rs:5132) andwait_asked()(host.rs:604) with a 5s polling wait loop that checksGetDeviceRemovedReason()and logs stalled fence/queue/flight state.2. [Tier-1 Hang Hazard] Uncapped Per-Frame 10-Second Re-Stall on
screenPipelinescrates/victory-gpu/src/pipeline/make.rs:274(screen_budget = 10_000 ms),make.rs:441(if !screen && p.missed_wait.load(Ordering::Acquire)),make.rs:451(SPENTresets everyframe),make.rs:475(if !screen && ... { p.missed_wait.store(true, ...); }).p.missed_wait = trueafter missing one 80 ms frame wait so subsequent frames stop blocking.screenpipelines explicitly bypassmissed_wait(!screen) and resetSPENTon every new frame (L451). If anyscreen-classified graphics or compute pipeline takes >10s (or stalls in the driver compiler), every subsequent frame blocks another 10,000 ms indefinitely (0.1 FPS freeze -> trips the title's 30s hang watchdog).waited_ms: AtomicU64) onPendingand cap total waiting across frames at 10,000 ms even forscreenpipelines (while allowing background compilation to finish asynchronously).3. Cross-Crate Lock-Ordering Hazard:
texback::landCallsxmem::materialize_for(PHYSICAL+GUARDS) UnderMAPPING.read()+TICKETScrates/victory-gpu/src/watch.rs:3168-3174(invariant: "Not to be taken twice by one thread, nor held across anything that maps title memory");crates/victory-gpu/src/texback.rs:241-291(_mapping = title_memory_reading()->_ticket_guard = TICKETS.lock()->read_intoatL254andcopy_mapped(..., title_dst=true)atL291);crates/victory-gpu/src/host.rs:11674(watch::materialize->crates/victory-hle/src/modules/xmem.rs:2977physical()+MapViewOfFile3+title_memory_made_real->GUARDS).texback::landruns onrelay_workerholdingMAPPING.read()+TICKETS, yet callscopy_mapped(..., title_dst=true)which materializes soft views viaxmem::materialize_for(takingPHYSICAL->GUARDSand callingMapViewOfFile3whileMAPPING.read()is held). This creates a lock-order inversion (TICKETS -> PHYSICALintexback::landvsPHYSICAL -> TICKETSinxmem::map_lazy/map_as/unmap->title_memory_remapped->texback::remapped) currently only masked because thosexmempaths acquireMAPPING.write()beforePHYSICAL. Any non-MAPPINGPHYSICALcaller invalidating tickets or contention with a pendingMAPPING.write()risks deadlockingrelay_workerright insidetexback::land.relay_workerlock-order inversion directly at the#148texbackpath and enforcesMAPPING's documented invariant.crate::watch::materialize(at, len)before acquiringtitle_memory_reading()andTICKETSintexback::land(texback.rs:241), and copy ticket metadata out underTICKETSrather than holdingTICKETSacrossread_into/copy_mapped.4. Wave64-to-Wave32 Translation Failures (6 Dropped Compute Shaders, 2.89s Wasted Cold Compile) & LDS Spin-Barrier Overhead (
Lower::meet)crates/victory-shader/src/emit/mod.rs:748-868(digest allowlist forwide_on+ 5–7 full lowering retries before"no wave32 lowering for this wave64 program");crates/victory-shader/src/emit/lower.rs:1402, 4910-4955(Lower::meet:MEETING_POLLS = 4096LDSbarrier(8)+ load +waveReadLaneFirstspin loop).--releaselogs 6 compute shaders failing identically withno wave32 lowering for this wave64 program is not supported:6871d6e4b3ac9a10(1,834 ms),6b82bc7d22016cb5(603 ms),1f1fbd86759b3da2(182 ms),eae3498e6553afa8(137 ms),b8f3f7979d6bbc50(105 ms),a1bf269d5b19f025(29 ms) —2.89swasted cold translation and5.4+dropped compute dispatches/frame in diagnostics.Lower::meet(lower.rs:4910-4955),pairsmode emits a 4,096-iterationbarrier(8)+ LDS load +waveReadLaneFirstspin loop at every pair meeting even at uniform blocks where all threads in the group are guaranteed to reach the meeting (where a single hardwareGroupMemoryBarrierWithGroupSyncbarrier(9)avoids spin-loop SM warp-slot starvation).emit/mod.rs:748-752with a structural convergence + LDS-fit predicate for auto-widening; emit hardwaregroup_sync(barrier(9)) inLower::meetwhenever the IR block is threadgroup-uniform (all_lane_blocksoutside divergent loops), reserving the LDS spin-poll strictly for divergent-wave pair meetings.Pass 4 Do-Not-Chase Kill List
list/thin.rs:456-462PARKED_NvsWORK.wait(ready): Rigorous trace shows the worker callingpark()always storesPARKED_Nbefore looping back towait_timeout(1ms), preventing an all-worker missed wakeup.xmem.rsMAPPINGvsPHYSICALinmap_pages/alias_as/map_aliases/scatter: Consistently orderedMAPPING.write() -> PHYSICAL, covered by unit testxmem.rs:3772.dstorage.rs:1034staging cap:self.staged == 0 || ...prevents head-of-line deadlock on requests exceeding staging capacity.LOOP_LIMITconstant-trip loop caps: Already addressed by open PR#266.memory.rs:756): Already handled viareplaced()/remove_packed().Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:56:38Z.
Follow-Up Deep Static Logic Audit (
main@baf967fc+ Open PRs#302,#329–#333,#341–#343)Fresh strictly read-only logic audit skipping items already covered above in
#282or fixed in#335/#336/#337. High-confidence confirmed bugs only.Area 1 — New GPU & Memory Hot Paths (
main@baf967fc:#322,#324,#327,#328)1. [P0]
slot_evictDeadlocked Between 85% and ~98.3% VRAM on 12–24 GB GPUs (Primary Cause of Long-Session VRAM + Shared Spill Creep)crates/victory-gpu/src/resource.rs:2378-2380(line_for),resource.rs:2764-2767, 2912(let_go_idle),resource.rs:3073-3126(slot_evict),crates/victory-gpu/src/host.rs:181-197(vram_keep_below), compounded bycrates/victory-gpu/src/host.rs:690-703(ram_idle_ms).budget ≈ 15.1 GiB),line_for(budget)returnsroom_line = 95%(~14.3 GiB).let_go_idle()passesweighed(budget, used)(rawusedminus fragmentedpool::texture_room() + tiles::free_room(), often 500 MiB–1.5 GiB of un-evictable slack) intovram_keep_below(budget, weighed, line).weighed < 93%(~14.0 GiB, which corresponds to rawusedanywhere from85%up to~98.3%!),vram_keep_belowreturnsKEPT_MS = 600_000(10 minutes).let_go_idle()forwardsidle_ms = 600_000intoslot_evict(memory, idle_ms, IDLE_FRAMES)(resource.rs:2912).slot_evictactivates at 85% rawused, butRINGonly retains 120 seconds of frame timestamps (resource.rs:3084-3091).frame_at(&ring, now_ms - 600_000)returnsNone, so between 85% and 95% rawused,slot_evictreturns early atresource.rs:3097-3104performing zero evictions.used,slot_evictfalls back toframe - 4for the table-frame cutoff, butresource.rs:3122still filters every candidate with!crate::host::long_ago(stamp, idle_ms, frames)usingidle_ms = 600_000, rejecting every texture touched in the last 10 minutes.ram_idle_msholds host staging/shadow caches for 5 minutes untilresidency::pressured()trips atavail_phys <= 3 GiB || avail_commit <= 4 GiB, allowing WDDM to spill VRAM heaps into shared memory and private commit (~15.3 GB VRAM + 8+ GB shared + 33 GB commit over ~36k frames).slot_evict's effectiveidle_msdirectly from rawused / budgetand clamp it to<= 60_000 ms(well insideRING's 120 s history), e.g.,60_000 msat85%scaling down to5_000 msat>= 93%, completely decoupled fromvram_keep_below'sKEPT_MS = 600_000.2. [P0]
CardBumpPool(#322) Bump-Only 4 MiB VRAM Heap Pinning (Up to 64× Fragmentation Leak)crates/victory-gpu/src/ahead.rs:270, 434-533(CARD_HEAP_KEY,CardBumpPool,CARD_POOL,alloc_pooled_card), called fromhost.rs:13982(uav_buffer_with),host/uav_pool.rs:104, andahead.rs:796.uav_buffer(size <= 1 MiB)allocates 64 KiB-aligned slots sequentially from 4 MiBID3D12Heaps viaCardBumpPool(ahead.rs:434-470), which has no free-bitset or slot recycling.ID3D12Resourceattaches an owning COM reference to its entire 4 MiBID3D12HeapviaSetPrivateDataInterface(&CARD_HEAP_KEY, &heap_unk)(ahead.rs:527).install()drops old entries onceactive.len() >= 2atahead.rs:462-466, also abandoning remaining free slots under concurrent creation races), any single surviving 64 KiB allocation from that heap (a persistentShadow, a cachedUAV_SPAREentry, or a LIFO-bottomahead::CARDentry) permanently pins the entire 4 MiB default heap in VRAM while the other 63 slots can never be reused.CardBumpPoolwith a free-list / bitset + fence-gated slot retirement pool (mirroringSharedPool), and re-checktake(slots)after re-acquiringCARD_POOLbefore allocating a fresh 4 MiB heap.3. [P1]
watch::ask_rest(#324) Stalej.aheadClone & Unheld-Range Timestamp Advance Race (Silent Missed Write-Watch Refreshes)crates/victory-gpu/src/watch.rs:974-1019(record_rest_pages,ask_rest), interacting withask_ahead(watch.rs:605-659),ask_once_extend(watch.rs:949-958), andask_once_end(watch.rs:1034-1041).ask_restclonesjournal().aheadatwatch.rs:1007before acquiringAskings::hold(to_hold)(watch.rs:1017), andto_holdexcludes all ranges inahead.P ∈ aheadare not held byAskings::hold(to_hold), another thread can callGetWriteWatch(WRITE_WATCH_FLAG_RESET)onPatT2, after which the title writesPatT3. Thenrecord_rest_pages(watch.rs:991-998) advancesj.ahead_asked = next_asking()(T4 > T3) across the entire mergedj.aheadwithout re-queryingP. Subsequent refreshes seej.ahead_asked >= T3and permanently miss the write atT3.ask_once_end()clearsj.aheadand setsj.kept = falsebetweenwatch.rs:1007andwatch.rs:986,record_rest_pages(watch.rs:996-998) overwritesj.aheadwith the stale pre-clear clone and setsj.kept = true.ask_onceepoch inJournal(abortingrecord_rest_pagesif the epoch changed sinceask_restbegan), re-readj.aheadunderjournal_mut(), and track per-interval(first, last, asked_at)timestamps instead of advancing one globalj.ahead_askedover unqueried ranges.4. [P1]
shadow::unregisterDropsArc<Shadow>Synchronously Withouthost::retire(In-FlightHASH_POOLReuse ->0x887A0006)crates/victory-gpu/src/shadow.rs:6630-6636(unregister),shadow.rs:3803-3841(Drop for Shadow),shadow.rs:566-572(hash_give).let_go_idle(shadow.rs:4253) andin_place_let_go(shadow.rs:6678),unregister()removesentryfromBUFFERSand letsentry.shadowdrop synchronously on the calling thread without passing it tocrate::host::retire(shadow).HostHeap::keptretains onlyshadow.buffer, notArc<Shadow>. If a title releases a buffer whosecard.beforehash buffer orshadow.bufferis still referenced by an in-flight submission or bindless descriptor slot,Shadow::dropruns immediately and callshash_give(class, before.buffer, before.gpu)(shadow.rs:3836) with zero GPU fence wait.before.bufferfromHASH_POOLand overwrites its GPUVA while the earlier command list is still executing on the GPU -> data corruption orDXGI_ERROR_DEVICE_HUNG(0x887A0006).shadowtocrate::host::retire(shadow)insideshadow::unregisteraftershadow.mark_retired().5. [P2] Unbounded
STATESMap Leak inhost/lazy.rs(#327) &xmem::shows_slicesIgnoresLAZYEntries (#328)crates/victory-gpu/src/host/lazy.rs:239, 253-259(STATES) andcrates/victory-hle/src/modules/xmem.rs:949-977, 1798, 1905, 2995-3027(shows_slices,map_lazy,LAZY).host/lazy.rs:STATESinserts(shadow.id(), State)(each containingVec<bool>/Vec<u32>per 64 KiB piece) for every>= 64 MiBshadow buffer, with no removal hook when aShadowdrops. Fix: addlazy::forget(self.id)and invoke it inDrop for Shadow.xmem.rs:map_lazyrecords aMEM_RESERVE-only range in bothLAZYandphysical.views, whileshows_sliceschecks onlyphysical.views. A subsequent non-lazyXMemMapPhysicalPages/alias_ascovering the same slices returns early thinking the host view is already materialized, leaving pages unmapped (MEM_RESERVE). Fix: haveshows_slicesreturnfalseif any entry inLAZYoverlaps[base, base + len).Area 2 — AMD RDNA 4 (
RX 9060 XT,WaveLaneCountMin=32, Max=64) Shader Wave & Culling Logic (crates/victory-shader/@baf967fc)6. [P0] Wave64 Compute Shaders Omitting
[WaveSize(64)]Silently Execute as Wave32 on RDNA 4 (v_readfirstlane_b32& Multi-Wave LDS Race — Explains Whole-Foliage Blinking & Split-Tile Artifacts)crates/victory-shader/src/emit/lower.rs:1863-1900, 1986-2003(console_lanes,one_wave,s.wave_size).host_max_wave() == 64,WaveLaneCountMin = 32, Max = 64), omitting DXIL[WaveSize(64)](s.wave_size == None) causes the AMD driver to default compute shaders to Wave32. Becausehost_max_wave() != 32,lower.rs:1887never activatessplit_ldsorhalves/pairs.s.wave_size = Noneon console Wave64 compute shaders:v_readfirstlane_b32missing fromconsole_lanes(lower.rs:1869): Onlyv_readlane_b32 | v_writelane_b32are matched. Any Wave64 compute shader usingv_readfirstlane_b32without another listed cross-lane op compiles without[WaveSize(64)], executes as Wave32, and broadcasts lane 32's value to lanes 32..63 instead of lane 0's (corrupting base indices/cull flags for the upper half of every 64-thread console wave).group > 64 && s.lds_dwords > 0,lower.rs:1878, 2001):one_wave = group <= wave, so any Wave64 compute shader withgroup > 64(e.g., 128 or 256 threads) that relies on implicit intra-wave 64-lane lockstep LDS sharing withouts_barrier(and without another listed cross-lane op) getss.wave_size = None! On RDNA 4, each 64-lane console wave splits into two asynchronously scheduled Wave32 wavefronts racing on intra-wave LDS writes/reads — producing non-deterministic intermittent whole-group culling drops (e.g., whole-foliage clusters blinking in/out frame-to-frame) and tile corruption.v_readfirstlane_b32inconsole_lanes(lower.rs:1869), and replaceone_wave && s.lds_dwords > 0atlower.rs:1887andlower.rs:2001withs.lds_dwords > 0 && (group > 32 || !x.native.wave64)(so any Wave64 compute shader using LDS emits[WaveSize(64)]on RDNA 4 and enters thesplit_ldscheck on Wave32-only hosts).7. [P0]
scc_someSkipswithin_execandall_lane_blocks_nativeChecks on Native Wave64 Hosts (AMD RDNA 4)crates/victory-shader/src/emit/lower.rs:5166-5188, 7249-7280(scc_some,scc_in) +crates/victory-shader/src/structure.rs:917-922, 1287-1289.structure.rs:917-922, 1287-1289exports the SCC of every non-scc_everymask SOP intost.scc_some, includings_not_b64,s_or_b64,s_xor_b64, ands_andn2_b64, whose result mask holds bits in inactive lanes (!st.active).s_cselect_b32/b64,src_scc, etc.),scc_in(lower.rs:7249-7252) delegates straight toscc_some(v), bypassingwithin_exec(v)(lower.rs:7261).scc_some(lower.rs:5180-5188),waveAnyTrue(bit)is emitted over currently active host lanes. On NVIDIA (self.exchange.is_some()), lines5185-5188catch divergent defining blocks and returnErr(DIVERGENT_MASK_EXCHANGE)sowiden()widens the enclosing branch.self.exchange.is_none()), line5182-5184returnsOk(some)immediately without checkingself.within_exec(scc)orall_lane_blocks_native(self.x.st)!falsewhen set bits reside in masked-out lanes — inverting culling/tile-visibilitys_cselectdecisions specifically on native Wave64 hosts.mask_dwordinsidescc_some(lower.rs:5172-5184): before emittingwaveAnyTrue, if!self.within_exec(scc)and!made.is_none_or(|b| all_lane_blocks_native(self.x.st).is_some_and(|all| all[b])), callneed(made.unwrap_or(0))and returnErr(MASK_ELSEWHERE)sowiden()widens the enclosing branch on native Wave64 too.8. [P0]
s_cbranch_vccz/s_cbranch_vccnzIncorrectly IntersectsVCCwith CurrentEXEC(Sharp-Boundary Tile/Culling Drop)crates/victory-shader/src/structure.rs:1407-1418.s_cbranch_vccz/s_cbranch_vccnztests rawVCC == 0/VCC != 0, not(VCC & EXEC) == 0/!= 0.structure.rs:1412computeslet any = self.b.and(vcc, exec);, masking out allVCCbits belonging to lanes outside currentEXEC.VCCbefore narrowingEXEC(or manipulatesVCCwiths_or_b64/s_andn2_b64/s_not_b64/s_mov_b64 vcc, ...whileEXECis narrowed — common in screen-space/horizon-frustum tile culling and water-tile loops), all inactive lanes'VCCbits are silently discarded. Both per-lane andwave_wide(waveAnyTrue/waveAllTrue) branches then take the wrong target once active lanes cross a sharp threshold (e.g., screen-horizon / camera-pitch boundary), causing entire rows of tiles to skip/vanish along a sharp horizontal line.self.b.and(vcc, exec)atstructure.rs:1412and test rawvccdirectly (requiring widening vianeed()ifvccis notactiveat a divergent block).9. [P1]
ticketLDS Counter Overflows D3D12's 32 KiB TGSM Limit Unguardedcrates/victory-shader/src/emit/lower.rs:1384, 1996-2000, 2762(HOST_LDS_DWORDS,ticket).console_lanes && group > wave && ticket_on()(e.g., Wave64 withgroup > 64on RDNA 4, or Wave32 withgroup > 32on any GPU),lower.rs:1998-1999allocatesticketby incrementings.lds_dwords += 1.8192dwords),s.lds_dwordsbecomes8193(32,772 > 32,768bytes).lower.rs:2762checksif self.pairs.is_some() && self.s.lds_dwords > HOST_LDS_DWORDS, which isfalsewhenticket(orhalves/exchangewithoutpairs) overflowed TGSM.8193TGSM dwords -> D3D12 PSO creation fails and dispatches using that shader are silently dropped.self.pairs.is_some() &&precondition atlower.rs:2762(guardself.s.lds_dwords > HOST_LDS_DWORDSunconditionally), and skip allocatingticketwhens.lds_dwords == HOST_LDS_DWORDS(falling back to linearflat / wavewave base for 1Dgroup % wave == 0or returning a cleanErr).10. [P1] Float Inclusive Wave Prefix Sum Emits Integer
Bin::Addonf32Operands & Hardcodesunsigned = 1crates/victory-shader/src/emit/lower.rs:2466-2479(wavePrefixOp.f32).Op::AddFwithprefix == Some(true)(inclusive float wave prefix sum),lower.rs:2467, 2474hardcodesunsigned = i8(1)(k1) intodx.op.wavePrefixOp.f32(compareu8::from(!float)atlower.rs:2495, 2532).lower.rs:2477,if inclusive { self.s.m.bin(c, Bin::Add, r, arg) }emits LLVM integeradd(Bin::Add) on twof32values (randarg, typef32t) instead ofBin::FAdd-> malformed LLVM IR / instant DXIL validator rejection.self.s.m.i8(u8::from(!float))towavePrefixOpand useif float { Bin::FAdd } else { Bin::Add }atlower.rs:2477.11. [P2] DPP
row_shl/row_shrOut-of-BoundslaneIndexUB &v_permlanefi:1Loop-Latch Checkcrates/victory-shader/src/emit/lower.rs:9053-9065, 9098(DPP0x101..=0x11F) andlower.rs:9889-9896(v_permlane16_b32/v_permlanex16_b32).lower.rs:9061, 9098: Forrow_shr:natlane < n,lane - nwraps to0xFFFF_FFFF..; forrow_shl:natlane >= wave - n,lane + n >= WaveGetLaneCount().srcis passed unclamped todx.op.waveReadLaneAt.i32before theinsideselect (lower.rs:9104) — out-of-rangelaneIndexis HLSL/DXIL UB (drivers may trap or return poison). Fix: clamplet safe = self.s.m.select(c, inside, src, lane);beforeread_lane(asv_permlanealready does).lower.rs:9891:v_permlane16/x16withfetch_inactive(fi:1) checksall_lane_blocks(self.x.st)(loops = false) instead ofall_lane_blocks_native(self.x.st)(loops = true), permittingfetch_inactiveinside loops where some lanes already exited via a divergent latch. Fix: checkall_lane_blocks_native(self.x.st).Area 3 — Pre-Merge Logic Audit of Open PRs (
#302,#329–#333,#341–#343)12. [P0] PR
#331(11322318) —ReadMostly::readRe-Entrant Read Self-Deadlock on WindowsSRWLOCKcrates/victory-gpu/src/listcpu.rs:156-182(ReadMostly::read,try_read,HELD).ReadMostly::readexplicitly supports nested reads on the same thread by storing(depth, first)inHELDTLS and returningat = firstwhendepth > 0.depth > 0), line158(let held = self.locks[at].0.read()...) callsAcquireSRWLockShareda second time on the exact samestd::sync::RwLock(SRWLOCK) already held by the outer guard on the same thread.SRWLOCKis non-reentrant for shared acquisition in the presence of a waiting writer: if any writer callsReadMostly::write()and blocks waiting forself.locks[at]between the outerread()and innerread(), Windows queues the secondAcquireSRWLockSharedbehind the exclusive writer while the writer waits for the outerReleaseSRWLockShared-> instant permanent self-deadlock.depth > 0, do not re-acquireself.locks[at].0.read()(storeOption<RwLockReadGuard<'a, ()>>inReadGuard, or forbid nestedread()withdebug_assert_eq!(depth, 0)if guards can drop out of LIFO order, since storingNoneon inner guards is only sound if guards drop strictly LIFO or the outer guard moves the underlyingRwLockReadGuardto TLS).13. [P0] PR
#342(84ac527d,#339) — DanglingID3D12HeapTile Mappings on Error Paths inby_address_in/map_buffer_tiles(GPU Page Fault /0x887A0006)crates/victory-gpu/src/shadow.rs:7151-7175(by_address_in) andcrates/victory-gpu/src/host/reserved.rs:58-158(map_buffer_tiles).by_address_incallshost.map_buffer_tiles(&reserved, card_offset, len)(shadow.rs:7166), which creates anID3D12Heap, issuesUpdateTileMappingsbinding[card_offset, card_offset + len)of the sharedArenaPool.bufferreserved resource to that heap, and returnsheap.shadow.rs:7168),by_address_incallshost.shared_buffer_staging(len). If staging allocation fails (e.g., under commit pressure),by_address_inreturnsNone, droppingheapimmediately without unmapping those tiles fromreserved!map_buffer_tiles(reserved.rs:146-158), ifqueue.Signal,SetEventOnCompletion, orWaitForSingleObjectfails afterUpdateTileMappingshas been queued,map_buffer_tilesreturnsNoneand dropsheapwhileUpdateTileMappingsis still in flight on the GPU.reserved(or executing the queuedUpdateTileMappings) dereferences a destroyedID3D12Heap-> GPU page fault /0x887A0006.shared_buffer_staging(len)before callingmap_buffer_tiles, and on any error afterUpdateTileMappingsinmap_buffer_tiles, unmap the tile range (D3D12_TILE_RANGE_FLAG_NULL) and retireheapviacrate::host::retire(heap)rather than dropping it synchronously.14. [P0] PR
#342(84ac527d,#339) —Memory::bring_upSkips Refreshing Static / Submit-Time-Allocated Chunks (Stale/Zero BVH Data)crates/victory-gpu/src/memory.rs:1467-1485(Memory::bring_up,DIRTY_WINDOW,free_pages).bring_up(list, has_land)runs at recording time and registersshadow.refresh()on chunkconly when(has_land && chunk.free_pages > 0) || self.frame <= chunk.dirty_frame + DIRTY_WINDOW(DIRTY_WINDOW = 8).land()mismatch):m.land(at)runs later at submit time vialist.defer_host(...). If a full static chunk (free_pages == 0,dirty_frame < frame - 8) frees pages before submit time, ifland()overwrites existing pages of a replaced packed structure inside a full chunk, or ifland()callsanother_pooled()allocating a brand-new chunk at submit time,bring_upalready skipped that chunk at recording time ->shadow.refresh()is never scheduled and the GPU reads stale/zero BVH bytes.land(), if a chunk is dirtied at frameFand no RT dispatch records until frameF + 9(e.g., menu/loading/pause or cutscenes without RT dispatches),self.frame <= chunk.dirty_frame + 8evaluates tofalseand the dirty upload is permanently skipped.DIRTY_WINDOW/free_pages > 0filter with a per-chunk(dirty_epoch: u64, refreshed_epoch: u64)pair (refresh wheneverdirty_epoch != refreshed_epoch, advancingrefreshed_epochonly when a refresh actually runs), and ensure submit-timem.land(at)explicitly triggersshadow.refresh()on every chunk it touches or allocates.15. [P1] PR
#302(e3065e2a) — Relocated Partially-Mapped / Non-level0Textures Never Update Host SRVs, Stranding Draining Blocks & Duplicating VRAMcrates/victory-gpu/src/resource.rs:2934-3004(drain_moves),crates/victory-gpu/src/descriptor/host.rs:3208-3227(texture_slots_regrow),crates/victory-gpu/src/texture.rs:1128, 1231, 2359(staging.first == staging.level0), andcrates/victory-gpu/src/draw.rs:3865-3880.drain_moves()(resource.rs:2996-3002) setsr.host.grown = true, removesr.host.made(movingoldintoREPLACED), and relies ontexture.rs:1128, 1231, 2359callinglevels_changed_after(start)->texture_views_remade()to switch existingHostHeapSRV slots fromoldto the newly allocated copy in a non-draining block.texture.rssites gatelevels_changed_afteronif staging.first == staging.level0 && copy.grown.swap(false, Relaxed). Whenever a relocated texture is partially streamed (read_from(&layout, first) > copy.base, i.e.,staging.first > staging.level0) or its view starts belowlevel0, the condition isfalse:levels_changed_afteris never called.HostHeap::mirror(descriptor/host.rs:4702-4708, 4726) seesshown == keyand returns without rewriting the descriptor. As a result,HostHeap::kept[slot]keeps holdingoldindefinitely in the draining block whiler.host.madeholds a brand-new duplicate texture in a non-draining block — doubling VRAM for those textures and preventing the draining block from emptying untilDRAIN_GIVE_UP_MS(30 s) expires.!roomandexisting_only(draw.rs:3874) rejects a relocated texture because no non-draining hole fits it,r.host.madewas already cleared eagerly indrain_moves(), so any concurrent non-bindless caller (host_resourceoutsideexisting_only) allocates a fresh 64 MiB block viaGrow::Yes/Grow::Mustwhile VRAM is already over budget.relocated: AtomicBoolonHostTexture(or remove thestaging.first == staging.level0gate for relocations) solevels_changed_after(start)fires unconditionally once the relocated copy uploads any level; and skipdrain_movesfor textures withhost.base < first_mapped_mipor verify/reserve the destination block viaexisting_onlybefore takingr.host.made.16. [P1] PR
#341(cdf16541,#339) —memory_smemHardcodesNonUniformIndex = falseforSLOT_MEMORYHeap Handlescrates/victory-shader/src/emit/lower.rs:4453(memory_smem->memory_view_with(slot, start, lo, false)).memory_smemlowerss_load_dword*from title memory (resource::MEMORY) and now callsself.memory_view_with(slot, start, lo, /*nonuniform=*/false)unconditionally.victory-shader, SGPRs become per-lane SSA values in DXIL whenever ans_load_dword*address is produced by a flattened waterfallv_readfirstlane_b32(lower.rs:10032) or by an SGPR PHI /s_cselectinside a per-lane lowered branch or loop where lanes diverge on iteration count.SLOT_MEMORYarenas,slotis dynamically non-uniform; passingNonUniformIndex = falsetodx.op.createHandleFromHeapcauses D3D12/GPU hardware to broadcast lane 0's arena buffer descriptor across the wave, silently reading corrupt bytes from the wrong arena.nonuniform = trueinmemory_smemunless the defining block is proven wave-uniform (all_lane_blocks_native) and(lo, hi)is not derived fromwaterfall.readsor a divergent SGPR PHI.17. [P1] PR
#343(de84a1e1,#339) —has_pending_sizesPermanent Per-Frame Full Drain,SIZES_QUEUED/THIN_DONELoad-Order Race, &Quiet::wakeEarly Returncrates/victory-gpu/src/queue.rs:958-964,crates/victory-gpu/src/queue/behind.rs:548-550, 784-789(has_pending_sizes),crates/victory-gpu/src/memory.rs:1266, 1314, 1468(SIZES_SEEN), andcrates/victory-gpu/src/quiet.rs:90-103(Quiet::wake).behind::drain():SIZES_SEENis a permanent one-way latch. Once any BVH compacted-size query occurs,has_pending_sizes()(behind.rs:784-789) returnstruewheneverTHIN_DONE < THIN_QUEUED— which is true at almost everypresent()when async thin recordings (Job::Lists) are in flight.queue.rs:961-963therefore callsbehind::drain()on virtually every frame, stalling the title thread until all async translation/submission finishes and nullifyingbehind::on()/#330(VICTORY_PRESENT_RELEASE).Job::Lists(behind.rs:548-549), the worker writesSIZES_QUEUEDbeforeTHIN_DONE. Inhas_pending_sizes()(behind.rs:785-787),present()readsSIZES_QUEUEDbeforeTHIN_DONE. Interleaving: (a)present()readsSIZES_DONE == 0,SIZES_QUEUED == 0-> false; (b) worker executesnote_queued_sizes(SIZES_QUEUED = 1) andTHIN_DONE = 1; (c)present()readsTHIN_DONE == 1,THIN_QUEUED == 1-> false.has_pending_sizes()returnsfalsewhile aSIZESjob is still pending inLANE, skipping bothbehind::drain()andsettle_sizes_for_present().Quiet::wakenear-threshold bypass (quiet.rs:90-91): Whenself.readyisfalse(e.g.,state.streak == QUIET_AFTER - 1),wake()returns immediately without resettingstate.streak = 0, allowing the very next unchanged compare to mute the size-query buffer right before a BVH size write lands.has_sizesduring thin recording (e.g., a flag onRecordingset when aSIZESdispatch is recorded) so only thin batches containing a size query incrementSIZES_QUEUED(droppingSIZES_SEENandTHIN_QUEUED/THIN_DONEentirely, which fixes both the per-frame drain and the two-counter load-order race simultaneously); (2) inQuiet::wake, always lockself.stateand resetstate.streak = 0; state.audit = 0; state.range = None; self.ready.store(false, Release).Verified Clean Open PRs (No Confirmed P0–P2 Soundness/Logic Bugs)
#329(527b51a9,title_free.rs), PR#330(097d2c45,wait_presents_ahead—step()notifiesmoved.notify_all()after every item), PR#332(c062035e,VICTORY_FFX_RENDER_ALIGN—write_if_changedhandles patched bytes cleanly), and PR#333(34a8ac8a, diagnostics-onlyVICTORY_FRAMEGEN_OFFAB switch).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T16:57:04Z.
Deep Static Logic Audit — Pass #2 (
main@3efe907)Read-only logic audit covering:
RayQueryPhase 2 & 3 PRs (#347,#349, merged#352,#354,#357).09bugfix PRs (#355,#356,#358,#359)#341,#342,#343against Pass #1 findings#13,#14,#16,#17(All items already covered in Pass #1 comment
7349410307are omitted except the requested re-check of#341–#343.)Merge-Readiness Summary
#352(already merged),#358,#359,#341,#342#13,#14,#16are cleanly resolved.#347,#349,#354,#357,#355,#356,#343#357is a strict superset of#347+#349;#343is unchanged since Pass #1).Zero-Impact Check (
VICTORY_HW_RTUnset or0)#347,#349,#352,#357: Verified zero behavioral impact whenVICTORY_HW_RTis unset or0— all HLE/GPU/descriptor/pipeline/cache branches are gated behindhwrt::requested()(which defaults tofalse), and no DXR device objects or queues are created. (One tiny hygiene note:hwrt::note_dispatchin#357atcrates/victory-gpu/src/hwrt.rs:2971should early-return onif !requested()to matchnote_program, thoughq.queries.is_empty()already prevents entering it when off.)#354(standalone merge hazard — see Finding #10):victory-shaderitself produces bit-for-bit identical DXIL whenVICTORY_HW_RTis unset/0, but#354alone does not includeVICTORY_HW_RTinshader_cache::build()and dropsray_querieson cache deserialize. Merging#354without#357'sshader_cache.rschanges will poison shared disk caches across=1->=0runs and break PSO creation on=1cache hits.Target 1A — DXR 1.1 GPU / HLE Runtime (
#347,#349,#357)(Note:
#357(679283a2) is stacked strictly on top of#347(5e532641) +#349(c2017ae5). Line numbers below reference#357unless noted otherwise.)1.
[P0]#347,#349,#357—Arc::strong_count(existing) == 1Always True -> In-Place Overwrite of In-Flight TLAS & BLAS Buffers (+ Unbuilt TLAS Published at Recording Time)crates/victory-gpu/src/hwrt.rs:956(alloc_or_reuse_as),hwrt.rs:1404, 1415(flush_blas_waves),hwrt.rs:2860(tlas_gpu_va),hwrt.rs:2878(tlas_for_descriptor).alloc_or_reuse_asandflush_blas_wavesguard in-place reuse of an existingArc<HostAs>withArc::strong_count(existing) == 1.entry.buffer: ID3D12Resource, neverArc<HostAs>(list.keep(&entry.buffer),Shown,BlasRefs::held,tlas_gpu_va,tlas_for_descriptor). ThusArc::strong_count(existing)inas_mapis always1, even while frameN-1'sRayQuerydispatches or a second queue (VICTORY_TWO_QUEUES) are actively readingexisting.buffer.Nrebuilds the TLAS (or refits/rebuilds a BLAS) in-place into the sameID3D12Resourcewithout cross-queue/frame synchronization -> BVH node corruption andDXGI_ERROR_DEVICE_HUNG(0x887A0006).alloc_or_reuse_asinserts a newly created TLAS intoas_mapduring command-list recording (before submission). Under parallel recording, another worker callingtlas_gpu_va/tlas_for_descriptorimmediately sees and binds the unbuilt, uninitialized TLAS GPU VA.Arc<HostAs>(not justID3D12Resource) inlist.hold(...),Shown, andBlasRefs— or explicitly double/triple-buffer TLAS allocations per frame gated on GPU fence completion (host::submissions().1).shownat submit time vialist.defer_host(...)(matching BLAS publication) and resolvetlas_gpu_va/tlas_for_descriptorfromshownrather than recording-timeas_map.2.
[P1]#347,#349,#357—emit_postbuildLeavesShadow::bufferinCOPY_DEST(MissingCOPY_DEST -> COMMONBarrier & Shared-Heap Read-Before-Write Hazard)crates/victory-gpu/src/hwrt.rs:2482, 2506(emit_postbuild;#347hwrt.rs:2236, 2260).WriteBufferImmediate(hwrt.rs:2482, despite the comment claimingShadow::bufferstays inCOMMON) andCopyBufferRegion(&sh.buffer, ...)(hwrt.rs:2506) implicitly promotesh.bufferfromCOMMONtoD3D12_RESOURCE_STATE_COPY_DEST.sh.bufferback toCOMMONafterward, nor barriers against prior reads of the same shared-heapShadow::bufferearlier in the same command list.sh.bufferon the same command list violate D3D12 resource state tracking or read stale postbuild size/compaction metadata.COPY_DEST -> COMMONtransition on&sh.bufferimmediately after bothWriteBufferImmediateandCopyBufferRegion(and a prior transition/UAV flush ifsh.bufferwas previously read/written on the same list).3.
[P1]#347,#349,#357—execute_opGatesmgr.blas_workBehindif !blas.is_empty(), Permanently Starving Deferred BLAS Backlogs & LRU Rebuildscrates/victory-gpu/src/hwrt.rs:2834-2835(execute_op;#347hwrt.rs:2585).blas_workis the sole caller ofbudget.roll(frame),lru.take_wanted(),evict_over_budget(), andwaiting.take(budget).lru.wanted), steady-state TLAS-only frames arrive withblas.is_empty() == true.if !blas.is_empty()skipsblas_work, deferred BLASes inqueue.waitingand re-requested BLASes inlru.wantedare never built, remaining permanently masked out (missing RT geometry) until an unrelated title BLAS build occurs.if !blas.is_empty()and callmgr.blas_work(list, &mut bound, blas);unconditionally before thefor b in tlasloop (returning early insideblas_workonly after checkingblas.is_empty() && waiting.is_empty() && wanted.is_empty()and rolling the frame budget).4.
[P1]#347,#349,#357—execute_copy+copy_waitingSilently Drop Copies From LRU-Evicted Source BLASescrates/victory-gpu/src/hwrt.rs:1680(copy_waiting),hwrt.rs:2516-2539(execute_copy;#347hwrt.rs:1586, 2270-2292),crates/victory-gpu/src/hwrt/budget.rs:158-162(BlasLru::copied).srcis evicted byevict_over_budget()(removed fromas_map, its rebuild recipe moved tolru.evicted).CopyRaytracingAccelerationStructure(dest, src)(e.g., compaction).execute_copylooks upmap.get(&src)(None), leavesis_blas = false, and returns without callinglru.copied(dest, src, frame)(makingBlasLru::copied'sevictedbranch dead code).destreceives neither a liveHostAsnor a rebuild recipe; oncesrcis freed, all TLAS instances pointing todestare permanently invisible.lru.evictedincopy_waiting/execute_copy, calllru.copied(dest, src, frame)wheneversrcis present inlru.recipesorlru.evicted(queuingdestfor rebuild if needed), and bumpas_map_version.5.
[P1]#357—HostHeap::mirrorPermanently Pins Stale / Empty TLAS SRVs in Shader-Visible Descriptor Heapscrates/victory-gpu/src/descriptor/host.rs:4193, 5793-5809, interacting withHostHeap::mirror(4702-4867) &is_texture_view(1925); alsocrates/victory-gpu/src/hwrt.rs:997(TODO(phase3)).HostHeap::mirrortranslates the console descriptor viahwrt::tlas_for_descriptor(console_va)and caches the resulting descriptor inself.madeandself.quickkeyed solely by title descriptor[tag, i, generation].empty_tlas) — or if the TLAS later grows beyond its current allocation (e.g. >4 MiB) and reallocates at a new host GPU VA — the title descriptor bytes do not change.HostHeap::mirrorhits its cache forever and keeps the stale/freed (or empty) TLAS GPU VA pinned in the shader-visible heap -> missing RT hits or GPU page fault (0x887A0006).is_texture_viewreturnstrueforView::Shader(0, Some(tlas_desc)), misrouting TLAS descriptor slots into texture handling. (The dedicated root-SRVstage.tlas_srvspath indraw.rsis unaffected.)D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTUREfromis_texture_view, defer TLAS mirroring until draw/dispatch (later = !for_draw), and bypassquick/key caching for RTAS SRVs (or include ahwrt::tlas_generation()bumped whenever a TLAS buffer is created/reallocated).6.
[P1]#347,#349,#357— Unsoundunsafe { std::env::set_var(...) }From Parallel Precompile Workers + Shader-Cache Key Mismatchcrates/victory-gpu/src/hwrt.rs:57-66(requested),crates/victory-gpu/src/shader_cache.rs:113-116(build).victory shaders/victory translate --warminvokeshader_cache::build()concurrently acrossstd::thread::scopeworkers without first runningmodules::all().VICTORY_HW_RT=1andVICTORY_BVH_BUILDER=1are set in the environment (e.g., toggled via the F1 menu), the first worker enteringhwrt::requested()executesunsafe { std::env::set_var("VICTORY_BVH_BUILDER", "0") }concurrently with sibling threads callingstd::env::var_os(...)-> Rust UB / process env data race.shader_cache::build()hashesVICTORY_BVH_BUILDERbeforehwrt::requested()mutates it, producing different cache keys between precompile (=1) and runtime (=0) -> 100% cache miss.unsafe { std::env::set_var(...) }fromhwrt::requested(). GateVICTORY_BVH_BUILDERconsumers on!crate::hwrt::requested()and normalize theVICTORY_BVH_BUILDERcache key entry identically insideshader_cache::build().7.
[P1]#349,#357— TOCTOU Unhandled Access Violation + Aliasing/Alignment UB Reading Live Title Memory Directlycrates/victory-gpu/src/hwrt.rs:2008-2026, 2142(prepare_triangles),crates/victory-gpu/src/hwrt/decoders.rs:139-276, 315-360.VICTORY_THIN=1or deferred/evicted BLAS rebuilds (queue.waiting/lru.wanted),prepare_trianglesanddecoders.rsrun asynchronously after the title thread has moved on.title_readable()(VirtualQuery) and then dereference raw title pointers (std::slice::from_raw_partsinprepare_triangles; rawread_unalignedloops indecoders.rs) without SEH protection (host::read_into).VirtualQueryand the read, the process crashes with an unhandledSTATUS_ACCESS_VIOLATION. Creating&[u16]/&[u32]over live concurrently-mutated and potentially unaligned title addresses inprepare_trianglesis also Rust UB.Vec<u8>via fault-safecrate::host::read_into/read_thereand decode from the owned copy.8.
[P1]#347,#349,#357—execute_build(TLAS): Missing Pre-Build UAV Barrier onn == 0,dst_inst_bufLeaked inNON_PIXEL_SHADER_RESOURCEon Early Return, &&[u32]UB on GPU-Writtenstats_rbcrates/victory-gpu/src/hwrt.rs:2200-2415(execute_build).n == 0orinstance_descs_va == 0, the compute remap dispatch and its trailinguav_barrier()are skipped, leaving an in-place TLAS build with no pre-build UAV barrier against earlier BLAS/TLAS work (WAR/WAW hazard).dst_inst_bufis transitioned toD3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE(hwrt.rs:2296) beforelease(scratch)andalloc_or_reuse_as(...). If either returnsNone,Lease::dropreturnsdst_inst_buftoLeasePoolstuck inNON_PIXEL_SHADER_RESOURCEinstead ofUNORDERED_ACCESS, corrupting the next frame's remap compute UAV write.pool.stats_rbcreates a shared&[u32]viaslice::from_raw_partsover persistently mapped readback memory concurrently written by GPUCopyBufferRegion(&pool.stats)(andpool.statsis shared unsynchronized across concurrent lists) -> Rust data-race UB.scratchand allocatetlasbefore transitioningdst_inst_buf; readstats_rbviaptr::read_volatile(or guard per-list / read after fence).9.
[P2]#347,#349,#357— DXR 1.1 Validation & Corner-Case Defectsprepare_aabbsstride validation (hwrt.rs:1797-1816): D3D12 requiresAABBs.StrideInBytesto be a multiple of 8 and>= 24; unaligned/small strides are passed straight toBuildRaytracingAccelerationStructure.prebuild_infoindex count1..=2(hwrt.rs:2573-2635): ClampingIndexCount(1..=2 -> 0) without clearingIndexFormattoDXGI_FORMAT_UNKNOWNfails D3D12 validation (IndexBuffernon-zero / non-UNKNOWN format withIndexCount == 0). Also raw pointer derefs inread_geometries/prebuild_infolack alignment/SEH guards.pipeline/host.rs:639:tlas_srvsroot descriptors passD3D12_ROOT_DESCRIPTOR_FLAG_NONE(D3D12 DXR spec recommendsDATA_STATICorDATA_STATIC_WHILE_SET_AT_EXECUTE/ proper volatility annotation, andNONEtriggers debug-layer warnings on root SRV RTAS bindings on some drivers; verifyDATA_VOLATILEis disallowed for RTAS whileNONEdefaults toDATA_STATIC_WHILE_SET_AT_EXECUTEonly in root sig 1.1 — explicitly setD3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATICorDATA_STATIC_WHILE_SET_AT_EXECUTE).sanitize.rs:410(SANITIZE_MOST = 65_535 * 64): Valid meshes witheff_vc > SANITIZE_MOSTare dropped wholesale instead of chunked/passed through when indices are clean.Target 1B — DXR 1.1 Traversal-Loop Lifter (
#354) & SM 6.6 Emitter (#352)#352(1cf49ae0, MERGED): Verified Clean — SM 6.6RayQueryopcodes178..=212,NoUnwind/ReadOnlyattributes,RAYTRACING_TIER_1_1(1 << 25->SFI0 0x10_0000),annotateHandle(16, 0),dx.resources{0, 4}, andPSV0Binding { kind: 4, dxil_kind: 16 }are all valid and passdxil.dll.10.
[P0]#354(Standalone Merge Hazard) — Disk Shader Cache Collides AcrossVICTORY_HW_RT=0/1& DropsHostShader::ray_querieson Cache Hitcrates/victory-gpu/src/shader_cache.rs:394, 430(pr354.patch).#354leavesshader_cache::build()withoutVICTORY_HW_RTand setsray_queries: Default::default()on cache decode.VICTORY_HW_RT=1writes SM 6.6RayQueryDXIL to disk; Run 2 withVICTORY_HW_RT=0hits that cache entry and loadsRayQueryDXIL with emptytlas_srvs->CreateComputePipelineStatefails (E_INVALIDARG) and breaksVICTORY_HW_RT=0users.VICTORY_HW_RT=1also hits the cache withray_queries = empty, causing PSO creation failure because the root signature omits thetlas_srvsdescriptors referenced by the cached DXIL.#357'sshader_cache.rskey +ray_queriesbinary serialization before or atomically with#354(never merge#354standalone).11.
[P0]#354—CallbackKind::BlocksEmits Malformed DXIL PHIs inblocks[0]and SSA Dominance Violations / Dropped Branch Arms atcb_commit_blkcrates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:348-450,crates/victory-shader/src/emit/lower/rayquery/analyze.rs:3149-3195, 4175-4226(find_callback_accumulator_next).blocks[0]: Whenblocks[0]has PHIs (e.g., an inner waterfall loop header), its original predecessorsearch_blkwas skipped (self.tail[search_blk] == None), soemit_rqomits the incoming(cb_body, value)edge when loweringblocks[0]'s PHIs ->dxil.dllvalidation failure.cb_commit_blk:emit_rq.rs:348-350redirects*merge_blocktocb_commit_blkwithout materializing*merge_block's PHIs. Meanwhilefind_callback_accumulator_next(analyze.rs:4196-4215) walks upward fromout_v, pops the first callback def/PHI it encounters, and immediatelybreaks. For any multi-arm callback branching into*merge_block,self.i32_of(acc.next_val)(emit_rq.rs:428) references a value defined in only one branch arm (which does not dominatecb_commit_blk->bitcode.rspanic ordxil.dlldominance error) and silently drops updates from the other branch arm(s).self.tail[search_blk] = Some(cb_body)(or explicitly feedcb_bodyfor external predecessors ofblocks[0]) while loweringblocks; (b) materialize*merge_block's PHIs incb_commit_blk(mapping each callback predecessor'sself.tail[pred]to its incoming value) and bindacc.next_val/commit_condto those materialized PHIs rather than single-arm defs.12.
[P0]#354— Non-Opaque Callbacks With EXEC-Masked / Branched Commits orhit_tri-Only Shadow Commits Silently Lift asCommitDecision::Never(orAlways)crates/victory-shader/src/emit/lower/rayquery/analyze.rs:2553-2607(find_triangle_hit_info).find_triangle_hit_infoonly recognizesv_cndmask_b32selecting betweenv_tandtmax_oldto produceCommitDecision::Mask.v_movcommit) or shadow/any-hit callbacks that only update a hit flag /hit_triregister without updatingtmaxfall through toCommitDecision::Never(analyze.rs:2604) — causing all alpha-tested geometry / alpha shadows to vanish completely.v_movpath can matchCommitDecision::Always(analyze.rs:2602), bypassing the alpha test entirely.cb_entryto the actual commit store/PHI update (includinghit_tri/state-only commits in shadow queries), and bail out of lifting (fall back to software BVH traversal) whenever the commit predicate cannot be proved exact, instead of defaulting toCommitDecision::Never.13.
[P1]#354— Loop-InvariantTMax(tmax_phi == None) Misidentified asTMin, Emitting Zero-Length Rays[TMax, TMax]crates/victory-shader/src/emit/lower/rayquery/analyze.rs:2253-2311, 3003-3054.RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCHdo not shortentmaxinside the loop, sotmax_phiisNone.analyze.rs:2254,tmax_phi.is_some() && ...evaluates tofalse, causing thetmaxoperand in the intersection comparison to be classified astmininstead oftmax.TraceRayInlineis emitted withTMin = tmax_val, TMax = tmax_val(zero-length ray -> 100% miss rate) and inverted callback guards.tmax_valdirectly against theimage_bvh_intersect_raytmaxsource SSA value even whentmax_phi.is_none(), before treating the other comparison operand astmin.14.
[P1]#354—InstanceInclusionMaskExtraction Truncates0xFF, Multi-Bit, and Dynamic Masks to0x01crates/victory-shader/src/emit/lower/rayquery/analyze.rs:1722-1730, 1879-1907.inst_dw0(v_lshrrev_b32/s_lshr_b32by24..=31), the extractor treats a single-bit check or arbitrary shift+mask pattern by folding to a constant1 << (shift - 24)or0x01without verifying that the following AND/compare tests only a single constant bit.0xFFtests are silently truncated to a single-bit mask (e.g.0x01), dropping all TLAS instances whose inclusion mask uses other bits.andmask or a dynamicInstanceMaskSSA value wired throughTraceRayInline'sInstanceInclusionMaskoperand); bail out to software traversal if the pattern is unrecognized.15.
[P1]#354—is_pure_bvh_internal_scratchSilently Zeroes Live-Out Rayorigin/dirHeader PHIscrates/victory-shader/src/emit/lower/rayquery/analyze.rs:3990-3995, 4083-4120.is_pure_bvh_internal_scratch(analyze.rs:4097-4106) treats any loop-header PHI whose in-loop back-edge def lies insideloop_blocks \ hit_and_cb_blocks(such as rayorigin/diroverwritten with object-space ray during TLAS->BLAS descent ininst_blk) as "pure BVH internal scratch", ignoring that its pre-loop incoming value is live-out across the loop (e.g., world-space ray origin/dir used after the query for lighting/reflections).q.exit, the lifter replaces it with constant0, corrupting post-trace shading math.origin/dir/tmin/tmaxheader PHIs fromis_pure_bvh_internal_scratch(any live-out register holding a pre-loop value restored on BLAS pop must resolve to its pre-loop incoming value or bail out, never0).16.
[P1]#354—emit_ray_queryOmits Outer-Loop Counter PHI Back-Edge Whenrpo[q.exit] <= rpo[q.latch](dxil.dllFailure)crates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:590-595,crates/victory-shader/src/emit/lower.rs:2864-2876.rpo[q.exit] <= rpo[q.latch]),emit_rq.rs:591(if self.rpo[q.exit] > self.rpo[q.latch]) skipsself.enter_loop(q.latch, q.exit, final_blk).final_blk-> malformed DXIL PHI rejected bydxil.dll.self.branch_edge/self.enter_loopunconditionally (or handle back-edge counter increment via the same helperLoweruses for normal back-edges whenself.rpo[q.exit] <= self.rpo[q.latch]).17.
[P1]#354— Template B (bvh32) Multi-ExitlatchSelection (max_by_key(rpo)) Drops Hits When Highest-RPO Exit Is an Early-Miss Blockcrates/victory-shader/src/emit/lower/rayquery/analyze.rs:737-767,crates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:590.q.latchas the predecessor ofq.exitwithmax_by_key(|&b| ir.rpo[b]).emit_rqmasqueradesfinal_blkasq.latch(self.tail[q.latch] = Some(final_blk)).q.exit's PHIs select the incoming value from the early-miss trampoline (typicallyhit = 0/ sentinel) instead of the hit-bearing exit -> all hits silently dropped.q.exitto agree on live-out hit/accumulator values (or explicitly classify the hit-bearing exit edge vs early-miss edge and reject ambiguous multi-exit layouts).18.
[P1]#354—trace_tlas_from_shrDropsaddr.dynamic2, Ignores Non-Zero Offset in Coalesceds_load_dwordx8/x16, Hardcodesnonuniform = false, & Unconditionally Zeroes Sharedload_sitecrates/victory-shader/src/emit/lower/rayquery/analyze.rs:330, 1209-1268,crates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:60-71.trace_tlas_from_shrinspectsaddr.dynamicbut ignoresaddr.dynamic2(two-term dynamic indexing) and assumes the TLAS VA sits at dword offset0inside a coalesceds_load_dwordx8/x16, binding the wrong root/table dword.nonuniformis hardcoded tofalseeven when the TLAS descriptor index is VGPR-divergent (NonUniformResourceIndexrequired by DXIL SM 6.6 -> UB / GPU hang on divergent TLAS arrays).s_load_dwordxNload_sitetodead_siteszeroes all dwords written by that coalesced load, clobbering adjacent non-TLAS constants packed into the sames_load_dwordx8/x16.addr.dynamic2.is_some()or when the TLAS load is part of a multi-field coalesceds_loadwhose other dwords have non-BVH uses; propagate lane-divergence tononuniform = true(annotateHandlewithNonUniformResourceIndex).19.
[P1]#354—dead_sitesIgnores Lane Guard,AttrSource::SingleCallsCommitted*()Unconditionally Under Lane Guard, & Inline Callback Truncates at First Nesteds_mov execcrates/victory-shader/src/emit/lower.rs:6557-6562,crates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:752-761,crates/victory-shader/src/emit/lower/rayquery/analyze.rs:3292-3310.lower.rs:6557-6562executesself.write(inst, reg, c, None)(guard = None) fordead_sites, clobbering inactive lanes' values inregto0instead of preserving them under the current EXEC guard.emit_rq.rs:752-761(AttrSource::Single) emitsCommittedTriangleBarycentrics/CommittedInstanceID/CommittedPrimitiveIndexunconditionally without gating onCommittedStatus() == COMMITTED_TRIANGLE_HIT(and executes even on lanes that never calledTraceRayInlinewhen the query was lane-guarded -> DXR 1.1 undefined behavior / TDR).analyze.rs:3292-3310terminatesCallbackKind::Inlineat the firsts_mov_b32/b64 exec, ...after the non-opaque branch; any nestedifinside the inline callback restoresexecearly and truncates the callback mid-body.self.guard()toself.writeinlower.rs:6560; gateCommitted*()getters onCommittedStatus() == COMMITTED_TRIANGLE_HIT(returning0/default otherwise); match the exact savedexecSSA value from the callback entrys_and_saveexec(not the firsts_mov exec).20.
[P2]#354— Opacity Polarity /FORCE_OPAQUEWithdyn_ray_flags, &Plan::is_eliminatedHidingCallbackKind::InlineOps FromLower::newcrates/victory-shader/src/emit/lower/rayquery/analyze.rs:386-393, 615-629, 916-930, 2452-2465,crates/victory-shader/src/emit/lower/rayquery.rs:365-373.cmpxopacity flag checks do not validate branch polarity, andFORCE_OPAQUEcan be ORed unconditionally even whendyn_ray_flagsdynamically requests non-opaque traversal.Plan::is_eliminatedskipsCallbackKind::Inlineinstructions (only exemptingCallbackKind::Blocks), causingLower::newto omit resources/barriers/wave requirements needed only inside an inline non-opaque callback.cmpxbranch polarity (bail if ambiguous), omit staticFORCE_OPAQUEwheneverdyn_ray_flagscan clear it, and exemptCallbackKind::Inline(block, start..end)sites inPlan::is_eliminated.Target 2 — Pre-Merge Verification of
.09Bugfix PRs (#355,#356,#358,#359)#358(e2282e17) — VERIFIED CLEAN (Green Light to Merge):ticketguard (s.lds_dwords < HOST_LDS_DWORDSwhen 1D group is wave-aligned),f32wavePrefixOp.f32unsigned flagu8::from(!float)(bitcode.rs:73-74, 912mapsBin::AddtofaddonTypeDef::Float), DPP lane clamping, andv_permlaneall_lane_blocks_nativeare all sound.#359(38d58eb9) — VERIFIED CLEAN (Green Light to Merge):watch::ask_restper-interval(first, last, asked_at)+ahead_epoch+insert_ahead_interval/advance_ahead_range,shadow::unregisterunlockingBUFFERSbeforehost::retire,lazy::forgetinDrop for Shadow, andxmem::shows_slices->has_lazy_overlap(verified lock orderPHYSICAL -> LAZYacross all callers inxmem.rs, zero AB-BA cycles) are all sound.21.
[P1]#355(b86ec6b6) —card_retire_fence()Under-Counts Unfolded Thin-ModeJob::ListsBatches & Lacksbury_lag, Allowing Concurrent COPY-Queue Zeroing / Heap Drop Over In-Flight Bufferscrates/victory-gpu/src/ahead.rs:159-160, 209-212, 270-272, 332-336, 395-401, 582-609(card_retire_fence,take_fenced,trim_fenced,CardZeroer::zero), interacting withcrates/victory-gpu/src/queue/behind.rs:543-554, 904-914andcrates/victory-gpu/src/host.rs:844-856.card_retire_fence()(ahead.rs:332-336) returnsstarted + queued, andCARD_POOLimmediately recycles slots (andtrim_card_pooldrops empty heaps) as soon asretire_fence <= finished.Job::Listsunder-count: Under defaultVICTORY_THIN=1,behind::submit(behind.rs:909) incrementsQUEUEDby 1 for a foldedJob::Lists(queue, recordings)batch, whichJob::unfold(behind.rs:550-552) later expands intoruns > 1GPU submissions (advancingSTARTEDbyruns). AnyCARD_POOLbuffer whose COM refcount reaches0while thatJob::Listsis queued (e.g.,uav_pool::give_uavsdropping overflow buffers, transientdetile/resource/textureuav_buffers, orVICTORY_BURY_LAG=0) gets stampedretire_fence = started + 1.finished >= started + 1),alloc_pooled_cardplaces a new buffer at the sameID3D12Heapoffset and executesCardZeroer::zero(CopyBufferRegionon its dedicated COPY queue) — ortrim_card_pooldrops theID3D12Heap— while submissionsstarted + 2..started + runsare still executing on DIRECT/COMPUTE -> D3D12 placed-resource aliasing UB / GPU page fault (0x887A0006).bury_lag/ idle-list gap: Whenstarted == finished && queued == 0(idle queue or recorded-but-unsubmitted command lists that reference the buffer by GPU VA, explicitly noted inhost.rs:844-850),card_retire_fence()returnsstarted == finished, recycling/zeroing immediately with zero grace window.CARD_POOLslot retirement and heap trimming on bothfence <= finished(withretire_fence = started + queued + crate::host::bury_lag().max(1)—host::bury_lag()is alreadypub(crate)in#359) andnow_ms.saturating_sub(freed_ms) >= REST_MS(matchingSharedPool's 500 ms rest window). (Verified:CardZeroer::zero'scrate::host::settle()only waits onLATERasyncMakeResident, not GPU queues, so it does not deadlock.)22.
[P1]#356(c96f79d5) —lds_waveForcessplit_lds+halves/pairson ALL Multi-Wave Wave64 LDS Compute Shaders on NVIDIA (host_max_wave() == 32), Breaking 32 KiB TGSM Shaders & Un-Widenable Shaderscrates/victory-shader/src/emit/lower.rs:1922, 1931, 1973-1974, 2023-2032, 2045(pr356.patch:34, 43, 52).#356changesone_wave && s.lds_dwords > 0tolet lds_wave = s.lds_dwords > 0 && (one_wave || x.native.wave64);(lower.rs:1922) to keep Wave64 on AMD RDNA 4 (host_max_wave() == 64) for multi-wave Wave64 LDS shaders.host_max_wave() == 32), however, every multi-wave (group > 64) Wave64 LDS compute shader withconsole_lanes == false(including shaders that use explicits_barriers and zero unbarriered intra-wave LDS!) now enterslower.rs:1931(if wave == 64 && host_max_wave() == 32 && (console_lanes || lds_wave)):lds_ok == true,lower.rs:1974setswave = 32; split_lds = s.lds_dwords > 0 && group > 32;unconditionally (even iflds_no_meetingexcluded every LDS access). Thenlower.rs:2023-2031addshalves(+1dword) +pairs(+9 * (group / 64)=+18..+144dwords). Any multi-wave Wave64 compute shader using> 8192 - (1 + 9 * (group / 64))dwords of TGSM (including 32 KiB /8192-dword shaders;#358only guardedticket, nothalves/pairs) now exceedsHOST_LDS_DWORDS(8192) atlower.rs:2808and fails to compile on NVIDIA.[WaveSize(64)]on NVIDIA): If the shader has an indirect exit (all_lane_blocks == None) or un-widenable divergent LDS (lds_ok == false),wavestays64andlower.rs:2045emitss.wave_size = Some(64)([WaveSize(64)]), which NVIDIA D3D12 rejects at PSO creation.halves+pairs+ group-widesplit_ldsbarriers on NVIDIA despite needing none.x.native.wave64expansion oflds_waveto hosts that actually support 64-lane waves (host_max_wave() >= 64), OR onhost_max_wave() == 32only entersplit_ldsfor!one_wave && !console_laneswhen the shader actually has unbarriered intra-wave LDS accesses (not inlds_no_meeting),lds_ok == true, ands.lds_dwords + 1 + 9 * (group / 64) <= HOST_LDS_DWORDS(never emittings.wave_size = Some(64)on a Wave32-only host when!console_lanes). (Note:#356'sscc_somewidening and rawVCCbranch fixes are verified clean.)Target 3 — Re-Check of
#341,#342,#343(Pass #1 Findings#13,#14,#16,#17)#341(3bf8fad1) — Finding #16 RESOLVED -> VERIFIED CLEAN (Green Light to Merge):uniform_scalars()incrates/victory-shader/src/emit/lower.rstracking wave-uniform SGPRs/SCC across uniform blocks while explicitly excludingv_readfirstlane,waterfall.reads,waterfall.loads, masks, and divergentAtom::Uniformregions;memory_smemnow passes!uniform_addrtomemory_view_with.#342(f204e9cb) — Findings #13 & #14 RESOLVED -> VERIFIED CLEAN (Green Light to Merge):by_address_inallocatesshared_buffer_staging(len)beforemap_buffer_tiles, andcrates/victory-gpu/src/host/reserved.rsaddsunmap_and_retire(D3D12_TILE_RANGE_FLAG_NULL+ synchronousSetEventOnCompletionwait +host::retire(heap)) on signal/wait error paths.DIRTY_WINDOW/free_pagesheuristic with monotonic(dirty_epoch, refreshed_epoch)(refresh_if_dirtyadvancesrefreshed_epochonly at submission viadefer_host) plusland_and_refresh/SUBMIT_REFRESHES->batch.add_fresh()(andmemory.rsplace/takealready callwatch::wrote).#343(de84a1e1) — Finding #17 STILL OPEN (Unchanged Since Pass #1):de84a1e1is identical to Pass #1: permanent per-frame fullbehind::drain()viaSIZES_SEEN+THIN_DONE < THIN_QUEUED, theSIZES_QUEUED/THIN_DONEload-order race inhas_pending_sizes(), andQuiet::wakenear-threshold early return all remain unresolved.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T19:11:04Z.
Deep Static Logic Audit — Pass #3 (Final Pre-Merge Verification)
Strictly read-only verification of the updated HW-RT stack (
#343,#347,#349,#354,#357),.10release candidates (#356,#360), and newly merged performance PRs (#363,#365).Merge-Readiness Table
#3436b9c8435#17cleanly resolved (per-recordinghas_sizes, Acquire/Release handoff, unconditionalQuiet::wakereset).#356b56e2809#22cleanly resolved (host_max_wave() >= 64guard); zero NVIDIA Wave32 regressions.#3606a8d28d5[P2])[P2]stale-event fence-wait check inwait_for_fence.#3475140ce43[P1])#1,#3,#4,#6,#8,#9cleanly resolved.#2(emit_postbuild/read_shadows) has 4RESOURCE_BARRIER_BEFORE_AFTER_MISMATCHpaths.#349769d11c2[P1], 2[P2])#7cleanly resolved. Inherits#347emit_postbuild[P1], plus unboundedvec![0u8; ...]OOM-abort indecoders.rs([P2]) and standaloneshader_cache.rsvsintersect.rsmismatch ([P2]).#3547ae7398d[P0], 3[P1], 4[P2])#10,#13,#14,#16,#17cleanly resolved + standalone cache safety & zero RT-off impact confirmed. Remaining/new bugs inCallbackKind::BlocksPattern C & PHI resolution, live-outorigin/dirzeroing, opacity polarity (st.reach), and Pattern Ainvalidbreak.#357be6135ac[P1], 2[P2])#1(AS reuse/publish),#3,#4,#6,#7,#8,#9cleanly resolved. Remaining[P1]s: bindlessTlasSource::Heapstale/null RTAS SRVs + GPU BLAS UAF viaHostHeap::kept+ submit-timesync_heapslag; inherited#347emit_postbuild[P1].#363(merged)60a88573victory-sweepthread,bury_lag=16/landed_lag=8,pool::REST=500ms— zero P0/P1 concurrency or ordering bugs.#365(merged)6042ed29(index/64)%parts) + fusedFillsOnlycard_steps— zero P0/P1 concurrency or ordering bugs.Zero-Impact Verification (
VICTORY_HW_RTUnset or0)#347,#349,#354,#357: CONFIRMED strictly zero behavioral impact whenVICTORY_HW_RTis unset or0— including standalone#354disk shader cache safety (shader_cache.rsnow keysVICTORY_HW_RT=1/VICTORY_HW_RT_LIFT=0, normalizesVICTORY_BVH_BUILDER, and round-tripsHostShader::ray_querieswith zero extra bytes written when off).tlas_for_descriptorreturnsSome(empty_tlas)on miss in#347/#349vsNonein#357; align toNonebefore merging.)Section 1 — Verified Clean Sign-Offs (
#343,#356,#363,#365)#343(6b9c8435) — Pass #1 Finding#17RESOLVED:SIZES_SEEN/THIN_QUEUED/THIN_DONEwith per-pipelinepipeline::maybe_size_query(threads == [1,1,1],SLOT_MEMORY,builder || (stores && stores_by_address)) +Recording::has_sizes+THIN_SIZES_QUEUED/THIN_SIZES_DONE, eliminating per-framebehind::drain()on frames without size queries.Job::unfold(SIZES_QUEUED->THIN_SIZES_DONE),Job::Run/Job::Joined(PENDING_FLIGHT->SIZES_DONE), andhas_pending_sizes()(THIN_SIZES_DONE->THIN_SIZES_QUEUED->SIZES_DONE->SIZES_QUEUED).Quiet::wake()unconditionally locksself.stateand clearsstreak/audit/rangeeven for near-threshold streaks.#356(b56e2809) — Pass #2 Finding#22RESOLVED:let lds_wave = s.lds_dwords > 0 && (one_wave || (x.native.wave64 && host_max_wave() >= 64));(lower.rs:1930) cleanly restricts multi-wave Wave64 LDSWaveSize(64)to 64-lane hosts (RDNA 4), leaving NVIDIA (host_max_wave() == 32) untouched (wave_size = None,split_lds = false, full 32 KiBHOST_LDS_DWORDSintact, verified by new unit tests).#363(60a88573, merged) — Sanity Check CLEAN:sweep_once()retires GPU resources viahost::retireordrop_aside(afterstrong_count == 1 && references == 1 && long_ago), andresource::let_go_idle/slot_evictreleasetextures()before descriptor calls (no AB-BA cycle withHostHeap::mirror).pool::REST = 500msruns strictly afterbury_lagdrop;landed_lag = 8only drains already GPU-completedline.landedflights.#365(6042ed29, merged) — Sanity Check CLEAN:bucket_constant_opspartitions disjoint 64-slot blocks per worker ((index / 64) % parts);HostHeap::constant_slots_batchsplits before duplicate slot indices (cbv_chunk_len), guards!self.twins.is_empty()/self.sampler, and uses linearself.cpu_inner(idx, true)with per-thread disjoint 64-slot CPU staging slices.card_steps::scan_and_takefalls back immediately totake_steps_fullon anyStep::Copy/Placed/Runand mirrorsblocked_by+copied_readexactly onFillsOnlysubmissions.Section 2 — Remaining / New Bugs in
#347,#349,#357(HW-RT GPU/HLE)(Pass #2 findings
#3,#4,#6(in#347/#357),#7,#8,#9, and#1's AS pool/refit/submit-time publication are all cleanly resolved.)1.
[P1]#357— Bindless (ResourceDescriptorHeap[]) RTAS SRVs Stay Permanently Null/Stale, Risk GPU BLAS UAF viaHostHeap::kept, & Lag Behind Same-Submission TLAS Buildscrates/victory-gpu/src/hwrt.rs:304-316(HostAs::drop),hwrt.rs:3193-3206(tlas_for_descriptor);crates/victory-gpu/src/descriptor/host.rs:4752-4943(HostHeap::mirror),descriptor.rs:493-738(sync_heaps);crates/victory-gpu/src/host.rs:8144-8290(Host::submit).#354lowers dynamic TLAS descriptors toTlasSource::Heap(ResourceDescriptorHeap[...]). A title creates a persistent RTAS SRV at shader-visible heap slotSpointing toconsole_tlas_vaonce and never rewrites slotS's bytes.Sis mirrored before the first TLAS build submits,tlas_for_descriptorreturnsNone(writingLocation: 0). Neitherdraw.rs(only mirrors root tables) norsync_heaps()(only scans dirty title-memory heap pages andCONSTANT | PLACEDbeforeslots) ever re-callsHostHeap::mirror(S, ...)afterTLAS_GENERATIONbumps -> slotSremains null forever.tlas_for_descriptorreturns onlyID3D12Resource(T1.buffer) toHostHeap::kept[S], notArc<HostAs>. On Frame 2+,execute_buildpublishesT2(T2.gpu_va != T1.gpu_va) and retiresShown(T1). SlotSis never refreshed (still exposesT1.gpu_va). OnceShown(T1)drops pastbury_lag,HostAs::dropruns forT1and retiresT1.refs(Arc<BlasRefs>). Whileis_sole_com_ownerkeepsT1.bufferout ofas_pool, nothing keepsT1.refsalive — rebuilt/evicted BLASes drop their lastArc<HostAs>, enteras_pool, and are overwritten/freed whileResourceDescriptorHeap[S]still traversesT1.gpu_vainto their GPU VAs -> GPU page fault / TDR.Host::submitrunsbegin_sync_heaps()beforelist.run_deferred()(which runsshow()), anddraw.rsmirrors table slots at recording time beforeshow(), so heap-mirrored RTAS SRVs seeNoneon Frame 1 andT_prevon FrameNwhenever TLAS build and trace share a submission.(index, handle)perHostHeapand retainArc<HostAs>(e.g., via an opaqueBox<dyn Any + Send>pin retired alongsidekept) soT1.refsremains alive while any slot exposesT1. Immediately afterlist.run_deferred()inHost::submit(wheneverTLAS_GENERATIONchanged), refresh tracked RTAS slots acrossSHADER_HEAPSbeforeExecuteCommandLists.2.
[P1]#347,#349,#357—emit_postbuild+ Localread_shadowsEmits D3D12RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH#347crates/victory-gpu/src/hwrt.rs:1739, 1865, 1954, 1986, 2053, 2232, 2248, 2418-2521;#357crates/victory-gpu/src/hwrt.rs:1837, 1963, 2079, 2145, 2207, 2290, 2469, 2485, 2655-2758(prepare_aabbs,prepare_triangles,execute_blas_batch,execute_build,emit_postbuild).prepare_*insertssh.bufferonce intoread_shadowsfor the whole batch. Wave 1'semit_postbuildremovessh.bufferand emitsNON_PIXEL_SHADER_RESOURCE -> COPY_DEST -> COMMON. Wave 2 readssh.buffer(implicitly promotingCOMMON -> NON_PIXEL_SHADER_RESOURCE), then Wave 2'semit_postbuildseesread_shadows.remove == falseand emitsCOMMON -> COPY_DESTwhilesh.bufferis inNON_PIXEL_SHADER_RESOURCE.sh.bufferduring prep before Wave 1 executes; if Wave 1 writes postbuild tosh.bufferwhile only Wave 2 reads it, Wave 1 emitsNON_PIXEL_SHADER_RESOURCE -> COPY_DESTon a buffer still inCOMMON.return Noneafterread_shadows.insert:prepare_aabbs(#357 hwrt.rs:1963) andprepare_triangles(#357 hwrt.rs:2079, 2145) insertsh.bufferbefore alignment/IB/work()checks that canreturn None, leavingsh.bufferinCOMMONwhileemit_postbuildtransitions fromNON_PIXEL_SHADER_RESOURCE.HostList:read_shadowsis created fresh perexecute_blas_batchchunk and perexecute_build; anysh.bufferalready promoted toNON_PIXEL_SHADER_RESOURCE/GENERIC_READearlier onlistgets transitioned fromCOMMON.HostList(populated only at the exact point a sanitize dispatch orBuildRaytracingAccelerationStructurewave actually records a read ofsh.buffer, re-inserted on every subsequent wave/chunk read, and reset toCOMMONafteremit_postbuild), or use Enhanced BarriersD3D12_GLOBAL_BARRIER(SYNC_ALL / ACCESS_COMMON) when supported.3.
[P2]#349,#357— Unboundedvec![0u8; ...]Allocations Beforeread_intoindecoders.rsCan OOM-Abortcrates/victory-gpu/src/hwrt/decoders.rs:206-210(decode_title_meshlet_ib),decoders.rs:315-325(decode_title_quant24_vb).num_packed_tris(w1) orvcount * actual_strideallocate multi-GiB/TiBvec![0u8; ...]buffers beforecrate::host::read_intogets a chance to reject the unmapped range, triggering an OOM abort.vertex_indices_offandvbytesto a sane ceiling (e.g.64 << 20) and/or useVec::try_reserve_exact, returningNoneon failure.4.
[P2]#349(standalone, before#354) —shader_cache.rsNormalizesVICTORY_BVH_BUILDER=1 -> "0"Whileintersect.rsStill Reads Raw Env#349crates/victory-gpu/src/shader_cache.rs:48-57, 111-116vscrates/victory-shader/src/emit/intersect.rs:105, 120.#349alone (before#354) hashesVICTORY_BVH_BUILDER=0underVICTORY_HW_RT=1 VICTORY_BVH_BUILDER=1 VICTORY_BVH_MISS=1, whilevictory-shader/src/emit/intersect.rsstill reads rawVICTORY_BVH_BUILDER=1, storing software-BVH shaders under the=0cache key. (Already fixed in#357via#354.)VICTORY_HW_RT=1check tointersect.rsin#349(or defer normalizingVICTORY_BVH_BUILDERinshader_cache.rsuntil#354).5.
[P2]#357—null_rtas_view&should_pin_descriptorGate onhwrt::requested()Instead ofhwrt::active()crates/victory-gpu/src/descriptor/host.rs:4905-4910, 6564-6574.VICTORY_HW_RT=1(requested() == true,active() == false),null_rtas_viewcallsCreateShaderResourceView(None, &RAYTRACING_ACCELERATION_STRUCTURE, at)on a non-DXR device, andshould_pin_descriptorreturnsfalse, repeating the invalid call on every draw.crate::hwrt::requested()withcrate::hwrt::active()atdescriptor/host.rs:4908, 6565.Section 3 — Remaining / New Bugs in
#354(7ae7398d, DXR 1.1 Traversal Lifter)(Pass #2 findings
#10,#13,#14,#16,#17are cleanly resolved;#11,#12,#15,#18,#19,#20are mostly resolved with the specific remaining/introduced defects below.)6.
[P0]#354—find_triangle_hit_infoPattern C Miscompiles EXEC-MaskedCallbackKind::BlocksCommits AND Opaque-Onlytri_merge_blockCommits asCommitDecision::Alwayscrates/victory-shader/src/emit/lower/rayquery/analyze.rs:3528, 3530-3552(find_triangle_hit_info).CallbackKind::Blocks(:3528): HardcodesCallbackKind::Blocks { .. } => Some(CommitDecision::Always)without inspectingst.guards[site.0][site.1]. Any multi-block callback whose dominating block narrowsEXECvias_and_saveexec/v_cmpxbeforev_mov_b32 v_tmax, v_t(orv_state = 0/v_hit_tri = cur_tri) emits unconditionalCommitNonOpaqueTriangleHit.tri_merge_block[merge_start..](:3530-3552): Candidate values (v_t,cur_tri,cur_inst,cand_u/v/ff) are defined before the callback (!cb_site_set.contains(&def_site)), sosrc_guardis alwaysNoneand:3550unconditionally yieldsSome(CommitDecision::Always)without checkingst.guards[tri_merge_block][j]. ACommitDecision::Never(always-reject) callback followed by an opaque-onlys_andn2commit move silently lifts asCommitDecision::Always(committing every non-opaque hit).:3528, inspectst.guards[site.0][site.1]: emitCommitDecision::GuardBool(gb)(requiringbool_dominates_cb_commit(gb), elseErr) whenSome(gb), andAlwaysonly whenNone. For!cb_site_set.contains(&site), test(st.reach[tri_merge_block], st.guards[tri_merge_block][j])against the non-opaque entry masknonop_bool: skip settingguard_commit_decisionwhen disjoint (opaque-only), bail on partial overlap, and emitAlwaysonly if all non-opaque exit lanes execute it.7.
[P0]#354—CallbackKind::BlocksPHI Resolution Silently Zeroes Live Lazy-Param/Missing Arms AND Aborts Lowering on Unread Lane-Mask/SccPHIscrates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:469-505(cb_data_phis),emit_rq.rs:510-572(merge_blockPHIs).:493,:542): Both loops match(Some(Val::Missing(_)) | None, false) if numbers => self.s.m.i32(0)without resolving lazy user-data root constants (self.params, never eagerly inserted intoself.vals) and without checkingself.dead(arg, ...)or!self.read_phis.contains(&phi.value)(unlikeLower::fill_phisatlower.rs:14056-14069). Any live callback ormerge_blockaccumulator PHI joining an I32 arm with an unreadself.paramsSGPR silently replaces that arm with0.:496-498,:545-547):emit_rq.rs:388-408creates adata_phifor every non-EXEC PHI inblocks(includingvcc_lo/lane-mask SGPRs andReg::Scc), and:510-572iterates every non-EXEC PHI in*merge_blockregardless of accumulator use. Becausev_cmp_*/v_add_co_*storeVal::Missing("a lane mask read as data")andst.masks.contains_keysetsnumbers = false, any multi-block callback whose branches writevcc/lane-mask/Sccfails at:496or:545, aborting lifting for the entire shader.Lower::fill_phisincb_data_phis(resolveself.params/self.lazy_barycentric; substitute0/falseonly when!self.read_phis.contains(&phi.value)or(numbers && self.dead(arg, ...))). Inmerge_blockPHIs (:510-572), materialize only PHIs referenced byq.accumulators, resolvingself.paramsand never zeroing live missing arms.8.
[P1]#354—is_pure_bvh_internal_scratchStill Zeroes Mutated Live-Outorigin/dirBack-Edge Valuescrates/victory-shader/src/emit/lower/rayquery/analyze.rs:5093-5126(classify_live_outs),analyze.rs:5363-5410(is_pure_bvh_internal_scratch).bvh64), entering a BLAS transformsorigin/dirinto object space and popping back to TLAS restores world-spaceorigin/dirviav_cndmask_b32(v_orig_next).ray_input_vals(:5093-5100) only expandsmov/PHIs (notv_cndmask_b32), sov_orig_nextmissesray_input_vals, hitsdef_instinloop_blocks \ hit_and_cb_blocks, setssaw_bvh_internal_def = true(withtouches_preloop_or_headerdiscarded at:5405), and silently emitsLiveOutKind::DeadZero(0.0) for post-looporigin/dir.classify_live_outs(:5115), forbidis_pure_bvh_internal_scratchwheneverheader_phi.is_some_and(|hp| ray_input_vals.contains(&hp)), and insideis_pure_bvh_internal_scratchreturnfalsefor anydef_instwhose explicit reads reachray_input_vals.9.
[P1]#354— Non-Callback Opacity Culling Polarity Dropsst.reach[search_blk]Whenst.guards[search_blk][ci]IsSome(...)crates/victory-shader/src/emit/lower/rayquery/analyze.rs:2908, 3057-3071(find_triangle_hit_info).structure.rs:865factorsst.reach[b]out ofst.guards[b][i]. Usingst.guards[search_blk][ci].unwrap_or(st.reach[search_blk])(:2908) discardsst.reach[search_blk]whenever an instruction has an inner EXEC guard (v_cmpx/s_and_saveexec), causingq_true/q_falseto miss branch-carriedCULL_OPAQUE/CULL_NON_OPAQUEpredicates and fall back toRAY_FLAG_FORCE_OPAQUE.(st.reach[search_blk], st.guards[search_blk][ci], extra)incommit_condsand include(reach, true)alongsideguardin bothq_trueandq_false.10.
[P1]#354— Pattern A (MergeEdges) EarlybreakoninvalidSilently Drops Inconsistent Merge PHIscrates/victory-shader/src/emit/lower/rayquery/analyze.rs:3307-3317(find_triangle_hit_info).cb_preds = [B_weird, B_commit]hits an unrecognized expression onpred 0(B_weird),invalid = true; break;runs whilecommitsis still empty, makingif invalid && !commits.is_empty()(:3313) false and skipping the PHI instead of returningErr. A second PHI matching[B_weird -> old, B_commit -> cur]can then succeed and dropB_weird's commit effect.cb_preds(collecting any committing preds) instead ofbreaking oninvalid = true, then fail at:3313wheneverinvalid && !commits.is_empty().11.
[P2]#354— Remaining Edge Casesemit_rq.rs:367-379vslower.rs:2899-2916):Lower::runalready allocates a counter PHI for inner loops incallback_blocks;emit_rq.rs:376allocates a second one and overwritesself.counters[b], leaving the first with 0 incoming edges (dxil.dllfailure underVICTORY_SHADER_OPT=0). Fix:if is_hdr && !self.counters.contains_key(&b).bool_dominates_cb_commitomitsAtom::Uniform(analyze.rs:3206-3212):Atom::Uniform(av)falls into_ => true, risking DXIL SSA dominance violation incb_commit_blk. Fix: checkval_dominates_cb_commit(av).load_sitedead-site check (analyze.rs:434-451):no_external_usestestsall_lifted_blocks(which includescallback_blocks,inline_callbacks, andheader), potentially zeroing a sibling value loaded in the same coalesceds_loadand used inside a callback/header PHI. Fix: testplan.is_eliminated(u.0, u.1)andplan.skipped_blocks.contains(&pb) && !plan.callback_blocks.contains(&pb).find_invariant_preloop_source(analyze.rs:5302) usescontinueinstead ofreturn Nonewhenseen.len() > 128;extract_callback_regionCase 2 (analyze.rs:4386-4391) should requiresaved_exec.is_some()so an inners_mov tmp, exec; v_cmpx; s_mov exec, tmpcannot truncate early.Section 4 —
.10Release Candidate#360(6a8d28d5, NativeF12Screenshots)All D3D12 backbuffer state transitions (
COPY_DEST -> COPY_SOURCE -> PRESENTon bothcomposedand non-composedpaths),execute_own_with_fencefence capture (*submittedonself.queue), swapchain slot lifetime (p.ahead[i].1 = flown), non-stalling background PNG encoding,MAX_IN_FLIGHT = 4, andRGBA8/BGRA8/BGRX8/R10G10B10A2/R16G16B16A16_FLOATconversions are verified clean.12.
[P2]#360—wait_for_fenceTrustsWAIT_OBJECT_0Without Re-CheckingGetCompletedValue() >= targeton Reused Auto-Reset Eventcrates/victory-gpu/src/host/screenshot.rs:441-461(wait_for_fence), called fromworker_loop(screenshot.rs:465-470).worker_loopcreates a singleEventHandle(:466) reused across all screenshot jobs.:460, e.g. during a heavy shader compile/stall),fence.SetEventOnCompletion(target1, event.0)remains armed; whentarget1finishes shortly afterward,event.0becomes signaled.target2 > target1) callsSetEventOnCompletion(target2, event.0)andWaitForSingleObject(event.0, 5_000), which returnsWAIT_OBJECT_0immediately fromtarget1's stale signal beforetarget2completes.:443(WAIT_OBJECT_0 => return fence.GetCompletedValue() != u64::MAX) returnstruewithout checking>= target, soprocess_jobmaps and readspending.bufferwhile the GPU is still executingCopyTextureRegion.WAIT_OBJECT_0, checklet now = fence.GetCompletedValue(); if now == u64::MAX { return false; } if now >= target { return true; }and continue the wait loop (re-armingSetEventOnCompletionif needed) untilnow >= target.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T21:55:01Z.
Deep Static Logic Audit — Pass #4 (Final Quick Sign-Off)
Strictly read-only verification of:
RayQuerysuperset PR#357(363edc51, incorporating#347,#349, and#3545b974f32) against Pass #3 findings#1–#11(7355749301)#331(100015c0) against Pass #1 finding#12Merge-Readiness Table
#331100015c0#12cleanly resolved (ReadMostlythread-localHELDre-entrant guard tracking,!SendReadGuard, strict0..=SHARDSwrite lock ordering,PLACED_TEXTURESappend-only verified). Zero soundness or deadlock issues.#357(superset incl.#347+#349+#354)363edc51[P0]regression + 1 minor[P2])#1and#3–#11are all cleanly resolved (#3545b974f32has zero P0/P1 blockers). However, commita4aab821's ungatedHostList::shadow_to/shadows_commonbreaks theVICTORY_HW_RT=0/unset zero-impact guarantee and leavesShadow::bufferinCOPY_DEST/UNORDERED_ACCESS/GENERIC_READacross untracked descriptor-table, root-SRV/CBV, andtexture.rsaccesses.Target 1 — PR
#357(363edc51) Verification of Pass #3 Findings#1–#11[P1](#357bindless RTAS refresh + BLAS pins + submit-time lag)tlas_for_descriptor(hwrt.rs:3167-3185) returns(gpu_va, resource, Arc<HostAs> pin);HostHeap::kept_pins+rtas_slotsretain/retire pins acrosskeep_view,unmake,make_null_settled,release, andrelease_batch;descriptor::refresh_rtas_heaps()runs inhost.rs:8159, 8585right afterdrop(h.heaps)/drop(heaps_synced)and beforeExecuteCommandLists.[P1](emit_postbuildbarrier mismatches)[P0]read_shadowswas replaced withHostList::shadow_to(a4aab821), which fixes intra-hwrttransitions but introduces the[P0]ungated state-tracking regression below.[P2](decoders.rsOOM-abort allocs)MAX_DECODE_READ_BYTES = 64 << 20,alloc_zeroed+try_reserve_exact,try_reserve_stage, and checked multiplies (hwrt/decoders.rs:146-366).[P2](shader_cache.rsvsintersect.rs)intersect.rs:93-127(bvh_override_active) matchesshader_cache.rsnormalization in lockstep.[P2](hwrt::active()gating)null_rtas_view,should_pin_descriptor,tlas_gen,ListViews,make_at_inner, andmirrornow gate oncrate::hwrt::active().[P0](#354Pattern C EXEC-masked & opaque-only commits)blocks_site_decision+tri_merge_blockguard/complement BDD checks (analyze.rs:3504-3779) properly emitGuardBool,OpaqueOnly, or bail on ambiguity (dxil.dll-validated tests added).[P0](#354CallbackKind::BlocksPHI resolution)[P2])collect_rq_needed_vals,resolve_lazy_rq_phi_input, andresolve_rq_phi_arm(emit_rq.rs:492-615, 1126-1255) resolve lazyself.params/lazy_barycentric, avoid aborting on unreadvcc/SccPHIs, and bail on live missing arms. (See minor[P2]#2 below.)[P1](#354mutated live-outorigin/dir)classify_live_outsadds ray-input header PHI back-edges toray_input_vals, skipsis_pure_bvh_internal_scratchonray_input_valsheader PHIs, and tracesmov/cndmask/cselectreads (analyze.rs:5238-5276, 5546-5558).[P1](#354opacity polarityst.reach)commit_condscarries(st.reach[search_blk], st.guards[search_blk][ci], extra)intoq_true/q_false(analyze.rs:2897-3065).[P1](#354Pattern Ainvalidbreak)breaks removed (analyze.rs:3294-3316), so inconsistent merge PHIs reliably returnErr.[P2](#3544 helper edge cases)emit_rq.rs:374),Atom::Uniformadded tobool_dominates_cb_commit(analyze.rs:3209), heap TLAS dead-site check usesplan.is_eliminated(analyze.rs:437-441),seen.len() > 128returnsNone(analyze.rs:5456), andextract_callback_regionrequiressaved_exec.is_some()(analyze.rs:4524-4531).Blocking & Remaining Findings on
#3571.
[P0]#357— UngatedHostList::shadow_to/shadows_commonBreaksVICTORY_HW_RT=0Zero-Impact & Causes D3D12 State Mismatches Across UntrackedShadow::bufferAccessescrates/victory-gpu/src/host/place.rs:231, 237, 242, 243, 249, 284, 309-370(HostList::shadow_to,HostList::shadows_common)crates/victory-gpu/src/draw.rs:2131, 2150, 2596, 5995crates/victory-gpu/src/indirect.rs:539, 541, 644, 652crates/victory-gpu/src/host.rs:9196(HostList::close)VICTORY_HW_RTunset/0ANDVICTORY_HW_RT=1):VICTORY_HW_RTis unset/0:shadow_toandshadows_commonare not gated oncrate::hwrt::active(). Every VB bind, IB bind, root UAV bind, indirect clamp/batch, andplace.rscopy on every frame locksself.deferred(), hashes intoshadow_states, clonesID3D12Resource, and emits explicitResourceBarriers (plus ashadows_common()barrier batch atlist.close()).Shadow::bufferconsumers (onVICTORY_HW_RT=0AND=1): Previously,Shadow::bufferremained inD3D12_RESOURCE_STATE_COMMON(relying on implicit buffer promotion, with explicit copy paths liketexture.rs:463-475andcard_steps.rs:2528returning toCOMMONimmediately). Because descriptor-table SRVs/CBVs/UAVs (HostHeap), root SRVs/CBVs (draw.rs:2376-2489),texture.rs:463-475, andlist.rscopies do not callshadow_to:place.rsCOPY_DESTtrap (place.rs:237, 243, 249): Any placed copy transitionsto.buffertoCOPY_DESTand leaves it stuck there untillist.close(). Any subsequent shader SRV/CBV/UAV (table or root) onto.bufferaccesses a resource explicitly inCOPY_DEST(D3D12 error / stale GPU reads), andtexture.rs:463(COMMON -> COPY_DEST) hitsRESOURCE_BARRIER_BEFORE_AFTER_MISMATCH.draw.rs:2596UNORDERED_ACCESStrap:bind_root_uavleavess.bufferinUNORDERED_ACCESSuntillist.close(); subsequent descriptor-table SRVs/CBVs, root SRVs/CBVs, ortexture.rs:463read a buffer explicitly locked inUNORDERED_ACCESSwithout a barrier.draw.rs/indirect.rsGENERIC_READtrap: VB/IB/indirect bindings leaves.bufferinGENERIC_READ(disabling implicit promotion fromCOMMON), so any subsequent descriptor-table UAV write hits a resource explicitly locked inGENERIC_READ.shadow_to/shadows_commonhooks indraw.rs,host/place.rs,indirect.rs, andhost.rs:9196soShadow::bufferstays inCOMMONoutsidehwrtandVICTORY_HW_RT=0/unset has strictly zero behavioral or performance impact.hwrt.rs(hwrt::active()only), eliminate legacyCOPY_DESTbarriers onsh.bufferinemit_postbuild(hwrt.rs:2699-2736) by writing the 8–16 byte postbuild result intosh.buffervia a tiny 1-thread compute shader (SetComputeRootUnorderedAccessViewonsh.gpu(dest_va)+ plainUAVbarrier —Shadow::bufferalways hasALLOW_UNORDERED_ACCESSand works cleanly fromCOMMON/implicit promotion with zeroBEFORE_AFTERmismatch against prior draws), or via Enhanced Barriers (ID3D12GraphicsCommandList7::BarrierD3D12_GLOBAL_BARRIER) where supported.2.
[P2]#357(inherited from#354) —collect_rq_needed_valsDoes Not Seed Fromself.read_phiscrates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:1126-1198(collect_rq_needed_vals),emit_rq.rs:503-552(cb_data_phis).Lower::fill_phis's transitiveread_phisclosure (lower.rs:14018-14032) has not run yet whenemit_ray_queryresolvescb_data_phis. Inside a multi-blockCallbackKind::Blockscallback, if PHIP2(taking a lazyself.paramsarm) feeds only PHIP1, andP1is read only by an instruction (not directly via PHIs intoacc.next_val/commit_decision),self.read_phiscontainsP1but notP2, soP2hasneeded == falseand silently zeroes its lazyself.paramsarm atemit_rq.rs:551.collect_rq_needed_vals'sworkqueue with allphi.valueincb_set/merge_blockwhereself.read_phis.contains(&phi.value)so PHI-to-PHI chains inside callbacks propagate transitively.Target 2 — PR
#331(100015c0) Verification of Pass #1 Finding#12crates/victory-gpu/src/listcpu.rs:204-377(Held,HELD,ReadMostly::reading,Drop for ReadGuard): re-entrantread()/try_read()on the sameReadMostly(h.of == me) incrementsh.guardsin TLSHELDand returnsReadGuard { own: None, ... }without re-acquiring any WindowsSRWLOCK, eliminating self-deadlock behind waiting writers (even whensharded()flips viaVICTORY_AB).ReadGuard<'a, T>containsOption<RwLockReadGuard<'a, ()>>, keeping it!Send; dropping guards in any order decrementsh.guardsand releases_lockoutside theRefCellborrow only whenh.guards == 0. TLS-teardown / ID-collision paths safely fall back toown: Some(lock).write()andtry_write()acquirelocks[0..=SHARDS]in strict ascending order; productionReadMostlyIDs are disjoint (0 = VIEWS,1 = BUFFERS,2 = LOOSE).VICTORY_PLACED_SEEN(resource.rs:607-624): verifiedPLACED_TEXTURESis strictly append-only acrossvictory-gpu(no.remove()/.clear()), so thread-localRememberedentries cannot dangle.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T23:54:27Z.
Deep Static Logic Audit — Pass #5
Target 1: Final Merge Sign-Off on PR
#357(feat/hw-rt-phase3-gpu-dispatch-binding@5d0eedb)Audit covers
d065fff,65e3d13,e680116, and merge commits5a50f8f,4f07a71,344b0c1,7cc5837,5d0eedbagainstorigin/main(5bfc066). Both remaining items from Pass #4 (#282comment7359964895) are resolved cleanly:[VERIFIED FIXED — Pass #4
[P0]] Revertshadow_to/shadows_commonhooks & compute-UAVemit_postbuild(d065fff):VICTORY_HW_RT=0/ unset): Repo-wide search forshadow_to,shadows_common, andshadow_statesreturns 0 matches.crates/victory-gpu/src/host/place.rsandcrates/victory-gpu/src/indirect.rshave zero diff againstorigin/main, and non-RT paths indraw.rs/host.rscarry zero extra shadow-state tracking (hwrt::requested()->false,manager()->None).crates/victory-gpu/src/hwrt.rs:559-573,crates/victory-gpu/src/hwrt/sanitize.rs:461-484):HwRtManager::newcompilesPOSTBUILD_HLSL(write_postbuild,[numthreads(1, 1, 1)],cs_5_1) viahost::compile(crates/victory-gpu/src/host.rs:2080-2124) with embedded root signature"RootConstants(num32BitConstants=4, b0), UAV(u0), UAV(u1)".crates/victory-gpu/src/hwrt.rs:2657-2737): Gated insideHwRtManager(hwrt::active()). Filters zero / non-4-byte-aligneddst_gpu, callssh.refresh,sh.gpu_writes, andlist.keep(&sh.buffer), passesparams[2] = (dst_gpu & 15) as u32(dst_bias) and bindsdst_aligned = dst_gpu & !15(16-byte-aligned VA for rawRWByteAddressBufferu0, withmode = 0for inlineu64size ormode = dwordsreadingu1afterEmitRaytracingAccelerationStructurePostbuildInfo). SurroundsDispatch(1, 1, 1)withuav_barrierand sets*bound = true, triggeringstate.replay(host)(crates/victory-gpu/src/list.rs:211-217,crates/victory-gpu/src/draw.rs:1825-1829) to restore title pipeline/root/heap bindings.[P2]hardening note (non-blocking): Unlikeroot_uav(crates/victory-gpu/src/draw.rs:2581-2586),emit_postbuild(crates/victory-gpu/src/hwrt.rs:2699-2703) does not checkD3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESSonsh.bufferbeforeSetComputeRootUnorderedAccessView(1, dst_aligned)(relevant only if a postbuild destination ever lands in awc_mapped_for(size, false)non-UAV shadow viacrates/victory-gpu/src/shadow.rs:7036-7039).[VERIFIED FIXED — Pass #4
[P2]] Transitive PHI-chain seeding incollect_rq_needed_vals(65e3d13,e680116):collect_rq_needed_vals(crates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:1191-1193) now seeds its backward work queue fromself.read_phisacrosscb_setandmerge_block.resolve_rq_phi_arm(crates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:1232-1236) inserts referencedphi_atPHI arguments intoself.read_phis, ensuring outerheader_blockPHIs indata_phisare retained beforeLower::fill_phis(crates/victory-shader/src/emit/lower.rs:14551).e680116(crates/victory-shader/src/emit/lower_tests.rs:2209) only populatesray_queriesin the testHostShaderinitializer;--ccinspection of merge7cc5837shows zero conflict skew invictory-shader.Target 1 Verdict: GREEN LIGHT —
#357(5d0eedb) is verified clean to merge behindVICTORY_HW_RT=1.Target 2:
.09 -> .12Regression Sweep (8ff2a82..5bfc066) &fix/thin-hostlist-leakAudited all 9 commits between
v2026.12.02.09(8ff2a82) andv2026.12.02.12(5bfc066) (#363,#365,#360,#366,#368,#356,#341,#343,#331), prior.09-era shader/HLE changes (#329,#332,#346,#358), and thefix/thin-hostlist-leakbranch diff:1. Memory / Commit / VRAM Leaks
[P0].12Runaway ~100 MB/sprivate_commitLeak (persists withVICTORY_SWEEP_ASYNC=0) —list/thin.rsBACKSoverflow ->release_boxedno-op:back_list()(crates/victory-gpu/src/list/thin.rs:659-668) creates backingListobjects viaBox::into_raw, leavingObject.refs == 0.BACKS.len() >= BACKS_CAP(256),Recording::drop(crates/victory-gpu/src/list/thin.rs:620-625) callscrate::object::release_boxed::<List>(inner.back as This).release_boxed(crates/victory-gpu/src/object.rs:146-167) usesrefs.fetch_update(..., |n| n.checked_sub(1)), which sees0, returnsErr(()) => 0, and never frees theBox<List>.detach/detach_parts(crates/victory-gpu/src/list.rs:637, 712) replacesback.hostwith afresh_list()HostList, every leakedBox<List>retains a liveHostList(command allocator, command list, and lazily attached scratch/budget/UAV buffers).fix/thin-hostlist-leakBranch Verification — SOUND & RACE-FREE:crates/victory-gpu/src/list/thin.rs:430-439, 572-631: AddsRecording::return_back(),reclaim_back()(Box::from_raw, returningboxed.hostandboxed.earliervialist::return_idle_host), andrecycle_back()(BACKS_CAP = 512).Recording::return_backatomically detachesinner.backunder theinnermutex (std::mem::replace(&mut inner.back, 0)only ifinner.closed && inner.back != 0), making concurrent/duplicate calls idempotent and disjoint fromRecording::drop.crates/victory-gpu/src/queue/behind.rs:586-590:Job::unfoldcallsr.return_back()immediately afterjobs_of(queue, &lists), releasingbackinstead of keepingHostLists pinned until the nextList::Reset.crates/victory-gpu/src/list.rs:430-469, 835:return_idle_hostcallshost.reset()and returns theHostListtoIDLEup toidle_most()/IDLE_MOST.1(256 MiB);boxed(thin=false)draws warm lists fromfresh_list().[P2]minor notes onfix/thin-hostlist-leak:detach/detach_partsleaves a freshHostListinback.host, up toBACKS_CAP = 512backing shells sitting inBACKSstill retain up to512HostLists outsidelist::IDLE, invisible tolist::trim_on_pressure/list::trim_stale_idle.ExecuteCommandListscalls without aResetbetween them, the secondunfoldseesr.back() == nullafter the firstreturn_back()rather than takingdetach's empty-run path (list.rs:715).[P0]#363(VICTORY_SWEEP_ASYNC=1) Dedicated/Shared/Commit Surge (t+3m -> t+5m) &858 mslist::thinCPU:BelowNormalworkers + unboundedGRAVEchannel: Bothvictory-sweep(crates/victory-gpu/src/host/sweep.rs:46-52) andvictory-graveyard(crates/victory-gpu/src/host.rs:812-844) run atTHREAD_PRIORITY_BELOW_NORMAL. OnceBACKSoverflow pushes commit into pagefile thrash under ~25–35NORMAL/ABOVE_NORMALworker threads,trigger_sweep()stampsLAST = nowbefore waking the worker (sweep.rs:28-36, 80-86), coalescing missed sweeps into a singlependingflag, whilegraveyard()queues retiredShadows /HostTextures /ID3D12Resources / allocators into an unboundedmpsc::channel()(host.rs:816). Retired objects accumulate unreleased inGRAVEeven whileshadow::LOOSE(host copies) andpool::TEXTURES(texture blocks) already dropped them from active tracking. (By contrast,drop_asideathost.rs:3268-3294uses a boundedsync_channelatNORMALpriority with inline fallback.)1500 mssettle + concurrentLOOSE.write()lock contention (#363+#331): Whensweep_async_on()is true,Host::submit(crates/victory-gpu/src/host.rs:8320-8341) skips the periodic1500 msself.settle(&mut submitted, WHY_SYNC)(25-30flights in air with0.0settles) and runssweep_once()concurrently with the8victory-list-*translation threads. In.12,shadow::let_go_idle()(crates/victory-gpu/src/shadow.rs:4273) acquiresLOOSE.write()— locking all17RwLockshards (0..=WHOLE) inReadMostly(crates/victory-gpu/src/listcpu.rs) while iterating windows and callinghost::references— stalling allvictory-list-*readers (list::thinwall time climbing to857.9 ms)..09 -> .12commits:#360screenshot::Pending::dropdecrementsIN_FLIGHTand drops readback staging before PNG encoding;#331Rememberedis fixed-size;#365staged_cbv_batchuses one static heap andMappedPagesreuses a per-thread set.)2. Broken / Missing Audio Regression
[P1]Priority inversion & CPU oversubscription (audio.rs,#368land.rs,#329title_free.rs):victory XMA decoder(crates/victory-hle/src/modules/audio.rs:762-776) runs at defaultTHREAD_PRIORITY_NORMALpumping XMA rings every2 ms. Meanwhile, everyland::Poolthread (crates/victory-gpu/src/land.rs:240-257->cores::Priority::new()atcores.rs:147-159) as well asvictory-wide(shadow.rs:2299-2301),victory-submit(queue/behind.rs:971),victory-host-submit(host.rs:4550), andvictory-aside(host/aside.rs:72) runs atTHREAD_PRIORITY_ABOVE_NORMAL, strictly preemptingvictory XMA decoderunder load.#368spawnedvictory-wide-sub(crates/victory-gpu/src/land.rs:387-397,(cpus / 4).clamp(4, 8)additionalABOVE_NORMALhelper threads!) and lowered parallelism thresholds (FEW: 256 -> 32,wide_refresh >= 2athost.rs:11774, 11975, 12002;LONG: 1 MiB -> 256 KiB,PART: 256 -> 128 KiBatshadow.rs:5793-5794), waking high-priority pools far more often.#329(crates/victory-hle/src/modules/title_free.rs:94-121, 170-200, landed at.09) unpins all affinitized title threads (SetThreadAffinityMask/SetThreadGroupAffinity) to the full process mask and forcesSetProcessPriorityBoost(process, 0)(re-enabling dynamic priority boost), throwing the title's audio mixer thread (4 ms cadence percrates/victory-hle/src/runtime.rs:233-234) into the shared normal-priority contention pool underneath ~25+ABOVE_NORMALGPU workers — matching.09minor crunching degrading into.12total audio dropout once#368+ pagefile thrash landed. (Note alsocrates/victory-hle/src/modules/kernel.rs:435: whenVICTORY_STARTUP_PRIORITIESis set, title asks1..=15remain capped atNORMALfor the entire run.)3. Excessive Night Starburst Lens-Flare / Bloom Glare
[P1]Unsoundfinite_datarules in#346(VICTORY_LEGACY_MUL=data, default) —0.0 * Inf -> NaN(crates/victory-shader/src/emit/bitcode/finite.rs:50-65,crates/victory-shader/src/emit/lower.rs:5182-5196):Module::finite_data(finite.rs:51-60) classifiesOp::Extract(..),Op::Cast(Cast::Bitcast, i32 -> f32)(type_of(x) != type_of(v)), andLegacyF16ToF32(131) as unconditionally finite, and ignores FP overflow inAdd/Sub/Mul/FMa/FMad.Op::Extract. HDR light targets (FP16 max65504/R11G11B10Fmax65024) from bright lights routinely carry+Inf(orLegacyF16ToF32unpacks0x7C00/0x7E00).legacy_mul(lower.rs:5182-5196) elides the0 * anything = 0select guard whenever both factors reportfinite_data == true. In HDR bloom / starburst glare kernels,0.0 * (+Inf)flips from0.0toNaN; notablyclamp_hdr()(crates/victory-shader/src/emit/hdr.rs:132-143,lower.rs:14202, 14209) only runs on pixel shader color exports (not compute UAV bloom/starburst/adaptation passes), andcompose.rs:30(clean1, defaultVICTORY_COMPOSE_NAN=1) converts survivingNaNs into1.0full-bright white.[P2]Cache key omission:crates/victory-gpu/src/shader_cache.rs:84-111omits"VICTORY_LEGACY_MUL", so togglingVICTORY_LEGACY_MUL=0without clearing the shader cache serves staledata-mode cached binaries.[P2]Secondary compute-drop check (#358,crates/victory-shader/src/emit/lower.rs:2996):#358changedif self.pairs.is_some() && self.s.lds_dwords > HOST_LDS_DWORDSto reject any shader withself.s.lds_dwords > 8192(Err("LDS past the host's 32 KiB")). Worth checking.12logs for"dropped ... without a host pipeline"/"LDS past the host's 32 KiB"to rule out dropped eye-adaptation / bloom compute passes alongside an A/B test ofVICTORY_LEGACY_MUL=0(with cleared shader cache) +VICTORY_COMPOSE_NAN=0.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T04:27:07Z.
Deep Static Logic Audit — Pass #6 (
Androtim/MiniVI#372@90086b60)Strictly read-only audit of PR
#372(fix/p0-visuals-cache-and-vram, CIcheck=SUCCESS).Pass #6 Verdict Table
#37290086b60[P0], 0[P1]blockers; 3 minor non-blocking[P2]hardening notes below.crates/victory-gpu/build.rs:7-49,crates/victory-gpu/src/shader_cache.rs:204-212SHADER_CACHE_VERSION = 2feeds intoTranslate::version()andCacheKey::new(crates/victory-pipeline/src/cache.rs:17-24), strictly invalidating allv1disk entries.build.rsemitscargo:rerun-if-changedrecursively for all subdirectories undercrates/victory-shader/src, strips\r, and hashes sorted paths deterministically across CI/release checkouts.VICTORY_HW_RT=0/ unset stays unaffected (hwrt::requested()isfalse,normalize_env_valueleavesVICTORY_BVH_BUILDERunchanged).crates/victory-gpu/src/compose.rs:29-45, 362-442clean1()((asuint(x) & 0x7FFFFFFFu) > 0x7F800000u ? 0.0 : saturate(x)) flushesNaNto0.0(avoiding white blocks/blank white frames), keeps+Inf -> 1.0and-Inf -> 0.0, preserves[0.0, 1.0]identically (no black crush), and compiles cleanly viaD3DCompile(vs_5_1/ps_5_1DXBC with[RootSignature(RS)]). Pre-blendclean(o.rgb)/clean(s.rgb)/clean1(o.a)eliminates+Inf * 0 = NaNbehind opaque overlays;ComposertargetsDXGI_FORMAT_R8G8B8A8_UNORMonly (crates/victory-gpu/src/host.rs:13149-13150), sosaturatecauses no unintended HDR clipping.PostDom/vcc_unknown_execcrates/victory-shader/src/emit/lower.rs:614-891, 2188-2240, 5855-5874,crates/victory-shader/src/structure.rs:484-486, 741-785, 970PostDom+ Eulertin/tout+RegionWalkermatch the priorO(N^2 * W)bitset semantics (including dead-end loops wheretin[node] == u32::MAX) anduniform_scalars!cleared[b](lower.rs:876) is exact forloops = true, eliminating the compute compile hang. Gatinglds_wave(:2192) and non-waterfallv_readfirstlane_b32(:2206) onhost_wave >= 64(plus!lds_wave || group <= 32at:2237) preserves RDNA 4[WaveSize(64)]and Wave32 single-wave LDS while letting multi-wave 32 KiB LDS shaders lower on NVIDIA viawaveReadLaneFirstwithoutsplit_lds/pairsoverflow orWaveSize(64)rejections. Forward-predecessor matchingEXEC+vcc_unknown_execeliminates falseMASK_ELSEWHEREacross scalar joins (s_cbranch_scc1) while keeping back-edge/join divergence guarded.crates/victory-gpu/src/host.rs:1229-1267, 13706-13765,crates/victory-gpu/src/host/panel.rs:292, 462,crates/victory-gpu/src/host/telemetry.rs:128,apps/victory/src/play.rs:425-446, 464-473planned_budget()reserves640 MiB(VICTORY_SMALL_CARD_HEADROOM_MB, clamped.min(2048) << 20) when0 < system <= 7500 MiB(<= 8 GB/6 GBadapters) withsaturating_suband.max(2048 MiB).min(system)(zero underflow/overflow from< 2 GiBup to24 GB+). ExplicitVICTORY_VRAM_BUDGET_MBandVICTORY_SMALL_CARD_HEADROOM_MB=0override cleanly;12 GB,16 GB, and24 GBcards (> 7500 MiB/vram_mb > 9216) are completely untouched.play.rstightens 4K<= 8 GBthresholds (84/82/74) before applying menu and--setuser overrides (:464-473), whilepanel.rsandtelemetry.rsreadHost::system_video_memory()sodedicated_mbstays strictly below reportedbudget_mb.crates/victory-gpu/src/host/screenshot.rs:107-167VICTORY_SCREENSHOT_AT_Sdeduplicates positive second thresholds via per-slotAtomicBool::swap(true)(OnceLockinitialized when screenshots are enabled); zero overhead when unset.Root-Cause Confirmation (Visual Regressions)
PostDom(lower.rs:614-742) eliminates the worker hang on large compute shaders, andv_readfirstlane_b32(:2206) +vcc_unknown_exec(structure.rs:486, 741-785,lower.rs:5868) recover the dropped Wave64 compute pipelines (post-process / adaptation / bloom / shading passes).compose.rs:32, 45converts any survivingNaN(and prevents+Inf * (1 - 1) = NaN) to0.0instead of1.0full-bright white.SHADER_CACHE_VERSION = 2(shader_cache.rs:204) forces automatic invalidation of stalev1cached DXIL blobs so both#370(finite_data/hdr.rs) and#372codegen fixes take effect immediately without manual cache wipes.Non-Blocking
[P2]Hardening Notes[P2]structure.rs:741-785—nowpropagation across rare non-wide, non-EXEC-modifying per-lane branches: If a blockB0ends in a non-wideper-lane branch that does not updateEXEC(e.g.,scc_lanes_cbranch_scc0/1) while an earliervccremains live acrossB0 -> B1without redefiningvccinB1(!vcc_in_block),nowstill carriesend_exec[B0]intoB1, soB1is placed in neithervcc_outside_execnorvcc_unknown_execdespite receiving only a subset ofB0's lanes. Unlikely in compiler-generateds_and_saveexec/v_cmpxdivergence, and easily hardened by carryingend_exec[q]intonowonly whenqexits viaJump,wide,Atom::Uniform, ors_cbranch_exec*.[P2]host.rs:1229—SMALL_CARD_BUDGET = 7500 << 20edge on uncontended 8 GB adapters: If an 8 GB GPU initially reports an uncontended DXGI local budget slightly above7,500 MiB(prior to DLSS/swapchain allocations),planned_budget()keeps fullsystemuntil DXGI budget drops<= 7,500 MiB(at which point planned budget steps down by640 MiB), thoughplay.rs'sLOW_VRAM_THRESHOLD_MB = 9216(DedicatedVideoMemory) still applies the 4K84%/82%-74%guards independently.[P2]Pre-existing cache key omission (crates/victory-gpu/src/shader_cache.rs:42-70):TRANSLATOR_ENV_KEYSomitsVICTORY_LDS_FIRST_INIT(crates/victory-shader/src/emit/lower.rs:6595), unrelated to#372's own switches (VICTORY_SMALL_CARD_HEADROOM_MBandVICTORY_SCREENSHOT_AT_Sdo not affect shader translation).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T06:57:28Z.
Deep Static Logic Audit — Pass #7 (
Androtim/MiniVI#373@373b3ce2)Strictly read-only audit of PR
#373(feat/p1-reflections-textures-and-hwrt, CIcheck=SUCCESS).Pass #7 Verdict Table
#373373b3ce2[P0], 3[P1]blockers (fold.rslane/CFG soundness x2;resource.rswaste_onlyidle_msthrash); 5 non-blocking[P2]hardening/scope notes below.crates/victory-shader/src/fold.rs,emit/mod.rs:790, 874,emit/lower.rs,crates/victory-gpu/src/shader_cache.rs:47, 205, 652,apps/victory/src/play.rs:1162 [P1],2 [P2])VICTORY_EXACT64=71883e40620a567a+7168dd781ca7efb9cleanly targets the two temporal-resolve reflection shaders while leaving SSR pre-pass34992f2b65a789a5and AMD RDNA 4 Wave64 (host_max_wave() == 32guard atemit/mod.rs:790) untouched.TRANSLATOR_ENV_KEYSincludes"VICTORY_EXACT64"withSHADER_CACHE_VERSION = 2(no stale DXIL collisions). However,fold.rshas two[P1]soundness bugs (v_writelane_b32running underEXEC_LO = E.hi, and lineardirty/e_writtenstate across branches/leaders).crates/victory-gpu/src/descriptor/host.rs:627-634, 736, 3709-3795, 5374-5422,descriptor.rs:1140-1145, 2107-2118,texture/hoist.rs,texture.rs:1093, 1365,texture/ahead.rs:442-444,host/heap_order.rs,host.rs:8188, 8400-8438, 10297,draw.rs:2788-2817, 35661 [P2])Hoist<T>SeqCst2-epoch protocol,HELDself-deadlock guard, bounded50 mswait_limit(),open_detachedDropcleanup), zero permanently stuck slots (UPLOAD_GIVE_UP = 600submissions,UPLOAD_WAITS_MOST = 20_000,late = Some(frame),uploaded_instamped across prelude/hoisted/record_upload/ahead::finish), and zero lock-ordering inversions (UPLOAD_WAITS/NEW_PENDING/FLIPS/views_read()are all leaf locks;slot_evictreleasestextures()first). One[P2]lifetime note forHeap::drop.crates/victory-gpu/src/residency.rs:68-167,pool.rs:45-64, 878,resource.rs:2734, 2769, 2916, 2967, 3098-3176, 3246,host.rs:181-197,apps/victory/src/play.rs:95-961 [P1],1 [P2])shared_headroomusessaturating_subacrossphys_floor(1 GiB),commit_floor(2 GiB), and20%(<= 3 GiB) DXGI shared reserve with zero underflow/overflow on 6/8/16/24 GB GPUs and 16/32/64 GB RAM;block_waste_floor(1 GiBfor<= 7500 MiB,2 GiBabove) is safe, and compaction is fence/retire-safe (evict_slots->strong_count == 1->host::retire->REST = 500 ms). However,slot_evicthas a[P1]idle_msvsevict_idle_msmismatch that thrashes descriptor slots underVICTORY_PARK_COMPACT_WASTE=1without compacting sparse blocks.crates/victory-gpu/src/host/dred.rs:37-88,host.rs:1317-1334,hwrt.rs:59-71, 2043-2104, 2125, 2166-2231, 2307-2315, 2829-2831, 2956,hwrt/sanitize.rs:103, 130-149, 223-238, 354-360,crates/victory-hle/src/modules/mod.rs:83-84[P2])VICTORY_HW_RT=0/ unset has zero overhead or behavior change (dred_policypreserves prior DRED behavior,xboxbvhmodule is unregistered, andhwrt::active()/manager()/prebuild_infoshort-circuit on!requested()). Note:#373implements Transform3x4 (tx_copy) snapshotting (48 Binline, 16-byte aligned in16 MiB-boundedstage), not BLAS vertex/position buffer snapshotting.TrustNo1/Darner,linkoovosh/LinkoArts-build,skornuta/victory-memory-stack); zero local paths; zero retail game/character/location names.[P1]Findings (Action Required)[P1]crates/victory-gpu/src/resource.rs:3123, 3146-3153, 3176, 3246—VICTORY_PARK_COMPACT_WASTEPhase 2/Phase 3idle_msmismatch thrashes slots with zero compaction:used < room_line - 2%),let_go_idle(resource.rs:2769, 2916,host.rs:182, 191) passesidle_ms = 600_000ms intoslot_evict. Whenneed == 0,VICTORY_PARK_COMPACT_WASTE=1setswaste_only = true, whileevict_idle_ms = idle_ms.min(slot_evict_idle_ms(...))clamps to<= 60_000ms (:3123).:3176) selects sparse-block textures idle for>= evict_idle_ms(60 s), and Phase 2 evicts their descriptor slots to neutral, but Phase 3 (:3246) checkslong_ago(r.host.used.load(Relaxed), idle_ms, frames)against unclamped600_000ms. Every sparse texture idle between60 sand600 sis slot-evicted and immediately re-made viarestoreon every sweep without reclaiming the block.evict_idle_msinstead ofidle_msatresource.rs:3246.[P1]crates/victory-shader/src/fold.rs:985-1034, 1106-1138, 1573, 1593-1595—v_writelane_b32runs underEXEC_LO = E.hiand gets masked off bylower.rs:f.flush()(fold.rs:985-1001, 1022) leaves hostEXEC_LO = E.hi(dirty = true), andf.lanes(v_writelane_b32,:1106-1138) neither settlesEXEC_LOnor enables all lanes.ir.rs:1797marks all VALU ops as readingEXEC,structure.rs:751, 911andemit/lower.rs:5885-5900, 5979, 9545, 9554, 10572-10590gatev_writelane_b32VGPR writes viaguard. Writes to console lanek < 32are silently dropped whenever lanek + 32is inactive inE.hi(including allgroup <= 32dispatches whereE.hi == 0atfold.rs:1573), whereas hardwarev_writelane_b32ignoresEXEC.EXEC_LO = -1(0xFFFF_FFFF) andself.dirty = truebeforev_writelane_b32infold.rs:1106-1138.[P1]crates/victory-shader/src/fold.rs:857-868, 1163-1186, 1523, 1579-1581, 1638-1645— Lineardirty/e_writtentracking causes staleEXEC_LOafter branches:Foldtracksdirty/e_writtenmonotonically by offset;leaders.contains(&inst.offset)(:1579-1581) callsf.flush()without resettingdirty.s_cbranch_vccz/vccnz(:1171-1174leavesEXEC_LO = VCC_LO | VCC_HI), live-SCCs_cbranch_execz(:1183-1185), or live-SCCconditional branches afterEwrites (wheresettle(live_in[i])at:858, 1638is skipped) can reach a backward loop header or forwardleaderwhose lineardirtyflag becamefalse. At that target,s_cbranch_execz/execnz(:1170,if lo != e || self.dirty) omitss_or_b32 exec_lo, e, e+1and branches onVCCor stale pre-updateEXEC_LOinstead ofE.f.dirty = true(andf.e_written = true) atleadersinfold.rs:1579-1581.Non-Blocking
[P2]Notes[P2]crates/victory-shader/src/fold.rs:321-328, 385, 454, 492, 521, 966-970, 1006-1012—v_cmpxWAR hazard injoins():valu_copysetst.exec = trueforv_cmpx*without pushingEXEC_LOontoside.writes, allowingjoins()to pair an earlier instruction whoseHalf::BreadsEXEC_LO(data/source9->x.e) into the samerun, solower_copies(s_mov_b32 e, exec_lo) overwritesx.ebeforeupper_copiesreads it.[P2]crates/victory-shader/src/fold.rs:410-415—mask9negative inline constants194..=208:194..=208(-2..-16) are returned unchanged onHalf::Binstead of193(-1, sign-extended high dword for lanes32..63), flipping bits on lanes32..35.[P2]crates/victory-gpu/src/hwrt.rs:2043-2104, 2125, 2166-2231&hwrt/sanitize.rs:103, 223-238— Snapshot scope (tx_copyonly): PR#373snapshotsTransform3x4(tx_copy), not BLAS vertex/position or index buffers; cross-frame deferred builds inBacklogstill read live vertex/index memory if recycled before drain (tx_copyitself is memory-bounded, 16-byte aligned, and race-free).[P2]crates/victory-gpu/src/descriptor.rs:1140-1145&descriptor/host.rs:627, 736, 3747:Heap::dropunregisters fromSHADER_HEAPSbut does not purgeUPLOAD_WAITS,NEW_PENDING, orFLIPS, allowing lingeringArc<HostTexture>refs (up to600submissions) orptr::from_ref(self) as usizereuse aliasing if a shader-visible heap is freed while uploads wait.[P2]crates/victory-gpu/src/resource.rs:2967, 3151: WhenVICTORY_SLOT_EVICT_MBis set to16..=63MiB (cap < BLOCK_BYTES),cap.min(free_blocks / 2).max(crate::pool::BLOCK_BYTES)exceedscap.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T07:15:25Z.
Deep Static Logic Audit — Pass #8 (
Androtim/MiniVI#374@3c336ef6)Strictly read-only static audit of PR
#374(perf/p1-speed-wins, CIcheck=SUCCESS).Pass #8 Verdict Table
#3743c336ef6[P0], 0[P1]blockers; 2 minor non-blocking[P2]observations below.WIDE4-Dword Loads & Cachecrates/victory-shader/src/emit/bitcode/opt.rs:62-70,emit/mod.rs:365-381, 440-461, 1615-1629, 2744-2894,emit/lower.rs:7981-8017, 8095-8188, 9222-9248,crates/victory-gpu/build.rs:7-50,crates/victory-gpu/src/shader_cache.rs:113, 150, 204-212opt::DEFAULT = ALL(127, opt-out viaVICTORY_SHADER_OPT=63) enablesraw_dwords()solely on scalar buffer loads (smem()s_buffer_load_dword*countin{1,2,4,8,16}, chunked to1/2/4dwords withalign = 4,mask = 1/3/15).raw_twin(descriptor/host.rs:6075-6099) and root/memory SRVs bindR32_TYPELESSFLAG_RAWviews with per-dword D3D12 OOB zeroing (verified across unaligned offsets and partial view-end straddling);count == 1preservesbuilder_boundssize && rootclamping (lower.rs:8145, 8159, 8181-8185), andpickedCBVs (stride == 0) stay guarded behindis_buffer.victory-gpu/build.rshashesopt.rs+mod.rsintoVICTORY_TRANSLATOR, andshader_cache.rs:150hashesshader_opt().to_le_bytes()alongsideSHADER_CACHE_VERSION = 2(zero pre-#374or env-toggle cache collisions). Identical scalar SMEM semantics across NVIDIA Wave32 & AMD RDNA 4 Wave64.shadow.rs)crates/victory-gpu/src/shadow.rs:939-940, 6774-6886, 6894-6905, 6933-6959, 6968-7111, 7353-7372, 8069-8075, 8381-8435,crates/victory-gpu/src/listcpu.rs:125-296Bufferspartitions keys(start, resource)acrossTIERS = [4 KiB, 64 KiB, 1 MiB, 16 MiB]+ overflow (>16 MiB) with exact per-size live counts (sizes).insertstrips all tiers before reinserting and updatessizeson overwrite;removekeepsmap/tiers/sizesconsistent;findcomputeslowest = end.saturating_sub(most)per non-empty tier (most = sizes.range(low..=high).next_back()), skipslowest > address, and takesbest.max(found)— matching full-scan semantics across all boundary/empty/len == 0cases (and avoiding prior.take(64)truncation misses).ReadMostly(id = 1) shard ordering,BUFFERS_CHANGED+FOUNDTLSSeqCstfencing,host::retireoutside lock, andBUFFERS/LOOSEseparation (unregister,in_place_let_go,lookup,spans,near) remain deadlock- and race-free (nearalso switches frombuffers()write lock tobuffers_read()).TITLE_PRIORITY_MAX)crates/victory-hle/src/modules/kernel.rs:427-481, 600-622, 625-709, 1007-1021,apps/victory/src/play.rs:77-80,crates/victory-hle/src/modules/audio.rs:424-426, 760-788,crates/victory-hle/src/modules/xaudio2.rs:62-90play.rs:80setsVICTORY_TITLE_PRIORITY_MAX=0while leavingVICTORY_TITLE_PRIORITIESandVICTORY_STARTUP_PRIORITIESunset (cap = false).held_at()(kernel.rs:474-481) clamps non-time-critical HLESetThreadPriorityvalues (<= 2) tomax(0=THREAD_PRIORITY_NORMAL), strictly preservingTIME_CRITICAL(15:given != TIME_CRITICAL) for title mixer threads (audio.rs:426).#370'svictory XMA decoder(audio.rs:760-788) calls host Win32SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST)directly outside HLEkernel::SetThreadPriority, keeping it atHIGHEST(2) strictly aboveABOVE_NORMAL(1) GPU pools and capped (0) title workers; hostxaudio2_9.dllthreads (xaudio2.rs:62-90) are likewise untouched. Clean opt-out viaoffor2.KEPT_APART(Omitted)crates/victory-gpu/src/descriptor/host.rs:315-322, 4124-4182, 4416-4485HostHeapalready uses per-slotkept: Box<[Mutex<Option<ID3D12Resource>>]>, lock-freekept_raw: Box<[AtomicUsize]>, andrtas_slots/kept_pins, and callscrate::host::retire_resource(old)/crate::host::retire(pin)strictly outside slot (keep_inner:4476-4484) andnext(release:4139-4142,release_batch:4178-4181) locks. Zero UAF or lock-held COM drops.3c336ef6+ PR#374bodylinkoovosh/LinkoArts-buildfd9443e/93c6311,TrustNo1/Darner2a8566e); zero local Windows paths; zero retail game/character/location names.Non-Blocking
[P2]Observations[P2]crates/victory-hle/src/modules/kernel.rs:613, 646-648(VICTORY_STARTUP_PRIORITIES+VICTORY_TITLE_PRIORITIES=0edge): Underplay.rsdefaults (VICTORY_STARTUP_PRIORITIESunset),STARTUP_RAISEDis inactive. Only if someone manually combinesVICTORY_STARTUP_PRIORITIES=<sec>+VICTORY_TITLE_PRIORITIES=0+VICTORY_TITLE_PRIORITY_MAX=0doesgive_back_startup_raises()(:613) restore originalaskedvalues withoutheld_at(whilecap = truealready suppressedshould_raiseon> 0priorities at:646-648).[P2]apps/victory/src/play.rs:80vsscripts/play.ps1:VICTORY_TITLE_PRIORITY_MAX=0is wired intoapps/victory/src/play.rsSETTINGSonly (notscripts/play.ps1); intended for the defaultvictory playlauncher path.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T07:17:17Z.
Targeted Sign-Off — Pass #7.5 (
Androtim/MiniVI#373@34a701f6)Strictly read-only verification of follow-up commit
34a701f6on PR#373(feat/p1-reflections-textures-and-hwrt, CIcheck=passin4m30s).Verdict: VERIFIED CLEAN (Green Light) — 0
[P0], 0[P1]blockers[P1]Itemv_writelane_b32underEXEC_LO = E.hicrates/victory-shader/src/fold.rs:1117-1118s_mov_b32 exec_lo, -1and setsself.dirty = truebefore both constant-lane and scalar-lanev_writelane_b32expansions (structure.rs:1153-1160, 1323-1333evaluatesEXEC = Bool::TRUE->guards[b][i] == Noneatstructure.rs:911, soemit/lower.rs:5885-5900never masks writes off); leavesSCCandx.euntouched.dirty/e_writtenacross branches/leaderscrates/victory-shader/src/fold.rs:1586-1591f.dirty = trueandf.e_written = trueafterf.flush()at every CFGleader(branch/jump targets and post-branch fall-throughs, including offset0back-edge headers), forcingf.settle(false)(fold.rs:861-872) to re-emits_or_b32 exec_lo, e, e+1ands_and_b32 e/e+1, exec_lowhenSCCis dead, and keepingdirty/e_writtenarmed acrosslive_inSCCregions.slot_evictidle_msvsevict_idle_msthrash (VICTORY_PARK_COMPACT_WASTE=1)crates/victory-gpu/src/resource.rs:3119-3121, 3135, 3177, 3188, 3258slot_evict_cutoff_msclampsevict_idle_ms = idle_ms.min(slot_evict_idle_ms(...))(<= 60_000ms) and shares oneis_idleclosure (stamp != 0 && long_ago(stamp, evict_idle_ms, frames)) across both Phase 1 candidate selection and Phase 3 retirement, eliminating the60 svs600 sslot-eviction thrash.Additional
[P2]Fixes Included in34a701f6& Remaining Notes[P2]s (3 of 5):fold.rs:414(mask9sign-extends193..=208to193in upper half),fold.rs:456, 495, 525(v_cmpx*pushesEXEC_LO/EXEC_HIontoside.writesforjoins()andTwin::ordered()), andresource.rs:3125-3127, 3163(waste_evict_needapplies.min(cap)last soneed <= capeven whenVICTORY_SLOT_EVICT_MBis16..=63MiB), each covered by new unit tests infold.rsandresource.rs.[P2]notes from Pass #7:hwrt.rstx_copy-only snapshot scope anddescriptor.rsHeap::dropqueue purge (unchanged, non-blocking).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T08:58:48Z.
Reasoning Audit Pass #9 — PR #380 (
46e38e1,feat/build-version-overlay)VERIFIED CLEAN (0 P0, 0 P1, 0 P2)BUILD_VERSION(crates/victory-gpu/build.rs,victory-gpu/src/lib.rs,victory-hle/src/lib.rs) +F3stats overlay build version & RT mode (RT OFF/RT HW/RT SW) inpanel.rs, window caption (host.rs), and log header (apps/victory/src/play.rs).46e38e1:build.rs: watch worktreecommondirbranch refs & packed-ref parent dirs; gategitinvocations onhas_git.panel.rs: alignRT SWdetection with!hwrt::requested() && VICTORY_BVH_BUILDER == "1"soVICTORY_BVH_BUILDER=""(OFF) or suppressed SW-RT never mislabels asRT SW.MINIVI 50E503C (F3) ... F1: MENU,FRAME GEN OFF RT OFF, and# version=50e503c ...log line 1.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T09:46:04Z.
Reasoning Audit Pass #10 — PR #382 (
b5f6f82,fix/hwrt-refit-shown-source)VERIFIED CLEAN (0 P0, 0 P1, 0 P2)crates/victory-gpu/src/hwrt.rs(flush_blas_waves+job_of, +10/-5 lines) — resolve BLASPERFORM_UPDATErefitsource_vafrom submittedself.showninstead of recording-timeself.as_map.blas_table -> queue -> lru -> shown -> recording_tlas), GPU timeline ordering guaranteed bydefer_host+ global UAV barrier on direct queue, lifetime safety vialist.hold+RetiredAs+is_sole_com_owner, and all remainingself.as_mapaccesses audited (none emit GPU commands).1440DLSS QualityVICTORY_HW_RT=1(refits ON) ran full 70s gameplay (136.4stotal) with 9,601 BLAS refits, 4,115 TLAS builds, 38 unsubmitted races safely converted torefit->rebuild, and 0 hangs / 0 DRED / 00x887A0006(100% crash beforehand).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T10:01:48Z.
Reasoning Audit Pass #11 — PR #383 (
fed6c13,perf/copy-filter-dedup)VERIFIED CLEAN (0 P0, 0 P1)(2 non-blocking P2 notes: 3.125% lazy filter RAM overhead on large single-sided buffers, and also runs on L0 write-back shared copies).crates/victory-gpu/src/shadow.rs+host.rs(Shadow::copy_filtered,VICTORY_COPY_FILTER=0|1|check, adapted fromReZOnGithub/VIctory-lap0388407, GPL-3.0).writtenRelease/Acquire +filter_epochinvalidation, completeunfiltered()coverage across all single-sided writers, initial zeroing & alignment safety, clean-room + GPL-3.0 attribution.1440DLSS QualityVICTORY_COPY_FILTER=check-> 0 byte mismatches across full gameplay; defaultVICTORY_COPY_FILTER=1->8.8 fps(113.5 ms),VRAM 5.4 / 6.5 GB, clean visuals.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T10:56:10Z.
Deep Reasoning Audit Pass #12 — PR #384 (
perf/safe-working-set-trim,5fe71eb)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Initial Audit (
59e7e97) caught and fixed in5fe71eb:scan()andtrim_gently()by addingOPEN_LOCK(RwLock<()>, write-guarded acrossinplace::open, read-guarded around each single<= 16 MiBVirtualUnlockstep), monotonicSTATE_GEN(Acquire/Release) bumped onTITLE/OPENED/WRITE_COMBINEDchanges, and live per-chunkVirtualQuery+ exclusion re-verification (splitting around newly added exclusions).title_freed(at, len)now only removesatfromTITLEonMEM_RELEASE(len == 0), keepingAllocationBasetracked across partialMEM_DECOMMIT(len > 0).shadow::write_combined_freed(at, len)now splits surviving sub-ranges on partialMEM_DECOMMIT(len > 0) and notifiestrim::write_combined_changed().Lock Order & Portability Verified:
OPEN_LOCK->TITLE/OPENED/WRITE_COMBINED, never nested; zero cycles).#[cfg(windows)]gating acrosslib.rs,residency.rs,inplace.rs,shadow.rs,watch.rs.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T11:31:55Z.
Deep Reasoning Audit Pass #13 — PR #385 (
fix/amd-buffer-size-nonuniform-handle,8510813)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Lower::size_view_handle(crates/victory-shader/src/emit/lower/amd.rs) emits a dedicated SM 6.6nonuniform = trueheap handle strictly for uniform bufferdescriptor_data(getDimensions) queries while leaving images and waterfall loads onself.handle(...).raw_twinremapping,VIEW_LIMITclamping, error propagation, andnonuniform_handles -= 1(non-underflowing becauseheap_handle_atunconditionally increments onnonuniform = true) are exact.SFI0/PSV0flags remain standardRESOURCE_HEAPandvictory-gpu/build.rsautomatically updatesVICTORY_TRANSLATORacrosscrates/victory-shader/src/emit/lower/amd.rsto invalidate cached translations cleanly.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T11:54:12Z.
Reasoning Audit Pass #14 — PR #386 (\perf/low-ram-tier-and-pressure-sweeps, head \
dd0fb48)1993124): Found 1 [P1]\ (\hwrt::trim_on_pressure\ calling \manager()\ \OnceLock::get_or_init) + 3 [P2]\s (\give_prelude\ refill cap under pressure, non-critical VRAM \leases\ drain churn, \ iny\ physical recovery threshold \5.5 GiB).dd0fb48): All 4 findings fixed (\MGR\ lifted to module scope with \MGR.get().and_then(Option::as_ref), non-critical HW-RT trim drains hosteadbacks\ only while \leases/\s_pool\ require \critical, \give_prelude\ caps to \prelude_pressure_keep\ while pressured, \ iny\ hysteresis <= 3 GiB / < 4.5 GiB\ phys & <= 6 GiB / < 8 GiB\ commit).
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T12:37:34Z.
Reasoning Audit Pass #15 — PR #388 (\perf/draw-hotpath-cache, commit \
2d7c529)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T13:08:49Z.
Deep Reasoning Audit Pass #16 — PR #390 (
perf/submit-lockfree-nothing-new, commit0b700ca)crates/victory-gpu/src/{host.rs,host/refresh_tests.rs,shadow.rs,watch.rs}VERIFIED CLEAN (0 P0, 0 P1)Verified Invariants:
Batchpre-filtering &ask_aheadordering (host.rs):Batch::filter_unchangedandBatch::ask_ahead_and_filtershare lock-freeahead_snapshot_into+Shadow::nothing_new_withfiltering acrossBatch::refresh_front,Batch::flush_all, andBatch::refresh_ahead.Step::Run(batch.title_written()clearsself.ahead+watch::ask_once_end()clearsj.aheadandKEPT),Step::Copy(title_written()+watch::writing+watch::wrote),Step::Placed(title_written()+watch::writing+watch::wrote), concurrent CPU writes (PUBLISHEDcleared on view faults,asked_ahead()/WRITTEN_EPOCHSmonotonic on write-watched memory), unwatched shadows (!matches!(watched, 1 | GUARDED)returnsfalse), and pending gaps are all retained.kept(watch::is_kept()) /ask_ahead/ask_ahead_donepairing is preserved even if re-filtering reduces surviving spans to<= 1; synchronousask_aheadpopulatesWRITTEN_EPOCHS(Release) andj.aheadunderjournal_mut()beforeahead_snapshot_intore-filters, so newly dirtied pages (now > copied.max(ranged)) cannot be dropped.Shadow::gaps_nothing_new,Shadow::nothing_new_with, andranged_lockfree(shadow.rs):check_gap(from, to)fast-path beforeself.pending.lock()is sound:[a, b) ⊆ [from, to)impliespublished(a, b),aheadinterval containment, andranged_lockfree(a, b) >= ranged_lockfree(from, to), while ranges insideself.pendingare skipped byShadow::updateanyway. Onfalse,gaps_nothing_newlockspending, returnsfalseifbusy.is_empty()(concurrentcopy_back_done), or checks each free gap.ranged_lockfreeSeqLock ordering (s1Acquireeven check,Relaxedslot loads +fence(Acquire)+Relaxedranged_seq == s1recheck) pairs withcopy_stale'scopy_lock-serializedseq + 1->fence(Release)-> slot stores ->seq + 2(Release) aftertake_allandmark_copied. BothShadow::nothing_newandShadow::nothing_new_withenforcecrate::watch::light().PageEpochs::all_within_with,watch::nothing_new_with, andwatch::nothing_new_single(watch.rs):rangedevaluation executes only insideWRITTEN_EPOCHS.all_within_withafterpublished || ahead(contains_interval/ahead_asked_at) succeeds and anyJOURNALread guard is dropped, and only when needed (t0 == 0 || w > t0on single-page fast path;!all_copied && any(taken == 0)orw != 0 && w > ton multi-page path).all_copied(uncopied_pages.load(Acquire) == 0) synchronizes-withmark_copied'sswap(AcqRel)->fetch_sub(1, Release).#[cfg(windows)]modules (crates/victory-gpu/src/lib.rs),PageEpochs::all_withinis gated#[cfg(test)], and PR #390 CI check (47111008969/job/144269478960onwindows-latest: clippy default +--all-features+ workspace tests) passed on0b700ca.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T13:37:56Z.
Deep Reasoning Audit Pass #17 — PR #393 (
perf/pending-copies-and-mirror-cache, commit0008339)crates/victory-gpu/src/{descriptor/host.rs,draw.rs}(merged cleanly againstorigin/mainviagit merge-tree; branch base07b5b5cprecedes#383/#388)VERIFIED CLEAN (0 P0, 0 P1)Verified Invariants:
PendingCopies/CopyDescriptors):PendingCopiespartitions primary slots ([0..RAW_TWINS)) and raw twin slots ([RAW_TWINS..)) into separateCopyPartitionbuffers (PENDING_COPY_CAP = 64), backed by disjoint per-thread CPU-onlyPendingStageslices (PENDING_STAGE_CAP = 128,PENDING_STAGE_THREADS = 512).CopyPartition::push_withflushes the prior partition before accepting duplicatedst_slotwrites or overflowingPENDING_COPY_CAP, preserving write-after-write order and disjointCopyDescriptorsdestination ranges.coalesce_copy_entriesmerges only contiguousdst_slot/dst.ptr(dst_step-checked) and contiguoussrchandles matching bothsrc_tag(SRC_TAG_STAGEvsSRC_TAG_LISTED) andsrc_step != 0.PendingCopies(!self.sampler/heap.samplers()guards);PendingCopies::bind_heapflushes on heap switches;State::tablesflushescopies.flush()before returning table offsets toState::bind(prior to draw/dispatch/indirect recording), withDropflushing as a fallback;is_cpu_staging_twinrestrictsmove_rawpatching to CPU-only staging slots.HostHeap::commit_direct_cbv/inline_constant/ root CBVs):State::tablesdecodes inline constants viainline_constant(and fallbackView::Constantviaview_with_words), allocates 256-byte-aligned scratch viaHostList::scratch_held_with_base(next_multiple_of(256)on committed upload buffers), queuesdefer_constants, and binds viacommit_direct_cbv(falling back tomake_null_settledon allocation failure).commit_direct_cbv_innerclamps CBV size viaconstant_bytes(size)(<= 64 KiB, 256-byte multiple), creates/clears the raw SRV twin (self.raw + index) consistently withself.twins, clearswrite_stride/write_addressanduntrack_rtas, and preserveskept/RETIREDresource lifetimes viakeep_inner(PinOp::Clearguarded by lock-freepin_slots, withkept_rawstoredReleaseafterpin_slots.putandpin_count.fetch_add). Root CBVs (root_view) enforce 256-byte alignment viashadow.gpuor 256-byte-alignedfill_scratch.MirrorCache/HostHeap::mirror_for_table_with/view_with/listed_view_with:MirrorCache(512 × 2-way sets per thread) never cacheskey == 0or inlineCONSTANTrecords, usestry_borrow/try_borrow_mutto avoid re-entrantRefCellpanics, and validates non-inline entries viaviews_entry_aliveunderviews_read(), evicting entries invalidated bydescriptor::forgetorfree_ownerless.mirror_for_table_withrequiresquick_mirror() && self.quick_key(index) == key && !self.tlas_gen_stale(index)(quick_iscleared on unmake/evict/remap/flip andtlas_gen_isorderedReleasebeforequick_is), preventing stale hits on slot overwrites, heap replacements, orhwrt::tlas_generation()bumps.listed_view_withscopes entries to monotonicState::recording(reset ontables_done()andState::reset()).#[cfg(windows)]modules (descriptor/host.rs,draw.rs).0008339:cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-gpu --all-targets -- -D warnings(pass),--all-features -- -D warnings(pass), andtest -p victory-gpu --lib -- --test-threads=1(842 passed; 0 failed; 39 ignored, includingpending_copies_testsandmirror_cache_tests), matching PR #393 CIcheck(47114145957/job/144280477638).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T13:58:18Z.
Deep Reasoning Audit Pass #18 — PR #394 (
feat/ambient-alpha-and-nort-preset, commit35fe0c4)apps/victory/src/run.rs,crates/victory-gpu/src/{ambient.rs,draw.rs,mirror.rs},crates/victory-loader/src/{hooks.rs,lib.rs,rt_preset.rs}(re-audit of1ce4e98..35fe0c4; merges cleanly againstorigin/main931e127viagit merge-tree)VERIFIED CLEAN (0 P0, 0 P1)Verified Fixes & Invariants:
[VERIFIED FIXED — Pass 1 P1]DXR 1.1 HW-RT (hwrt::active()) gating across ambient stand-ins,Role::Alpha, mirror lighting, andCS_RayMissskip:ambient::title_rt_active()(crates/victory-gpu/src/ambient.rs:175-177) combinespipeline::builder_runs() || hwrt::active().standin_enabled/ambient::on()(ambient.rs:179-192),alpha_enabled/ambient::alpha_on()(ambient.rs:300-307),ambient::around()(ambient.rs:1111-1114),ambient::without_depth()(ambient.rs:1241-1245),ambient::role_decision()(ambient.rs:1309-1319), andmirror::light()(crates/victory-gpu/src/mirror.rs:284-286) all short-circuit when either SW-RT or DXR 1.1 HW-RT is active (preserving stand-in fallback whenVICTORY_HW_RT=1is requested without DXR 1.1 support).State::sky_miss_left_out()(crates/victory-gpu/src/draw.rs:4384-4395) passeshwrt::active()tosky_miss_should_skip()(draw.rs:6888-6902), keepingCS_RayMissenabled under active DXR 1.1 HW-RT.ambient::tests::standin_and_alpha_stay_disabled_when_rt_active,draw::record_hash_tests::ambient_indirect_eligibility_covers_miss_and_alpha, anddraw::record_hash_tests::sky_miss_skip_respects_builder_specular_and_kill_switch.[VERIFIED FIXED — Pass 1 P2]Singlert_preset::asked()evaluation:rt_preset::apply_asked(crates/victory-loader/src/rt_preset.rs:301-305) returnsOption<(Preset, Patched)>andapps/victory/src/run.rs:491-495consumes both from one call, eliminating duplicate unknown-value warning logs.Role::Alpha(CS_SpatialFilterAlpha,bound_alphabarrier/luma guards, indirect flush viaunsettle_indirect),raise()sky skip reset,rt_presetPreset::NoRtlayout &apply_atbounds/BLAKE3/VirtualProtectinvariants, GPL-3.0 attributions, and title-neutrality remain intact with zero new regressions.35fe0c4):check(47119925658/job/144300901914):SUCCESS.+1.98.1-x86_64-pc-windows-gnu):clippy -p victory-gpu -p victory-loader -p victory --all-targets --locked -- -D warnings&--all-features -- -D warnings(pass),xtask policy(asset policy: 352 files ok),xtask(8 passed; 0 failed),victory-loader --lib(66 passed; 0 failed),victory-gpu --lib ambient(19 passed; 0 failed; 1 ignored),victory-gpu --lib draw::record_hash_tests(4 passed; 0 failed),victory-gpu --lib mirror(5 passed; 0 failed), andvictory(47 passed; 0 failed+2 passed; 0 failedcensus.rs).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T14:01:03Z.
Gate 2 Deep Reasoning Audit — Pass #19: PR #387 (
feat/hwrt-rayquery-lift-all-patterns,78bf1c5)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)(4-pass adversarial audit by read-onlyproauditor)[P0]/[P1]soundness findings acrosscrates/victory-shader/src/emit/lower/rayquery/analyze.rs:ir.strip_mov/ir.const_valin candidate/commit recognition withis_plain_valu,strip_plain_mov,plain_const_val, andplain_const_val_in_guardso non-dominating guarded moves cannot drop EXEC guards intoMergeEdges/Always.is_dead_vgpr_exit_phiwithunconditionally_overwrites_vgpr_32and tightenedis_explicit_readfor 16-bit partial writes, DPP, SDWAdst_unused==2/dst_sel>6, cross-lane/RMW ops, M0-relative VGPR moves, and DS atomics.tri_merge_blockPHI handling toCallbackKind::Blocks, addedvalidate_tri_merge_phirejecting mixed masked/guarded + skip/raw callback arms (BlocksMixedMaskedAndOldArmBail) and nested callback-interior merge commits (BlocksNestedInnerMergeCommit), and madecb_val_reachesfail-closed.clippy -p victory-shader --all-targets -- -D warningsclean (0warnings), all28/28rayqueryunit & negative regression tests green.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T14:02:21Z.
Gate 2 Deep Reasoning Audit — Pass #20: PR #392 (
perf/ram-staging-commit-reduction, commit87289a7)Scope: Re-audit of
bd171f1..87289a7acrosscrates/victory-gpu/src/{shadow.rs,texture.rs,texture/ahead.rs,texture_detile_tests.rs}(and full PR contextorigin/main...87289a7; merges cleanly againstorigin/main931e127viagit merge-tree --write-tree).Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Closed Pass 1 Findings & Verified Invariants:
[VERIFIED FIXED — Pass 1 P0]Staging::cpupublication vsforget()/refresh()andensure_cpulock-gap races:CpuStagingnow tracks monotonicid(NEXT_CPU_ID) andpopulated: AtomicBool(Releasestored inStaging::detileonly aftermips_guarddrops and all subresources succeed;Acquirechecked viais_populated()).Staging::refresh_timedchecksself.current_cpu()underself.last.lock()(last -> cpulock order) and invokesLast::reset_for_new_cpuwheneverlast.cpu_id != cpu.id || !cpu.is_populated(), eliminating out-of-lockstaging.forget()races inupload_from,PreludeUpload::finish_refresh, andahead::claim.Staging::prepare_prelude_uploadrefreshes whenever!guard.cpu().is_populated()rather than gating onnewly_made.Staging::ensure_cpuacquiresself.lastbeforeself.cpu(last -> cpu), settingdirty(Release), resettingwritten_mips(Release), installingcpu, and callinglast.reset_for_new_cpu(cpu_id)atomically before unlockingself.cpu, closing the concurrentrelease_cpu_if_idledrop window.[VERIFIED FIXED — Pass 1 P1]Re-acquired zeroedCpuStagingon already-uploaded textures:Staging::refresh_unlockedskips partial-pagefill()whenself.uploaded.load(Acquire)is true.Staging::prepare_prelude_uploadaborts without callingclaim_upload(preservingdirty = true) whenself.uploaded.load(Acquire) && !guard.cpu().is_populated().Staging::prepare_direct_upload/upload_fromsynchronously callsself.refresh()whenself.uploaded.load(Acquire) && !guard.cpu().is_populated(), returningDirectUpload::Unpopulatedwithout recordingCopyTextureRegionor clearingdirtyif unpopulated.ahead::Worker::copy/ahead::finishonly records/commits/flips when!job.staging.uploaded.load(Acquire) || job.upload.cpu().is_populated(), falling back toLISTED(Then::Failed) otherwise.[VERIFIED FIXED — Pass 1 P2]shadow.rslength and partial-commit epoch tracking:Shadow::stale_pagespasseshi - lolength toshadow.card_held(lo - start, hi - lo).Shadow::take/take_landed/copy/take_all/copy_stalepropagate actual copied byte counts andmissedintervals onCardMirror::ensure_committedfailure, skippingmark_copied,self.rangedupdates, and uncommitted slice dereferences/dirty tracking for uncommitted ranges.last -> cpulock order acrossStaging,duplicate/takendropped after unlocking,UploadGuard(pending_uploads: AtomicU32) held until post-fenceHostList::reset()and post-SetEventOnCompletionahead::finish, andpool::stagingzeroes recycled pieces (again == true).Verification (
87289a7):check(47119796155/job/144300449855):pass.+1.98.1-x86_64-pc-windows-gnu):clippy -p victory-gpu --all-targets --locked -- -D warnings(pass),clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings(pass),test -p victory-gpu --lib -- --test-threads=1(850 passed; 0 failed; 39 ignored), anddetile_fallback_tests -- --nocapture --test-threads=1(6/6passed on D3D12 WARP, including the new[P0]/[P1]regression tests plusshadow::card_staging_testsandpool::tests).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T14:06:16Z.
Gate 2 Deep Reasoning Audit — Pass #21: PR #396 (
perf/shader-pure-load-and-srv-cse, commit7e615e6)Scope: Read-only audit of
git diff origin/main...HEAD(commit7e615e6a9a76840960a8c0f16eb9538a00825eed, merge-base4f09e0582f7bdecde4d87cf5c8414712b04ab8c2, 5 files,+903/-17, cleangit merge-tree --write-treeagainstorigin/main) acrosscrates/victory-shader/src/emit/{bitcode.rs,bitcode/opt.rs,lower.rs,lower_tests.rs,mod.rs}.Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Verified Compiler Soundness Invariants:
pure_loads/mark_pure(SLOT_MEMORYpage directory CSE):Module::pure_loads(bitcode.rs:230-234) andModule::mark_pure(bitcode.rs:506-513) live inside privatemod bitcode(emit/mod.rs) and are called only once — inLower::memory_entry(lower.rs:3896-3911) on therawBufferLoad.f32lookup ofroot_srv_handle(SLOT_MEMORY). No UAV,RWStructuredBuffer, TGSM/LDS, scratch/stack, or aliased title-memory load is ever marked pure.Lower::memory_entryclampspagetoMEMORY_PAGES - 1(Tag::Clamp) prior to shifting (lower.rs:3876-3896), preventing out-of-bounds directory indexing on divergent or fault-inducing branches.opt.rsmerge()(1267-1304) never hoists instructions (repl[i] = Some(first)strictly under dominance), andclass()(933-939) /has_effect()(1381-1383) allow CSE acrossSLOT_FAULTSstores/atomics without dropping those stores.DOM_LOADS(128,DEFAULT = ALL = 255) &srv_memory_regions(RawBufferSRV CSE):opt.rs:1027-1086,1267-1304):srv_memory_regionscomputes an RPO fixpoint overtree.order: blocks with conflicting predecessor exit regions (loop headers with back-edge global writes, or diamond joins with one writing branch) pinentry[b] = b, while loop-invariant SRVs and clean branches preserve the dominating region (repl[i]still requiresfirstto dominateiinmerge(), and loop-variant addresses differ in SSAValue/PHI operands).opt.rs:978-1013,lower.rs:1988-1996,7103):is_global_buffer_writetreats only DXIL non-global writes (Op::Store/AtomicRmw/CmpXchg, shader outputs,discard,textureStore) as non-aliasing forRawBufferSRVs;rawBufferStore,bufferStore, atomics, andRayQuerymutators advanceregionand clear intra-blockread. Barriers invalidate wheneverargs.get(1)(int_k) is non-constant or(m & 6) != 0(global UAV fence2or thread-group UAV fence4);Lower::s_barrier(lower.rs:7103) sets bit2wheneverwrites_uavsis true.opt.rs:1093-1119):raw_srv_keymatches onlydx.op.rawBufferLoad.*on adx.op.annotateHandlewhose first resource-property word is exacti32 11(Some((32, 11))— excluding UAV0x1000, ROV0x2000, coherent0x4000, structured, and typed resources; verified againstshader.rs:495,lower.rs:3969,4208,13637).Key::BufferRead(region, *f, args.clone())keys on exact function ID*f(opcode + overload return type) and full operand vectorargs(handle, index/offset, mask, alignment).mod.rs:462,shader_cache.rs:151):translation_fingerprint()hashesshader_opt().to_le_bytes().lobomfz/VIctory-xmem(PR#166,fd19a20) andReTerryDavis/ReVIctory(40b5f9c). Diff is title-neutral (xtask policy:351 files ok).opt.rs:2064-2558andlower_tests.rs:2623-2805(non-dominance, branch/loop-header write invalidation, UAV store/atomic/DeviceMemoryBarrierinvalidation, anddxil.dllvalidation).Verification (
7e615e6):check(47119014357, job144297711208):pass(victory-shader:417 passed; 0 failed; 6 ignored;victory-gpu:840 passed; 0 failed; 39 ignored).+1.98.1-x86_64-pc-windows-gnu):cargo +1.98.1-x86_64-pc-windows-gnu run ... --package xtask -- policy:asset policy: 351 files okcargo +1.98.1-x86_64-pc-windows-gnu test ... -p xtask --locked:8 passed; 0 failed; 0 ignoredcargo +1.98.1-x86_64-pc-windows-gnu clippy ... -p victory-shader --all-targets -- -D warnings&--all-features:passcargo +1.98.1-x86_64-pc-windows-gnu clippy ... -p victory-gpu --all-targets -- -D warnings:passcargo +1.98.1-x86_64-pc-windows-gnu test ... -p victory-shader --lib -- --test-threads=1 bitcode::opt::tests the_clean_up_switch slot_memory_pure_load raw_srv_cse_in_lowered_shader:21 passed; 0 failed; 0 ignored; 402 filtered outImported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T14:20:48Z.
Gate 2 Deep Reasoning Audit — Pass #22: PR #395 (
perf/thin-recording-root-cache, commit564c9ac)Scope: Re-audit of
e1322a6..564c9ac(crates/victory-gpu/src/list.rs,crates/victory-gpu/src/list/thin.rs) and full PR contextorigin/main...564c9ac(6 files,+917/-265, cleangit merge-tree --write-treeagainstorigin/main).Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Closed Pass 1
[P1](StateHold/ whole-struct&mut Listaliasing) & Verified Invariants:MutexGuardinStateHold::scope(list.rs:178-210,thin.rs:1212):StateHold::scopeprojects only&(*this.cast::<List>()).state, keepsguardstationary on its stack frame after derivingptr: *mut State = &mut *guard, stores(this as usize, ptr)inHELD_STATE, and declares_restore = Self { prev }afterguardsoHELD_STATEis restored beforeguardunlocks on return or unwind.StateHold::scopeon the samethisshort-circuits without re-locking;with_locked_state(list.rs:215-234) clearsHELD_STATEacrossfvia an unwind-safeRestoreguard and never re-enterswith_locked_state/StateHold::scopeon the sameList(andState/HostList/hwrt::execute_op/streamline::{note,evaluate}callbacks never call back intocrate::list::*state locks).reset,cut,cut_to_fresh, andvalue_written(list.rs:617-671,996-1006,2811-2825):&mut Listreferences on paths reachable duringthin::translate; only disjoint fields ((*list).earlier,(*list).gate,(*list).host) are projected via raw pointer.cut_to_freshdrops all&mutfield borrows before taking&HostListviahost_list_held(this)and callingwith_locked_state(this, |s| s.replay(host)).detach_parts/cut_list/tables_donerun only afterRecording::wait()(done == true) whenStateHold::scopehas exited.list::bc_copy_tests::state_hold_allows_reset_and_cut_across_held_state(list.rs:3281-3369) andlist::thin::tests::translate_runs_reset_and_commands_under_state_hold(thin.rs:1816-1834), plus updatedstate_hold_reuses_held_mutex_across_calls_and_releases_on_drop(list.rs:3248-3277), exercising nestedStateHold::scope,RESET/reset, untouched/touchedcut,cut_to_fresh,value_written, and post-scopeHELD_STATE/mutex cleanup.Verification (
564c9ac):check(47123882900, job144314857719):pass(victory-gpu:849 passed; 0 failed; 39 ignored;victory-shader:410 passed; 0 failed; 6 ignored;xtask:8 passed; 0 failed).+1.98.1-x86_64-pc-windows-gnu):cargo test -p xtask --locked:8 passed; 0 failed(incl.policy::tests::repository_passes_policy).cargo clippy -p victory-gpu --all-targets --locked -- -D warnings&--all-features -- -D warnings:pass(0warnings).cargo test -p victory-gpu --lib --locked -- --test-threads=1:847 passed; 0 failed; 39 ignoredon clean re-run (initial full run hit one unrelated pre-existing shadow-address reuse flake indescriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes, which passed in isolation and on re-run).cargo test -p victory-gpu --all-features --lib --locked -- --test-threads=1 state_hold translate_runs_reset rootcache listed_views_skip:7 passed; 0 failed.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T16:40:43Z.
### Gate 2 Deep Reasoning Audit — Pass #23: PR #381 (
fix/missing-character-head, commit4d35a2b)Scope: Read-only audit of
gh pr diff 381 --repo Androtim/MiniVI(4d35a2b, base1698b62c, 5 files,+208/-7, cleangit merge-tree --write-treeagainstorigin/main21fcafdproducing142b5e99) acrosscrates/victory-gpu/src/{pipeline/make.rs,shader_cache.rs}andcrates/victory-shader/src/emit/{mod.rs,lower.rs,lower_tests.rs}.Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Verified Invariants:
crates/victory-gpu/src/pipeline/make.rs):HEAD_BLEND_SHAPE_MAP("61e54e90adccaf6a",make.rs:148) is added toscene_input()(make.rs:153-166), settingscene_input = trueandscreen = trueonPending::new(make.rs:182-189).pipeline::hand_out(pipeline.rs:672-676) callsmake::early(&host)before returning thePipelineobject (object::hand_out), queuing it atREQUESTEDpriority intoQueue::screen(ahead ofEARLY/SLOW, serviced by dedicatedSCREEN_WORKERSas well as general workers) and giving dispatch-timemake::readythe separatescreen_budget()(SPENT[1], default 10 s).HostPipeline::newonly translates immutableShader::containerbytes and compiles the D3D12 root signature + compute PSO (and immutablecode_table_addressupload chunk underPOOLmutex if needed).Shader::dxil()holds anArc<[u8]>(reloading transparently fromshader_cacheif previously trimmed bytrim_shader_bytecode) acrossCreateComputePipelineState. Early preparation never touches title GPU buffers, CPU shadow memory, descriptor heaps, or eviction/residency paths, cannot race with GPU writes or title uploads, and adds only the 1 compute PSO the title dispatches.crates/victory-shader/src/emit/{mod.rs,lower.rs,lower_tests.rs}&crates/victory-gpu/src/shader_cache.rs):mod.rs:583-596, 641-691):FACE_PROGRAMScontains 25 unique, valid 16-hex-digit container hashes ("e4a7e088c7780ce8"is already inscene_input()).parse_lds_bounds_exemptandlds_bounds_exempt_matchesenforce exact 16-hex ASCII case-insensitive equality (or explicit"all"/"0"/""); short prefixes and malformed entries are placed inignoredand cannot broaden matching. Thread-localPROGRAMis scoped bywith_programinemit::translate(mod.rs:704) andapps/victory/src/translate.rs:601using an unwind-safeRestoreDropguard; emptyPROGRAMnever matchesFACE_PROGRAMSor custom hashes.shader_cache.rs:65, 207):VICTORY_LDS_BOUNDS_EXEMPTis included inTRANSLATOR_ENV_KEYSandSHADER_CACHE_VERSIONis bumped from2to3, preventing reuse of stalev1/v2cached DXIL blobs even when env defaults match (andpipeline::library::namekeys on translated DXIL bytes).dxil.dllsoundness & title-neutrality:lds_bounds()(lower.rs:786-789) disables bounds clamping only whenVICTORY_LDS_BOUNDS=0orlds_bounds_exempt()matches, keeping clamping active for all other shaders (CS_SortRayTiles, etc.). Localdxil.dll(10.0.22000.0) accepts dynamic LDS indexing under the exemption (Ok(())), while static constant OOB GEPs (if ever constant-folded>= lds_dwords) remain rejected bydxil.dll(andValidatoris offline/test-only, not runtime). Diff is completely title-neutral (xtask policy:353 files ok) with cleanTrustNo1/Darner(GPL-3.0) attributions.origin/main(21fcafd):origin/main(21fcafd) in an isolated temp clone; zero semantic conflicts with#392,#395,#396,#394, or#385.Verification:
check(47070308173, job144127718140):pass(victory-shader:410 passed; 0 failed; 6 ignored;victory-gpu:836 passed; 0 failed; 39 ignored;xtask:8 passed; 0 failed).+1.98.1-x86_64-pc-windows-gnu,pr-381merged ontoorigin/main21fcafdin isolated temp clone):cargo +1.98.1-x86_64-pc-windows-gnu xtask policy:asset policy: 353 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p xtask --locked:8 passed; 0 failed; 0 ignoredcargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-shader -p victory-gpu --all-targets --locked -- -D warnings&--all-features -- -D warnings:pass(0warnings)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked -- --test-threads=1:865 passed; 0 failed; 39 ignoredcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib --locked -- --test-threads=1:416 passed; 3 failed; 6 ignored(PR #381'slds_bounds_exempts_face_programs_from_clampingandlds_bounds_exempt_parsing_and_matchingpass; the 3 PSV0 validation failures —first_half_values_render_on_hardware_and_warp,rectangles_are_drawn_whole,the_rectangle_stage_is_a_geometry_shader— are pre-existing local SDK10.0.22000.0\x64\dxil.dllmismatches, confirmed identically failing on unmodifiedorigin/main21fcafd).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T17:49:17Z.
Gate 2 Re-Audit (PR #387, \
13ec537): VERIFIED CLEAN (\Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T18:00:57Z.
Gate 2 Re-Audit — PR #399 (
perf/xmem-hot-chunk-pinning, commitd5f4ddf)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning re-audit of
5e3fd75..d5f4ddf(ab04297,d5f4ddf) against the earlier Gate 2 findings (memory.rs,draw.rs,host/check_cut.rs, and attributions already verified clean on5e3fd75; CISUCCESSond5f4ddf):[P0]1 &[P0]2 resolved (shadow.rs,host/quiet_tests.rs):gpu_writes_with_quiet,note_quiet_compared, andnote_quiet_compared_addressstrictly gateQuiettoself.card.is_some()(andcopy_back_withroutes throughself.note_quiet_comparedinside the snapshot block). Non-carded (card.is_none()) buffers never activate or skipQuiet, preservingdefer_gpu_write,Shadow::writing,line.written(late_met_known,blocked_by), andshadow.pending(stale_under_writes/Shadow::update) with noAUDIT_EVERYblindness.[P1]3 resolved (hwrt.rs,host/place.rs,host/card_steps.rs,host.rs,shadow.rs): Deterministic GPU writes (hwrtpostbuild queries,place_copy,card_steps) usegpu_writes_always(allow_quiet = false) so they can never be muted even on carded buffers.RelayBack::merge,Host::card_back(gather_card_back_pieces+finish_card_back_ranges, excludingr.pickedand settingchangedbeforeseendeduplication), andShadow::copy_back_withall feed GPU-side change flags (usize::from(changed)) rather thanwrittenbytes.d5f4ddf,list.rs,shadow.rs,host/quiet_tests.rs):#[cfg(test)] inline_snapshotsonShadow::unbackedkeeps CPU-onlyShadow::writingsnapshots inline without touching globalSNAPSor production codegen. New regression tests cover all 3 prior findings cleanly; zero title-neutrality or attribution regressions.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T18:11:12Z.
Gate 2 Re-Audit: VERIFIED CLEAN (0 P0 / 0 P1)
esource.rs, host/twins.rs, host/prelude.rs, host.rs, host/two_queues.rs): \Arc\ (\TwinCell::Retired(Weak)\ on \Drop), Dekker \SeqCst\ (\depth_written/\has_twin) + post-publish check under \TwinSlot::twin, and per-list \pending_depth_writes\ close both the same-list mid-list \depth -> twin\ copy drop and cross-list out-of-order sync race with an acyclic lock DAG (\states -> twins -> pending_depth_writes -> TwinSlot::twin).
ipe.ahead > 0\ unripe path for \Grow::No.
esource.rs, descriptor.rs): Tier 1b removed; \make_waiting()\ now resolves \View::Placed\ via \iew_matches_resource\ / \placed_known.
esource.rs, descriptor.rs): Tier 1a gates on full-footprint \is_fully_unmapped, evicts via \evict_unmapped_resource_slots\ (\use_waiting = false), and restores Phase-3 aborts via
equeue_slots\ + \ exture_made.
esource.rs): \host_barrier\ (\kind == 2) skips emitting a UAV barrier when \existing_twin_resource\ is \None\ and \depth_and_unordered\ (now also guarding \dimension != BUFFER) is \ rue.
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T18:24:09Z.
Gate 2 Re-Audit — PR #402 (
fix/visuals-ghosting-and-pixelated-lighting, commitf87e3a4)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning read-only re-audit of
eb7d35b..f87e3a4and full title-neutrality / path scan oforigin/main...HEAD(all functional code previously verified0 P0/0technicalP1in the prior full audit):[P1]resolved (crates/victory-shader/src/emit/hdr.rs):git diff eb7d35b..f87e3a4touches only the two doc-comment blocks inhdr.rs(nan_scrub_modeandLower::scrub_nan), replacing the retail location reference with title-neutral upstream GPL-3.0 attributions (voidopcode/vilocity598050b/767369a,felicienradio/cold-project-viec62312, andaki-runtime01f6f31byAki-Developer). Zero functional changes were introduced.origin/main...HEAD, 9 files / 946 added lines + commit message + PR #402 body): Zero retail game/character/location names and zero local paths found; cleangit merge-treeagainstorigin/main.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T18:28:10Z.
Gate 2 Re-Audit — PR #401 (
fix/dom-loads-pin-cuda-preload-chroma-bvh-stub, commit35493b8)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning read-only re-audit of
ce60753..35493b8(all production code previously verified0 P0in prior Gate 2 audits; only the unserializedupload::allocate_in_windowunit-test race remained[P1]):[P1]resolved (crates/victory-gpu/src/upload.rs,crates/victory-gpu/src/list.rs,crates/victory-gpu/src/list/thin.rs): All four unit tests that allocate inside[4 GiB, 2^37)viaupload::allocate_in_window(blocks_lie_below_40_bits_and_are_used_again_zeroed,the_pool_is_reserved_in_the_window_and_handed_out_once,every_inline_command_falls_back_to_the_table, andabandoned_upload_ops_reclaim_arena_slots) now acquirelet _turn = crate::window::test_turn();at function entry, serializing cleanly againstwindow::tests::fence_reserves_title_window_and_releases_it_on_dropandstreamline::tests::cuda_preload_holds_window_on_init_and_falls_back_cleanly_when_absent.crates/victory-gpuallocate in[4 GiB, 2^37)(an_unrepresentable_upload_returns_noneandan_unrepresentable_pool_size_returns_noneoverflow and returnNonebefore reachingreserve/POOL;reserve_earlydefaults to0MB).window::test_turn()(TURN) has in-degree 0 in the lock graph (acquired strictly as the first statement of 6 single-threaded#[test]functions, never nested, never combined withwarp_turn()), uses poison-recovering.unwrap_or_else(|e| e.into_inner()), and drops last in LIFO order — zero deadlocks.#[cfg(test)]); commit message and diff are 100% title-neutral with zero clippy/warning regressions (_turnnamed binding avoidsclippy::let_underscore_lock).[P2]note:list.rs:2993is in a module without#[cfg(windows)](unlikeupload.rsandlist/thin.rs), thoughvictory-gpuis already Windows-only onorigin/main(mod ambient;unconditionally importswindows::Win32::*, and CI runs solely onwindows-latest).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T18:34:24Z.
Gate 2 Re-Audit — PR #403 (\perf/dstorage-cache-parts-one-call-dynamic-chunk, commit \
e217efe)Verdict: \VERIFIED CLEAN (0 P0, 0 P1)\
Pure-reasoning read-only re-audit of \df0efa2..e217efe\ (10 files, +388/-31 lines) verifying all 1 [P0]\ and 2 [P1]\ findings from the prior Gate 2 audit:
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T19:07:58Z.
Gate 2 Re-Audit — PR #404 (
perf/interp-live-stream-bound-segment-tight, commit8415763)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning read-only re-audit of
63f0e19..8415763(crates/victory-shader/src/io.rs,+169/-4lines; all other files previously verified0 P0, 0 P1in prior re-audit of63f0e19):[P0]resolved (crates/victory-shader/src/io.rs,InterpReach::value_reachable&live_non_folded_values):InterpReach::value_reachable(lines 695–718) now propagates(w_out, next_avoided)along inactive (!gw) lanes whenever a non-full-overwrite instruction writes VGPRregunderguard = Some(gw)(inst.write(reg) == Some(w_out)), even when the active-lanemeet(&check)returnsfalse. It enforces the samenext_avoided.len() >= 8 => trueconservative cap,sort_unstable()canonicalization,pass_checkROBDD feasibility test, andseendeduplication as the full-overwrite branch.live_non_folded_values(lines 890–894) now records(site, exec_epoch, w_out, val)inoverwriteson the non-full-overwriteelsebranch whenevermatches!(reg, Reg::V(_))andinst.write(reg)isSome(w_out), ensuring downstream liveness outside(site.0, gw)/(site.0, w_epoch)propagatesUseGuard::Mixedback through chained guarded RMW / partial VGPR writes to earlier guarded overwrites in both structured and unstructured modes while preserving lattice monotonicity and termination.guarded_rmw_and_partial_write_after_guarded_overwrite_keep_first_half_weighted): covers both guarded RMW (v_add_f32 v2, 1.0, v2, VOP2 op0x03) and guarded partial write (v_cvt_f16_f32 v2, v3, VOP1 op0x0a) after guardedv_mov_b32 v2, 0in bothraise_structuredandraise.[P1]resolved (crates/victory-shader/src/io.rs,reads_inactive_lanes):reads_inactive_lanes(line 748) now includesv_readfirstlane_b32(matches!(name, "v_readlane_b32" | "v_readfirstlane_b32")), preventing guarded overwrites from killing first-half values observable viaWaveReadLaneFirstfallback (EXEC == 0) or pixel helper-lanefirst_laneownership.emit/lower.rs(dpp,v_readlane_b32,v_readfirstlane_b32,v_permlane16_b32/v_permlanex16_b32,v_writelane_b32,ds_swizzle*,ds_*permute*) — no remaining unguarded inactive-lane readers.inactive_lane_vgpr_readers_keep_first_half_weightedwithv_readfirstlane_b32 s4, v2, VOP1 op0x02) in bothraise_structuredandraise.63f0e19..8415763touches onlycrates/victory-shader/src/io.rs; zero title-neutrality violations, zero local paths, zero new issues. Confirmed8415763885666f39bcab1a5f3faff7d7f0b30403is PR #404's pushedHEAD.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T19:28:18Z.
Gate 2 Deep Audit — PR #407 (
fix/silent-restart-headless-safety, commit4cd20c2)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning read-only audit of
origin/main...HEAD(4cd20c2, 2 files,+76/-14lines) verifying both findings from the prior PR #406 Gate 2 audit (audit_406.md):[P0]resolved (headlessCREATE_NO_WINDOWstdin prompt deadlock):apps/victory/src/play.rs(lines 602–636): addshas_console_window()(kernel32::GetConsoleWindowvia Rust 2024unsafe extern system, with#[cfg(not(windows))]fallback), pureis_interactive_console(stdin_is_terminal, no_console, has_console_window), andinteractive_console().offer_dlss,offer_fsr,offer_mfg,check_shader_model,hold_window) now gate oninteractive_console()instead of rawstd::io::stdin().is_terminal(), preventing invisible blocks onCREATE_NO_WINDOW'sCONIN$or whenVICTORY_NO_CONSOLE=1.crates/victory-gpu/src/host/menu.rs(lines 244–249): headlessrestart_command_linenow passes-NonInteractivetopowershell.exeand pipes$null | & '{play}' {args}so the restarted child receives a closed anonymous stdin pipe (EOF,is_terminal() == false) instead ofCONIN$, providing defense in depth even for non-MiniVItargets.[P1]resolved (staleVICTORY_RESTART_EXIT_CODEinherited acrossspawn_restart):crates/victory-gpu/src/host/menu.rs(lines 242–255): both headless and console branches ofrestart_command_linenow executeRemove-Item Env:VICTORY_RESTART_EXIT_CODE -ErrorAction SilentlyContinue;before launching{play}. Any self-spawned PowerShell child (such as post-preload == truerestarts) therefore clears the stale parent-supervision exit code and cleanly reverts to self-relaunch on subsequent restarts while preservingVICTORY_NO_CONSOLEviaKEPT.GetConsoleWindowFFI signature (*mut std::ffi::c_void,extern system,#[link(name = kernel32)]) is ABI-accurate and only checked via.is_null().interactive_console_blocks_prompts_when_headless_or_non_ttyinplay.rs,restart_command_line_differs_between_console_and_headless_modesinmenu.rs) cover all branches cleanly.[P0]/[P1]bugs, zero title-neutrality violations, and zero local paths. Confirmed4cd20c2db92d876677465e6d74117554712bdb9cis PR #407's pushedHEAD.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T20:51:36Z.
Gate 2 Re-Audit — PR #408 (
perf/placed-fill-card-and-list-fronts, commit4ac99b5)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning read-only re-audit of
b69ec4f..4ac99b5(crates/victory-gpu/src/host.rs,crates/victory-gpu/src/host/place.rs,+6/-27lines; fullorigin/main..HEADpreviously verified0 P0in prior Gate 2 audit ofb69ec4f):[P1]resolved (crates/victory-gpu/src/host/place.rs&crates/victory-gpu/src/host.rs):order_aware()(lines 194–197),fill_card()(lines 235–238), andfill_multi()(lines 243–246) now initialize directly fromVICTORY_PLACED_ORDER_AWARE,VICTORY_PLACED_FILL_CARD, andVICTORY_PLACED_FILL_MULTIvia per-functionstatic ON: OnceLock<bool>getters (defaulting to enabled unless set to0), matchingon()andstale_fix().ORDER_AWARE/FILL_CARD/FILL_MULTIAtomicBool::new(true)statics,fill_card_latch(), and itsHost::submit()call site incrates/victory-gpu/src/host.rs(zero remaining references across the repository).log_fills(),blocked_by(),read_by(), orleft_stale()paths) now observeVICTORY_PLACED_*=0immediately rather than falling back to unlatchedtruedefaults.std::sync::OnceLock::get_or_initguarantees race-free single initialization and immutable submission-wide agreement across all callers (blocked_by,read_by,read_by_left,left_stale,kept_fills,fills_stayed,fills_on_card,log_fills).fill_multi()gates cleanly onfill_card()inside its initializer (fill_card() && ...) with a strict acyclic dependency (fill_multi -> fill_card), soVICTORY_PLACED_FILL_CARD=0forcesfill_multi() == false.OnceLockandOrderingremain in active use); pure unit tests inplace.rsremain self-contained; GPL-3.0 attributions inplace.rs(vi-rdna4/VIctory-9070XT,7b47335) andfront.rs(ReTerryDavis/ReVIctory,ad297b1) are intact; zero title-neutrality violations and zero local paths. Confirmed4ac99b56340be4aa0c102dd689edeb34cbde9b2bis PR #408's pushedHEAD.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T21:00:30Z.
Gate 2 Deep Audit — PR #409 (
fix/revert-broken-rt-skip-and-standin-defaults, commit9de107b)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning read-only audit of
origin/main..HEAD(7fbc01d,9de107b; 5 files,+220/-54lines):crates/victory-gpu/src/pipeline.rs&draw.rs:VICTORY_RT_SKIP_RESOLVEandVICTORY_RT_SKIP_DEADdefault OFF (strict opt-in=1viais_some_and(|v| v.trim() == 1)) and remain disabled whenever any RT mode is active (hwrt || bvh_builder || rays).CSComputeSkinningis excluded fromDeadRt::Feedsso mesh skinning/deformation is never dropped.VICTORY_BVH_STUB(xboxbvh.rs),DOM_LOADS(bitcode/opt.rs), andVICTORY_CUDA_PRELOAD(streamline.rs) remain intact.crates/victory-gpu/src/descriptor/host.rs:VICTORY_STANDIN_OPAQUEdefaults OFF viacrate::asked_for!so neutral stand-ins use[0x80, 0x80, 0x80, 0x80](0x80 alpha) instead of opaque 0xff alpha.gray_fits()excludes single-channel mask formats (R8_UNORM,BC4_TYPELESS,BC4_UNORM) and HDR float/BC6H formats (R16G16B16A16_FLOAT,R11G11B10_FLOAT,BC6H_TYPELESS,BC6H_UF16,BC6H_SF16), falling back cleanly to typednull_for(view, at)descriptors reading(0,0,0,0)while preserving neutral gray stand-ins for color/YCbCr/BC5/BC7/RGBA8 textures.crates/victory-gpu/src/ambient.rs:GATHERED_FRAME(initialized tou64::MAXand updated on everyplace+gatherinRole::ResolveandRole::Miss) ensuresmiss_needs_gatheronly reusescells/pointsinSet::Estimatewhen already gathered on the current frame, preventingreflect_lightfrom reading stale or uninitialized buffers.without_depth(bound_light) gates gathered-point blending ongathered_points_fresh(current or immediately preceding frame), cleanly falling back tocells[CELLS].rgbotherwise.VICTORY_AMBIENT_RTband behavior underbuilder_runs=true(SW-RT): runsRole::RadianceandRole::Resolve(pass.raisewith(least, most, level)) to lift unlit/starved blocks tofound * least, preserve normal traced diffuse, and cap spikes tofound * most, while skippingRole::Miss/Role::Air/Role::Alpha; underhwrt_active=true(HW-RT),standin_enabledisfalseandtitle_rt_active()istrue.crates/victory-gpu/src/pipeline/make.rs(commit9de107b):CS_RaytracingResolveonPending::rt_resolve, routesEARLYtoQueue::slowandREQUESTEDtoQueue::requested_slow(even on a cold cache), and skips blockingwait()onrt_resolveso cold RT resolves never exhaust the shared 80 ms per-frame wait budget.Queuestate machine & concurrency invariants:queue_statetransitions monotonically (NOT_QUEUED < EARLY < REQUESTED < MAKING) underQUEUEmutex;screen -> requested -> earlyalways drain ahead ofrequested_slow -> slow;unclaimed(..., REQUESTED)/unclaimed(..., EARLY)prevents double-popping or double-countingWAITINGacrossEARLY -> REQUESTEDpromotions;slow_nowincrements/decrements strictly 1-to-1 withwas_slowunderQUEUEmutex (p.make()iscatch_unwind-guarded) withAVAILABLE.notify_all()under the lock — zero leaks, underflow, missed wakeups, or deadlocks acrossslow_limit() == usize::MAX,>= 1, or multi-worker contention.9de107b807f4e1d4d945b7e7edd3538b77d85a79is PR #409's pushedHEAD.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T21:11:45Z.
Gate 2 Deep Audit — PR #410 (
ci/atomic-draft-release, commitc729ad7)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning read-only audit of
origin/main..HEAD(c729ad7;.github/workflows/release.yml,+12/-0lines):gh api repos/$env:GITHUB_REPOSITORY/releases?per_page=30):permissions: contents: writepaired withGH_TOKEN: ${{ secrets.GITHUB_TOKEN }}grants write access so GitHub RESTGET /repos/{owner}/{repo}/releases?per_page=30returns both draft and published releases, with newly drafted releases at the top of page 1.repos/$env:GITHUB_REPOSITORY/releases?per_page=30terminates$env:GITHUB_REPOSITORYcleanly at/.gh release upload $tag target/release/MiniVI.exe MiniVI.exe.sha256 --clobber):cli/cli(pkg/cmd/release/upload/upload.go->pkg/cmd/release/shared/fetch.go):shared.FetchReleaseraces REST/releases/tags/{tag}against GraphQLfetchDraftRelease(RepositoryReleaseByTag->repository.release(tagName: $tagName) { databaseId isDraft }-> REST/releases/{databaseId}), so targeting a pre-drafted release by pending tag$tagresolves reliably withcontents: writeinstead of failing with a REST tag 404.--clobberensures retries after a partial upload cleanly overwrite any previously uploaded asset rather than failing on duplicate asset names.gh release edit $tag --draft=false):cli/cli(pkg/cmd/release/edit/edit.go&http.go): resolves the draft viashared.FetchRelease, explicitly retainsparams[tag_name] = release.TagName, and sendsPATCH /repos/{owner}/{repo}/releases/{databaseId}with{draft: false, tag_name: <tag>}.prereleasesetting, and newly attached assets; binds cleanly to the already-pushed git tag (refs/tags/v*, wheretarget_commitishis unused once the tag exists); defaultsmake_latesttotrueon GitHub RESTPATCHfor non-prerelease releases.$LASTEXITCODE) & atomicity:ghcommand (gh api,gh release upload,gh release edit, and fallbackgh release create) is immediately followed byif ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }.gh apiexits before falling through togh release create, and a failinggh release uploadexits beforegh release edit --draft=false, preventing publication of an empty or incomplete release.ConvertFrom-Jsonedge cases:gh apiemits compact single-line JSON. Empty array[]unrolls to$null(piping$null | Where-Object { ... } | Select-Object -First 1yields$nullcleanly under$ErrorActionPreference = 'stop'and falls through togh release create); single-element array unwrapping to a scalarPSCustomObjectstill evaluates identically throughWhere-Object ... | Select-Object -First 1.pwshsyntax, zero local paths, 100% title-neutral. Confirmedc729ad76ba20e69cab653755051002dd46c1b2bfis PR #410's pushedHEAD.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T23:53:08Z.
Gate 2 Audit (PR #411, \
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T00:25:29Z.
Gate 2 Re-Audit — PR #412 (\ix/amd-rdna-kill-continue-and-rebar, \
5041795)VERIFIED CLEAN (0 P0, 0 P1)
Pure static re-audit of \48379ce..5041795:
48379ce**:Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T01:22:17Z.
Gate 2 Pure-Reasoning Re-Audit — PR #414 (\
2b03060)Verdict: VERIFIED CLEAN (0 P0, 0 P1)
Re-audited \perf/ecoqos-tearing-hwrt-unmap-and-sl-dedup\ (\47cecb8..2b03060\ and full \origin/main..2b03060) via pure adversarial static reasoning:
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T01:23:50Z.
Gate 2 Re-Audit for PR #413 (\
4fe9e16): VERIFIED CLEAN (0 P0, 0 P1)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T01:25:13Z.
Gate 2 Re-Audit (Pure-Reasoning) — Wave 5B PR #415 (
23050a6): VERIFIED CLEAN (0 P0, 0 P1)crates/victory-gpu/src/host/rec.rs):conflicts()treats per-resource UAV barriers as conflicting with transitions on the same resource across both<= 64and> 64paths inenqueue_barriers(), andblocks_transition_fold()blocks folding across held and intra-batch same-resource and null UAV barriers so a UAV barrier is never left on a non-UAV state.crates/victory-gpu/src/host/rec.rs):D3D12_RESOURCE_BARRIER_TYPE_ALIASING(specific, half-null, and globalNULL) is treated as a hard ordering boundary inenqueue_barriers()and blocks folding infold()andblocks_transition_fold().Job::Valuelocal-vs-ahead precedence incrates/victory-gpu/src/queue/behind.rs):classify_value_join()evaluates local joined-listwill_meetbeforelate_met_known, preservingwait_on_gpu = trueon reused memory-wait slots and keepingJOIN_NEEDS_WAITandhost.rswaited_parts/split_part_waitssemantics sound across direct and split-sendHandoffpaths.Recauto-flush/explicit-flush coverage, borrowedManuallyDropresource lifetimes,NameGateconcurrency/drop safety, GPL-3.0 attributions, and 100% title-neutrality.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T02:18:13Z.
Gate 2 Pure-Reasoning Audit — PR #416 (
chore/split-emit-lower,9cbceb753e6571482c56ad797755fa498b209b33)VERIFIED CLEAN (0 P0, 0 P1)
Pure static line-by-line audit of
f36f3544..9cbceb75(origin/main...HEAD, 4 files undercrates/victory-shader/src/emit/):crates/victory-shader/src/emit/lower.rs(14,901 → 10,708 lines): exact diff is solely the 3 private module declarations (mod buffer;,mod image;,mod valu;) and extraction of two contiguousimpl<'a> Lower<'a>method ranges (9636..12351and12681..14159). All remaining 10,705 lines are byte-for-byte identical; no#[allow]attributes onimpl<'a> Lower<'a>or module-path-sensitive constructs (self::,file!,module_path!) exist in the extracted code.crates/victory-shader/src/emit/lower/valu.rs(2,728 lines): exact 1:1 move ofvaluand its helper methods, with the sole path adjustment at line 1147 (super::shader_opt() & super::bitcode::opt::FIRST != 0→super::super::shader_opt() & super::super::bitcode::opt::FIRST != 0) matching the one-level deeper module path.crates/victory-shader/src/emit/lower/image.rs(954 lines): exact 1:1 move ofimageandcube_direction.crates/victory-shader/src/emit/lower/buffer.rs(543 lines): exact 1:1 move ofbuffer.pub/pub(crate)widening.pub(super)is added only to the 6 methods actually called acrossemit::lowersubmodules (valu,write_half,image,bufferfromlower.rs;join64,split64fromimage.rs). All other helpers remain private.policy.rsintegrity:xtask/src/policy.rsis untouched.lower.rs= 479,753 B CRLF (469,045 B LF),valu.rs= 129,450 B CRLF,image.rs= 44,374 B CRLF,buffer.rs= 24,291 B CRLF.(Non-blocking
[P2]hygiene note:crates/victory-shader/src/emit/lower/buffer.rs:1contains a stray ASCII backspace control byte0x08in the//!doc comment —\x08uffer_*instead ofbuffer_*. Zero behavioral/CI/policy impact; easy cleanup anytime.)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T02:51:29Z.
Gate 2 Pure-Reasoning Re-Audit — PR #417 (\
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T03:02:49Z.
Gate 2 Pure-Reasoning Audit — PR #419 (
fix/console-sample-mask-lod-fade) — VERIFIED CLEAN456ab3f8901b8bc44bfc2b9cfb82e2ad38480980(port ofReTerryDavis/ReVIctoryPR#31/4a783e4, GPL-3.0)Audit Summary
victory-shader):Lower::pixel_mask(emit/lower.rs) computes 2x2 quad parity(x & 1) | ((y & 1) << 1)fromSV_Position.xy(FpToUi), tests bitplaceofUSER_PIXEL_MASK(0x10a), and emitsdx.op.discard(opcode 82, demote-to-helper) inentrywithout branching — preserving 2x2 quad helper lanes for derivatives and composing cleanly with PR #412'sVICTORY_KILL_CONTINUE.flags::EARLY_DEPTH_STENCILso masked-out pixels cannot write depth early.SV_Positionat the preceding VS/MSOSG1output row (position_row) when absent from consoleISG1, uses centroid interpolation beside conservative depth outputs, and rejects row collisions cleanly.with_pixel_maskrestores thread-localPIXEL_MASKvia RAIIDropguard (unwind-safe) and never touches compute / Wave32-on-Wave64 lowering.lower.rsat 463.44 KiB,draw.rsat 316.23 KiB).shader_cache.rs,pipeline.rs,pipeline/host.rs,pipeline/make.rs):shader_cache.rs):mask_key(build(), Some(mask))hashesbuild()+ domain separator +position_rowwhile leaving plain keys unchanged.pipeline/host.rs):library::namehashesroot_blob+ translated stage DXIL bytes + state, naturally isolating masked PSOs.Pending::key(pipeline/make.rs): appendsb"masked"+position_rowfor masked stages while keeping plain keys unchanged.Shader: masked twins live inmasked_twinswith separateOnceLock<Option<Translated>>;Shader::dxil()reloads trimmed masked bytecode viahost_shader_masked, andTranslated::position_rowavoids submission-thread reloads.GraphicsState::clonesafely re-seatsSemanticNamepointers onto clonedCStringstorage.CS_RaytracingResolvethrottle (make.rs) and PR #415'sname_gate(pipeline/library.rs) /host::rec(host.rs) remain completely intact.draw.rs,list.rs,list/thin.rs):0x470)OMSetSampleMaskXis wired on both direct (NEWER_METHODS) and thin (thin::table(true)+plain! SAMPLE_MASK) command lists; older lists remain untouched.VICTORY_SAMPLE_MASK=0short-circuits immediately before touching draw state.State::resetclearspixel_masktoNoneacrossReset/ResetX;State::replaypreservespixel_maskand invalidates cached host bindings across command-list cuts;sample_mask_xuseswith_state(bumpingtitle_callsand flushing held indirect runs so indirect merging cannot coalesce draws across mask changes).u64::MAX/0x0001_0001_0001_0001) map topixel_mask = None, taking the fastplainpath ingraphics_pipeline()with zero extra work or compile stalls; partial masks lazily enqueue guarded twins viamake::readyand fall back toplainwhile compiling.ReTerryDavis/ReVIctoryPR#31(4a783e4, GPL-3.0) attribution across code and tests; 100% title-neutral with zero retail names or local paths.Non-blocking Notes (P2/P3)
lower.rs,self.inputs()?runs beforeself.pixel_mask(mask); if a pixel shader lacksSV_Positionand has an unpackedSV_IsFrontFace(row: None) while the preceding stage placesSV_Positionatfree,FrontFacewould claim that row first andpixel_maskwould safely fall back viaErrto the unmasked pipeline.trim_shader_bytecode(pipeline.rs) only walksSHADERS(plain shaders), notmasked_twins; impact is negligible given the small count of LOD-fade pixel shaders.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T03:18:27Z.
Gate 2 Pure-Reasoning Re-Audit — PR #418 (
b689a095b4439a080b22b2202370892c2123073b)Verdict:
VERIFIED CLEAN(0 P0,0 P1)Verification Summary
Physical::holes(BTreeMap<usize, usize>) +clear_holes:consume_holesuffix fabrication is completely removed.clear_holes(physical, base, len)guardslen == 0, computesend = base.saturating_add(len)(ensuringbase.saturating_add(1) <= endwith zero range-panic risk even atusize::MAX), removes the unique possible overlapping predecessor viarange(..=base).next_back().filter(|&(&at, &size)| at.saturating_add(size) > base), and removes all interior-starting overlaps viarange(base.saturating_add(1)..end)while preserving adjacent non-overlapping entries (at + size == baseandat == end).map_as,map_lazy_as,change,unmap,one_placeholder, all 3 branches ofcoalesce_placeholders(exact single region, split single region, multi-region coalesce with boundary splits), andtitle_virtual_free(bothspanrelease/decommit andMEM_PRESERVE_PLACEHOLDER | MEM_COALESCE_PLACEHOLDERS, guarded by!HOLDING.get()after releasingLIVE).partial_hole_mapping_never_fabricates_stale_holes_for_eager_lazy_or_aliascovers eager, lazy (materialize_for), run-coalescedalias_as(..., true, false), andtitle_virtual_freeplaceholder split paths.XMemAllocatePhysicalPagespage-number budget guard, Wine/disabled-split test guard,ReTerryDavis/ReVIctoryPR#3(7f2fcea, GPL-3.0) attribution, and 100% title-neutrality all remain clean.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T03:22:59Z.
Gate 2 Pure-Reasoning Audit — PR #420 (
fix/smoke-standin-alpha) — VERIFIED CLEAN25267c40b9f735ad9fe4ff2f8be9f2dc6e2a91b9crates/victory-gpu/src/descriptor/host.rs(+146 / -24)Audit Summary
make_neutral()always allocates a 1×1 (1×1×6 for Cube) uncompressedDXGI_FORMAT_R8G8B8A8_UNORMDEFAULTtexture (256-byteRowPitchupload synced on COPY fence) andneutral_for()binds a matchingDXGI_FORMAT_R8G8B8A8_UNORMSRV (MipLevels = 1, matchingArraySize/NumCubes). There are no compressed BCn block encodings to corrupt, zero D3D12 format-mismatch validation errors, and zero NaN risk (strict UNORM[0.0, 1.0]).standin_texel(false)writes[0x80, 0x80, 0x80, 0x00]→(0.50196, 0.50196, 0.50196, 0.0);VICTORY_STANDIN_OPAQUE=1(standin_texel(true)) preserves[0x80, 0x80, 0x80, 0xff]→A = 1.0.NEUTRALSindexing (stand as usize + 4 * usize::from(opaque)) stays strictly in0..8.Shader4ComponentMapping& Per-Format Coverage:standin_component_mapping()forformat_without_alpha()(BC5_TYPELESS/UNORM,R8G8_TYPELESS/UNORM,B8G8R8X8_TYPELESS/UNORM/UNORM_SRGB,B5G6R5_UNORM) encodesFROM_MEMORY_COMPONENT_0 | (1<<3) | (2<<6) | (FORCE_VALUE_1<<9) | (1<<12)=6792(0x1a88), matchingD3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(0, 1, 2, 5).BC5/R8G8normal maps and NV12 UV chroma still read(0.502, 0.502)withA = 1.0.BC1,BC2,BC3,BC7,R8G8B8A8,B8G8R8A8,R10G10B10A2_UNORM,R16G16B16A16_UNORM,B5G5R5A1,B4G4R4A4) keepD3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING(5768/0x1688), samplingRGB = 0.502, A = 0.0(so opaqueBC1/albedo ignores.a, 1-bitBC1/cutout foliage discards cleanly instead of solid gray cards, and alpha-blended smoke/particles/decals stay invisible until resident).gray_fits()preserves every PR #409 exclusion (R8_UNORM,BC4_*,BC6H_*,R11G11B10_FLOAT,R16G16B16A16_FLOAT,R32*_FLOAT, depth/stencil,*_SNORM) and additionally excludesA8_UNORM,R8_TYPELESS, andR9G9B9E5_SHAREDEXPso alpha-only masks and shared-exponent HDR textures stay null(0,0,0,0)..a; water normal maps (BC5/R8G8) keep flat(0.502, 0.502, *, 1.0); reflection/HDR probes stay null(0,0,0,0); host G-buffer/render/UAV targets are excluded bywaits_gray()(!title_fills) and never bindneutral_for().Non-Blocking Notes (P3)
ONE, INV_SRC_ALPHA) without multiplying.rgbby.ain the shader,(0.502, 0.502, 0.502, 0.0)behaves additively (dst + 0.502) rather than blending (0.502 + 0.498 * dst) while unresident; straight-alpha smoke/exhaust billboards benefit cleanly.BC5,R8G8) keepB = FROM_MEMORY_COMPONENT_2(0.502, unchanged from pre-PR #420) rather than hardware'sFORCE_VALUE_0; normal maps and UV chroma only read.rg.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T03:54:23Z.
Gate 2 Pure-Reasoning Audit — PR #381 (
fix/missing-character-head) — VERIFIED CLEAN63ac4217901fd28628bf24526037ec0bdd242ee7(CIcheckPASS)pipeline/make.rs,shader_cache.rs,emit/lower.rs,emit/lower_tests.rs,emit/mod.rs(+214 / -7)Audit Summary
crates/victory-gpu/src/pipeline/make.rs(scene_input()):HEAD_BLEND_SHAPE_MAP(61e54e90adccaf6a) toscene_input(). At pipeline creation,make::early()enqueues it atREQUESTEDpriority intoQueue::screen(non-blocking — never callswait()during creation), preservingleft_outguards and strict lock ordering (QUEUE→DONE/SPENTnever nested), so deadlock is impossible.rt_resolve, touchrequested_slow/slow_now, or compete with PR#409'sCS_RaytracingResolvethrottling.stage == "compute", no"pixel"stage), so PR#419's lazyhost_pipeline_masked()sample-mask twin path is unaffected; unit testthe_head_blend_shape_map_is_made_at_creationmatchesShader's#[cfg(windows)]layout includingmaskandmasked_twins.crates/victory-shader/src/emit/{mod.rs,lower.rs,lower_tests.rs}(LDS bounds exemption):parse_lds_bounds_exempt()defaults (None) strictly to the 25 exact 16-hex hashes inFACE_PROGRAMS, rejects prefixes/malformed tokens intoignored, honorsVICTORY_LDS_BOUNDS_EXEMPT=0(and"") opt-out cleanly, and matches via exact case-insensitive equality (eq_ignore_ascii_case, never prefix match) scoped byemit::translate()'s unwind-safewith_program()RAII guard. Unrelated shaders (includingPROGRAM == "") cannot be accidentally exempted.lower::lds_bounds()gates onlylimit = self.s.title_lds_dwordsvs0(self.s.lds_dwords == 0refusal remains enforced). Exempted programs emit direct on-chip TGSMaddrspace(3)GEP (matching pre-VICTORY_LDS_BOUNDSbehavior): TGSM accesses cannot trigger virtual-memory page faults,halves/ticket(wave_base) run exclusively in the entry block before title code, andpairs(meet()) polling is strictly bounded byMEETING_POLLS— zero D3D12 TDR risk on valid inputs.lower.rssize is474,655bytes (~463.5 KiB), well below the 640 KiB cap.crates/victory-gpu/src/shader_cache.rs:VICTORY_LDS_BOUNDS_EXEMPTtoTRANSLATOR_ENV_KEYS(feeding both shader cache keys andpipeline/known.rsviashader_cache::translation()) and bumpsSHADER_CACHE_VERSION4 -> 5, invalidating all stale v1–v4 DXIL cache entries viavictory-pipeline'sConverter::version().Non-Blocking Note (P3)
append_translator_envencodes unset (None) and empty (Some("")) identically (VICTORY_LDS_BOUNDS_EXEMPT=\0), whereasparse_lds_bounds_exempt(Some(""))disables exemptions whileNoneenablesFACE_PROGRAMS. On Windows (cmd/PowerShell) empty values unset the variable, and the documented opt-outVICTORY_LDS_BOUNDS_EXEMPT=0produces a distinct cache key (VICTORY_LDS_BOUNDS_EXEMPT=0\0).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T04:28:51Z.
Gate 2 Pure-Reasoning Re-Audit — PR #391 (
feat/hwrt-rayquery-lift-remaining) — VERIFIED CLEANaabb9c456d6644f38948ca3067a9afb98ee7ae81crates/victory-shader/src/emit/lower/rayquery.rs,crates/victory-shader/src/emit/lower/rayquery/analyze.rs,crates/victory-shader/src/emit/rayquery_tests.rs(3 files, +5849 / -653 vsorigin/main)Audit Summary
[P1](in-callbackEXECwidening producingst.guards[b][i] == Noneand clobbering opaque-hittmax/accept_first_hitstate): 100% CLOSEDEXEC-subset invariant (analyze.rs:3979-4020,cb_mask_within_ceatL7167-7376):find_triangle_hit_infonow requires a resolvedce = ni_exec_booland proves everyEXECwrite insidecb_inst_sites(both halves in wave64; partial writes fail closed) stays withince.cb_mask_within_cecombinesst.mask_bits(!meet(&[(mb, true), (ce, false)])) with sound unmemoized stack co-induction over callback-internal PHIs (all reachable preds) and subset-preserving callback-internal mask ops (v_cmpx*,s_{and,andn1,andn2,or,xor}_saveexec,s_{andn1,andn2}_wrexec,s_{mov,and,andn2,xor,or,cselect}), matching RDNA2 ISA andstructure.rssemantics while rejectings_wqm, widening saves (s_or/xor_saveexecwith outer masks), and outer-masks_andn2_wrexec/s_movrestores.cb_exec_within_entrygating (analyze.rs:4021-4027): Defense-in-depthcb_exec_within_entrygating is now enforced at everyin_cbguard/preservation site (is_cb_entry_guard,guarded_cb_mov_chain_preserves_opaque,pattern_b_guard_ok,blocks_site_decision,inline_site_decision,preserves_old_state_ok, andpreserves_old_dst_ok).saveexecstack (analyze.rs:6910-6959,7050-7159): Replaced integerexec_depthwithVec<(u8, Value, Option<Value>)>matching exact saved(reg, lo, hi)pairs (both halves in wave64), validatings_xor/s_andn2else-flips strictly againstexec_stack.last(), and rejecting aliased outerEXECrestores (e.g.,s21 = s18).s_andn2_wrexec/s_andn2+ callback-internal PHIs +cb_headentryEXECrestore), Case 1b (without_execz_skips), and Case 2 inlineif/else(s_and/andn1_saveexec+s_xor/s_andn2+ matching restore) remain cleanly accepted.rayquery_tests.rs:5908-6074):in_callback_exec_widening_clobbering_opaque_hit_bailsexercises all 6CallbackKind::Blocks(s_mov,s_or_saveexec,s_andn2_wrexec) andCallbackKind::Inline(aliaseds21 = s18saveexec restore)tmaxandaccept_first_hitstate clobber counterexamples.origin/main...HEAD):Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T04:32:08Z.
Gate 2 Pure-Reasoning Audit — PR #422 (
perf/bounded-placed-view-table) — VERIFIED CLEAN3ed6a9e03fcd938488d4824723e2b733c6b06af8crates/victory-gpu/src/descriptor.rs,crates/victory-gpu/src/descriptor/host.rs(2 files, +436 / -74 vsorigin/main)Audit Summary
ViewEntry,ReadMostly<Views>,MIRROR_CACHE,views_alive):ViewEntry { view, generation, last_used: AtomicU64, live }isSend + Sync;touch()writeslast_usedatomically withOrdering::Relaxedunder shard read guards.ReadMostly::readdrop (RwLockReadGuardRelease) intoReadMostly::write(RwLockWriteGuardAcquire across allSHARDS + 1locks) establishes strict happens-before from every readertouch()toevict_idle_slice'sRelaxedload.last_usedon live generation match:Views::lookup_entry,Views::entry_of,Views::entry_made,views_alive(draw heap buffer-slot cache validation), anddescriptor::host::views_entry_alive(MIRROR_CACHEhits).index, setlive = false, advancegeneration = ((old_gen + 1) & GENERATIONS).max(1)(always in1..=0x3fff_ffff, never0, never colliding withKIND_SHIFTbits30..31, and never overflowingu32), and push tofree. Stale descriptor handles andMIRROR_CACHEentries cleanly resolve toNone/ invalidate both while free and after slot reuse.now.saturating_sub(last_used)andnow.saturating_sub(prev), safe at frame0,last_used == 0, and across concurrent frame-boundary increments.ownerlessFIFO Queue & Resource/Sampler Retention:live+generation+indexguards acrossevict_idle_slice,free_ownerless, andforgetguarantee zero double-free and zero duplicate slot indices infree.evict_idle_sliceprunes already-retired front entries fromownerlesswhile preservingownerless_cap()(1 << 20).View::is_evictable()matches onlyView::Placed(..) | View::Constant(..);View::Shader,View::Unordered,View::Sampler, andView::ConsoleSamplerare never idle-evicted.PLACED_SHAPE_CAP,VICTORY_VIEW_EVICT=0, Lock Ordering & Cursor Bounds:ViewShapes::shapes.len() >= shape_cap(PLACED_SHAPE_CAP = 262_144),shape_number()returnsNoneundershapes_read()without takingshapes_write(), overflowing intoViewswhile keepingLOCAL_SHAPESbounded and consistent.VICTORY_VIEW_EVICT=0restoresshape_cap = SHAPESand disables both periodic and on-demand eviction.maybe_sweep_idle_views()runs at the entry ofsync_heaps()beforeif !sync_on() { return; }and beforeSHADER_HEAPS.read(), so idle sweeps run even underVICTORY_HEAP_SYNC=0(viabegin_sync_heaps()'s!sync_aside()path).views_read()is dropped beforeviews_write(), and on-demand eviction inentry_made()acquires no nested locks — zero lock-order inversion or deadlock.evict_idle_slice()guardslen == 0 || slice == 0, clampssweep_cursor >= lento0, bounds iterations toslice.min(len), and wrapssweep_cursormodulolen— zero out-of-bounds panic possible.GPL-3.0attribution present in commit message anddescriptor.rs(ViewEntry&PLACED_SHAPE_CAP) citingReTerryDavis/ReVIctoryPR#26(fc8f19f) andmonte-alt/vesperPR#25(VSP-19).descriptor.rs=146,885B (143.44 KiB),descriptor/host.rs=561,772B (548.61 KiB).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T04:33:11Z.
Gate 2 Pure-Reasoning Re-Audit — PR #421 (
feat/ambient-alpha-library-version-agility) — VERIFIED CLEAN105c4bd6a7180b188a23c6d6ee19652789ff2ada(baseorigin/maind34843d1c5f4f6cf0add44751135b9969e8ba079)crates/victory-gpu/src/pipeline/library.rs,crates/victory-gpu/src/shader_cache.rs(2 files, +100 / -2 vsorigin/main)Audit Summary
[P0-1]&[P0-2](Agility SDKD3D12SDKVersion = 0edits from34ea9b59): 100% CLOSEDgit diff origin/main..HEADconfirmsapps/victory/src/main.rsandapps/victory/build.rsare 100% untouched vsorigin/main(d34843d).crates/victory-gpu/src/pipeline/library.rsandcrates/victory-gpu/src/shader_cache.rsare modified.crates/victory-gpu/src/shader_cache.rs):#381'sSHADER_CACHE_VERSION = 5cleanly (line 259 untouched).pub(crate) fn translator_id() -> &'static strreturningenv!(VICTORY_TRANSLATOR)(64-hex BLAKE3 built incrates/victory-gpu/build.rs, which hashesshader_cache.rs,victory-shader/src/**,victory-shader/Cargo.toml,Cargo.lock, andrust-toolchain.toml, so translator or cache-version changes automatically rotatetranslator_id()).crates/victory-gpu/src/pipeline/library.rs,TrustNo1/Darner 34b0ba7):made_by_another_build/made_by_another_build_withskips cleanly when neitherhost-pipelines.binnorhost-pipelines.nextexists, falls back safely toBlob::Noneon missing/truncated/corrupt/mismatchedhost-pipelines.translator(never mapping a stale library), and honorsVICTORY_LIBRARY_KEEP_OLD=1opt-in.replace_libraryruns underhost-pipelines.lockonly whenbytes > 0, supersedes any existing pendinghost-pipelines.nextso a stale pending file cannot shadow a newly saved library on next startup, and atomically writeshost-pipelines.translatorviawrite_atomically.VICTORY_LIBRARY_KEEP_OLD=1, mismatched translator, in-place replacement, and pendingNEXT_FILEdetection & superseding.GPL-3.0upstream attribution (TrustNo1/Darnercommit34b0ba7,#188) in comments and commit message.library.rs=54,944B (53.66 KiB),shader_cache.rs=28,141B (27.48 KiB).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T05:40:07Z.
Gate 2 Pure-Reasoning Re-Audit — PR #423 (
fix/watch-page-mirror-alias-hdr-audio) — VERIFIED CLEANca3e4c109e87d4460121d276bfac993beb11000b(baseorigin/main82b11a13f5cff2df35ae533eb61df78997b3a80b)crates/victory-gpu/src/descriptor.rs,crates/victory-gpu/src/watch.rs(2 files, +240 / -13 vsorigin/main)Audit Summary
[P1](watch.rssingle-viewALIASES[1]self/in-range overcount): 100% CLOSEDopen_resolved_with()(crates/victory-gpu/src/watch.rs:3578-3581) now guards the diagnostics-gated single-view counter withif !(first..last).contains(&other) && set.get(other).clean.contains(other), matching the multi-view branch (L3587) soblockitself (included bysnapshot_open_aliases()->inplace::pages_of()) and any clean alias insidefirst..lastare excluded while duplicate external entries are counted at most once (sinceclean.remove(other)immediately clears the bit).set.get_mut(other).clean.remove(other)andPUBLISHED.clear(other)remain unchanged, and all added code/tests stay strictly behind#[cfg(feature = diagnostics)].open_resolved_with_counts_cleared_clean_aliases(L7107-7163) acquireslock_shards(u64::MAX)in ascending shard order to prevent concurrentALIASES[1]noise and verifies exact deltas (2with clean in-rangeb0/b0_in_range+ external cleanb1/b2+ uncleanb3;0when onlyb0is clean and externalb3is unclean).crates/victory-gpu/src/descriptor.rs(sync_record_parts&sync_heaps): 100% CLEANsync_record_partsandsync_heaps, previously verified clean at07427d8075da478187066f781580bdda91060907) is completely untouched in07427d8..ca3e4c1.mod testsadds a#[cfg(windows)]SYNC_HEAPS_TEST_LOCKmutex (with poison recovery) serializing the twosync_heaps()unit tests so parallel test runs cannot consume each other'sMEM_WRITE_WATCHbits.GPL-3.0upstream attribution in code comments and commits (TrustNo1/DarnerPR#163/bc1e3fd, originallyreadmet3xt-lab/foxhoundPR#504;lobomfz/VIctory-xmemPR#424/ca1f0e4).descriptor.rs=153,348B (149.75 KiB),watch.rs=314,349B (306.98 KiB).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T05:50:44Z.
Gate 2 Pure-Reasoning Re-Audit — PR #424 (
perf/audio-offload-apu-dsp) — VERIFIED CLEAN1e14358884c160f8020e088a392a108dea7bf91d(baseorigin/main82b11a13f5cff2df35ae533eb61df78997b3a80b)crates/victory-hle/src/modules/apu.rs,crates/victory-hle/src/modules/dsp.rs(2 files, +1460 / -92 vsorigin/main)Audit Summary
[P1] #1(apu.rsprematureSetEvent/ lost wakeup on cross-stream out-of-order completion): 100% CLOSEDShared::pending_signals: Mutex<VecDeque<(Arc<Slot>, bool)>>mirrorsstate.resultsFIFO order underconnection.statewhenevershared.event != 0, populated before worker submission.run_jobpublishesslot.done.store(true, Ordering::Release), drains only the contiguous completed FIFO prefix underpending_signals, ORs poppedsignalbits intoshould_signal, drops the lock, and callsSetEventiffshould_signalbeforein_flight.fetch_sub(1, Ordering::AcqRel).connection.state -> { pending_signals, senders[i], streams[stream], slot.result }with zero worker acquisition ofconnection.stateguarantees deadlock freedom. Covered byresult_event_waits_for_fifo_prefix_on_out_of_order_completion.[P1] #2(dsp.rsnon-atomicStatusdata race & invalidfence(Release)pairing): 100% CLOSEDdsp::Statusfields are nowAtomicU32(submitted,completed) andAtomicI32(result) under#[repr(C)], preserving the exact 16-byte / 4-byte-aligned ABI (verified bystatus_abi_layout_is_16_bytes_atomic) withUnsafeCelland allread_volatile/write_volatile/unpaired fences removed.run_jobstoresresult(Relaxed) thencompleted(Release); readers pollcompleted(Acquire) before readingresult(Relaxed) and output samples;XDspSubmitCommandpublishessubmitted(Release).[P1] #3(apu.rscross-threadXApuEnqueueCommandsubmission reordering race): 100% CLOSEDXApuEnqueueCommandkeepsconnection.statelocked acrossworkers().submit(stream, job)(and inlinerun_jobfallback/sync execution), ensuring worker shard queue order strictly matchesstate.resultsandpending_signalsFIFO order across concurrent callers.connection.state(andsubmit()dropssenders[shard]before blockingtx.send()), so bounded-channel backpressure cannot deadlock. Covered byconcurrent_enqueue_preserves_fifo_order_on_same_stream.[P1] #4(dsp.rslate in-place overrun buffer aliasing UB whilein_flight > 0): 100% CLOSEDStream::active_outputs: Mutex<Vec<(u32, usize, usize)>>registers(ticket, out_start, out_end)for async jobs with non-nulloutputbeforein_flight.fetch_add(1, Ordering::AcqRel)and removes the ticket inrun_jobafter all output writes (including panic zero-fill) and beforein_flight.fetch_sub(1, Ordering::AcqRel).XDspSubmitCommandbypasses locking on thein_flight.load(Ordering::Acquire) == 0fast path; on overruns (in_flight != 0), it waits (releasing the lock before yield/sleep) only when[command.input, command.input + byte_len)overlaps an active worker output range viaranges_overlap, keeping disjoint double-buffered pipelining non-blocking while establishing happens-before before copyingcommand.input. Covered bylate_in_place_overrun_waits_for_overlap_and_allows_disjoint_pipelining.[P2] #5, Shutdown/Opt-Out & Compliance: 100% CLEANworker_pool_clean_shutdown_drains_and_rejects_after_closemutates(*stream).asynchronous = trueprior to creating&Stream, eliminating test aliasing UB; zero newly introduced[P0]/[P1]issues across both modules.OnceLockglobal pools avoidExitProcessloader-lock deadlocks;VICTORY_AUDIO_OFFLOAD=0(VICTORY_APU_ASYNC=0/VICTORY_DSP_ASYNC=0) cleanly disables offloading with zero threads spawned and preserves MiniVI's APUConverterand mono DSP convolution (VICTORY_DSP_CONVOLVE,VICTORY_DSP_GAIN).GPL-3.0upstream attribution (ReTerryDavis/ReVIctoryPR#37,073fc17) in both files and commit history; file sizes well under 640 KiB (apu.rs=66,403B /64.85 KiB,dsp.rs=39,669B /38.74 KiB); 100% title-neutral with zero retail names or local Windows paths.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:03:49Z.
Gate 2 Adversarial Pure-Reasoning Audit — PR #425 (
perf/w9b-cpu-vram-fps) — CHANGES REQUESTED (0 P0, 2 P1)7c1ed141dab63e93dd378a91eb81f6383ae2054f(basemainab8e3372b8cef19d68c2661f42a737faa9450052)crates/victory-gpu/src/cores.rs,crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/host.rs,crates/victory-gpu/src/host/place.rs,crates/victory-gpu/src/list/thin.rs,crates/victory-gpu/src/watch.rs(6 files, +351 / -26 vsmain)Findings
[P1]crates/victory-gpu/src/cores.rs:52-71(l3_of_sets) — Union size vs.RelationCacherecord size deterministically skips the final cache record on x86_64 Windowswindows-sys 0.61.2on x86_64 Windows,size_of::<SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX>()is 80 bytes (8-byte header + 72-byte union dominated byGROUP_RELATIONSHIP), whereas every single-groupRelationCacherecord returned byGetLogicalProcessorInformationEx(RelationCache, ...)hasinfo.Size == 56bytes (8-byte header + 48-byteCACHE_RELATIONSHIP).at + size_of::<SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX>() <= bytes as usize(at + 80 <= bytes), whenatreaches the final 56-byte record (bytes - at == 56 < 80), the loop always terminates early and silently drops the lastRelationCacherecord.by_processor, causingfast_by_cache()to either falsely classify a uniform dual-CCD CPU as asymmetric X3D or invert fast/slow CCD placement on an X3D CPU.RelationCacherecords via raw pointers without forming&SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX(note: merely lowering the loop guard toat + 56 <= byteswhile still creating&SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EXwould form an 80-byte reference extending 24 bytes past the end ofbuffer, causing immediate Rust UB):ok != 0 && (bytes as usize).saturating_sub(at) >= header_size(whereheader_size = std::mem::offset_of!(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, Anonymous), i.e. 8 bytes).relationshipandrecord_sizefrom the 8-byte header via raw pointers (addr_of!), breaking ifrecord_size < header_size || record_size > (bytes as usize) - at.relationship == RelationCache && record_size >= header_size + size_of::<CACHE_RELATIONSHIP>(), readCACHE_RELATIONSHIPvia raw pointer (ptr.add(header_size).cast::<CACHE_RELATIONSHIP>()), and iterate its group masks (0..cache.GroupCount.max(1)withinrecord_size) to updateby_processorformask.Group == 0.RelationCacherecords (including an L3 record as the final entry) proving the last record is not dropped.[P1]crates/victory-gpu/src/host/place.rs:678-706(copy_barrier_desc) — MissingD3D12_BARRIER_SYNC_BUILD_RAYTRACING_ACCELERATION_STRUCTUREbreaks GPU sync betweenplace_copyand MiniVIhwrt.rsBLAS buildscopy_barrier_descreplaceswait_for_all(D3D12_BARRIER_SYNC_ALL/D3D12_BARRIER_ACCESS_COMMON) inHostList::place_copyandHostList::place_sourcewithshader_sync = D3D12_BARRIER_SYNC_ALL_SHADING | D3D12_BARRIER_SYNC_COPY | D3D12_BARRIER_SYNC_EXECUTE_INDIRECT | D3D12_BARRIER_SYNC_INDEX_INPUT.D3D12_BARRIER_SYNC_ALL_SHADING(0x1000) does not coverD3D12_BARRIER_SYNC_BUILD_RAYTRACING_ACCELERATION_STRUCTURE(0x800000).ReVIctory, MiniVI'shwrt.rsrecordslist4.BuildRaytracingAccelerationStructure(hwrt.rs:1404) on the sameHostListreading vertex (hwrt.rs:2129-2132), index (hwrt.rs:2194-2197), and transform3x4 (hwrt.rs:2345) inputs directly fromShadow::buffer, preceded only by a legacyD3D12_RESOURCE_BARRIER_TYPE_UAV(hwrt.rs:1535), which does not synchronizeCOPYwithBUILD_RAYTRACING_ACCELERATION_STRUCTURE.place_copy->copy_barrier(..., false)->BuildRaytracingAccelerationStructurehas a RAW hazard, andBuildRaytracingAccelerationStructure->copy_barrier(..., true)->place_copyhas a WAR hazard on sharedShadow::buffermemory.raytracing: bool(fromcrate::hwrt::active()) intocopy_barrier_desc(before, raytracing)and includeD3D12_BARRIER_SYNC_BUILD_RAYTRACING_ACCELERATION_STRUCTUREinshader_syncwhenraytracingistrue(keepingRENDER_TARGETandDEPTH_STENCILexcluded;D3D12_BARRIER_ACCESS_SHADER_RESOURCEfor geometry/transform inputs is already inbuffer_access, and gating onhwrt::active()avoids validation issues on non-DXR adapters). Extendcopy_barrier_desc_excludes_render_and_depth_targetsto assert bothraytracing = falseandraytracing = true.Verified Clean Areas
descriptor/host.rs(stride_shadow/address_shadow): Zero-initialized matchingstd::ptr::write_bytes(..., 0, ...); all static-slot callers holdself.made.lock(index)and dynamic slots have exclusiveDynamicPool(Mutex) ownership establishing happens-before across reuse; out-of-range indices fall through safely towrite_volatile. PR #422 & #423 invariants preserved intact.watch.rs(Bits::has/static RESTING):GuardShardstripes align 1:1 with 64-blocku64words (block >> 6), serializingopened_atandrestsper block under the sameMutex<Guards>;!rest.is_zero()prevents premature clearing whenVICTORY_GUARD_RESTis toggled off;open_resolved_with(PR #423) untouched.host/place.rsPR #415 integration:Rec::barriers()+rec.cast::<ID3D12GraphicsCommandList7>()(and fallback&ID3D12GraphicsCommandListcoercion) flush buffered barriers viaRec::deref()beforelist7.Barrier(...);HostListis alwaysD3D12_COMMAND_LIST_TYPE_DIRECT.cores.rshybrid/non-Windows/PR #417: Hybrid CPUs (e.g. i7-13700F) takefast_of(&sets)directly;cores.rsandlist/thin.rsare#[cfg(windows)]-gated; PR #417VICTORY_LANE_PRIORITY(Part::Lane/Helper/Beside,ASKED,settle()) preserved intact.host.rs(late_most512) &pipeline/library.rs:late_most() = 512is bounded bysegments::tightsettling (host.rs:7461-7470) andPORTABLE_DYNAMIC_DEFAULT = 393,216;vram_keep_belowanddraw.rsare untouched;pipeline/library.rshas no legacy-root fallback and is already guarded by PR #421made_by_another_build().GPL-3.0attributions (ReTerryDavis/ReVIctory1ee967b,aefb79b), all touched files under the 640 KiB cap (host.rsshrank to 644,171 B LF;.gitattributesenforces LF). (Minor non-blocking note: PR #425's GitHub description body has PowerShell escape typos like^Gb8e337/\fast_by_cache.)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:13:07Z.
Gate 2 Adversarial Pure-Reasoning Audit — PR #426 (
fix/w9a-indoor-visuals) — BLOCKED (3 P0, 1 P1)8b5d82ee48dd8faf404fa906c35f20b64925d4d8(branched fromab8e337; 8 files,+451 / -21)Blocking Findings
[P0]Use-After-Free on unpinnedThisreturned byresource::target_copy_atcrates/victory-gpu/src/resource.rs:4587-4604,crates/victory-gpu/src/list.rs:2105-2106,crates/victory-gpu/src/host.rs:9246-9269target_copy_atlooks upthis: ThisunderTARGETS_AT.lock(), drops the lock, and returns a raw unpinnedThiswithout callingcrate::object::add_ref_alive(this)to wrap it inHeld(unlikealias_ofatresource.rs:1744-1745). A concurrentRelease(which may already have refcount0and be waiting onTARGETS_AT.lock()insideResource::dropatresource.rs:4291) freesResourceas soon asTARGETS_ATunlocks, whileHostList::texture_copy_to_memorydereferencestexinself.twin_use(tex, false, false)andcrate::texture::upload(self, tex, ©.texture).TARGETS_AT.lock()intarget_copy_at, requirecrate::object::add_ref_alive(this)and returnHeld(this)instead of rawThis; passtex.get()intolist.texture_copy_to_memory(...)while keepingHeldalive across the call.[P0]D3D12 validation error / device removal on MSAA, 3D, or stand-in targets viatarget_copy_at->texback::recordcrates/victory-gpu/src/resource.rs:4587-4604,crates/victory-gpu/src/texback.rs:278-281TARGETS_ATregisters all non-fillstargets, including MSAA render/depth targets (sample_count > 1), 3D UAV/RT volumes (dimension == TEXTURE_3D), and format-substituted stand-ins (stands_in). Previouslytexback::recordwas only reached throughtexture_kind(dimension == TEXTURE_2D && sample_count <= 1).target_copy_atomits these guards:sample_count > 1):texback::recordcallsGetCopyableFootprintsandCopyTextureRegionon an MSAA texture (illegal in D3D12 -> validation error / device removal).dimension == TEXTURE_3D):texback.rs:280computessubresources = mips * u32::from(desc.DepthOrArraySize.max(1)), which is wrong forTEXTURE3D(DepthOrArraySizeis Z-depth; subresource count ismips), passing out-of-bounds subresource counts/indices toGetCopyableFootprintsandCopyTextureRegion-> validation error / device removal.target_format(own) != own): host texture layout does not matchr.desc's format layout.target_copy_at, rejectr.desc.dimension != TEXTURE_2D,r.desc.sample_count > 1, and format stand-ins (let own = pc_format(r.desc.format); if target_format(own) != own && unsafe { copy.texture.GetDesc() }.Format.0 as u32 == target_format(own) { return None; }). Intexback::record, also guardif desc.SampleDesc.Count > 1 { return None; }and computesubresources = if desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D { mips } else { mips * u32::from(desc.DepthOrArraySize.max(1)) }.[P0]Host::submitsync override leavespublish = trueunderVICTORY_SUBMIT_SPLIT=1and dropswaited_partsbarrierscrates/victory-gpu/src/host.rs:7854-7860(interacting withhost.rs:7413-7470,7871,8189,8202-8258,8292-8296,8347-8356)late = falseinsideHost::submitwithout clearingpublishbreaks two invariants:VICTORY_SUBMIT_SPLIT=1(send_latepasseslate = true, publish = true),latebecomesfalsewhilepublishstaystrue:wait_sent()(7871) is skipped despitesettle(7933),flown(8189) becomesfalse, andif publish(8202, 8222) still returns an asyncHandofftosender— completely bypassing the synchronous execute/wait/readback path (8349-8490) and passingh.flown = falseintosend_published->card_record.VICTORY_SUBMIT_SPLIT=0, joined submissions fromexecute_partswith non-emptywaited_partsfall through tohost.rs:8347-8356(singleExecuteCommandLists), silently skippingprepare_part_barriers/execute_part_lists(8292-8296) and dropping inter-part GPU barriers.lateoverride fromHost::submit(host.rs:7854-7860), and instead settle synchronously inHost::send_late(host.rs:7468): computelet packed_linear = order.iter().any(|&i| lists[i].host().deferred().texture_backs.iter().any(crate::texback::Back::is_packed_linear));and settle viaif (told && !late_writes()) || packed_linear { self.settle(&mut submitted, WHY_SYNC); }(preservingwaited_parts,publish => late, and waiting throughrelay_wait/ fence +texback::land_batchbefore returning).[P1]crates/victory-gpu/src/host.rsexceeds the Windows CRLF655,360 Bcap (660,322 B, 100.8%)crates/victory-gpu/src/host.rshost.rsby+1,553 B(644,358 B->645,911 BLF,98.6%of655,360 B, only9,449 BLF headroom), pushing its Windows CRLF size to660,322 B(+4,962 Bover the655,360 Bcap; pre-existing658,732 Bonorigin/main). While.gitattributessetseol=lf, any CRLF checkout/edit exceedsMAX_FILE_SIZE.host.rsfurther (movetexture_copy_to_memory/ sync-settle helper logic intotexback.rs, and/or splithost.rsso it sits well below655,360 Bin CRLF).Verified Clean Areas
texture/ahead.rs(ReVIctory 2b910e0): Requiringjob.upload.cpu().is_populated(), skipping empty copy-list submissions, and callingdescriptor::host::read_short(job.staging.memory as u64)on skipped/failed jobs are race-free, deadlock-free, resetlast.hashviareset_for_new_cpuon direct retry, preserve 8 GB VRAM/staging caps, and do not conflict with PR #420 stand-in alpha or PR #422/#423.victory-shader/src/emit/lower.rs(same_as_done): Sound withVICTORY_KILL_CONTINUE(PR #412) andOMSetSampleMaskX(PR #419);crates/victory-gpu/build.rsautomatically hashesvictory-shader/srcintoVICTORY_TRANSLATORto invalidate shader/pipeline caches (PR #421).texback.rspitch/packing & lock ordering:packed_linear_size,pack_linear_rows, partial-copy clamping, andwatch::writing+host::write_mappedlock order (MAPPING->TICKETS->PHYSICAL, consistent withxmem'sMAPPING.write()->PHYSICAL) are sound.ambient.rs/resolution.rs/ Policy & Clean-Room:ambient.rs(VICTORY_AMBIENT_ALPHA+bound_alpha) andresolution.rs(absent) are untouched; diff is 100% title-neutral with zero local paths and properGPL-3.0attribution; all other 7 modified Rust files are well under the CRLF655,360 Bcap (4.7%–74.2%).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:15:34Z.
Gate 2 Pure-Reasoning Re-Audit — PR #425 (\perf/w9b-cpu-vram-fps) — VERIFIED CLEAN (0 P0, 0 P1)
1193611)Prior [P1]\ Verification
ead_unaligned, eliminating the 80-byte &SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX\ over-read UB and ensuring final 56-byte \RelationCache\ records are never dropped.
ecord_size < HEADER_SIZE || record_size > bytes_left,
ecord_size >= HEADER_SIZE + size_of::<CACHE_RELATIONSHIP>(), checked \GROUP_AFFINITY\ offset arithmetic for \
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:27:47Z.
Gate 2 Adversarial Pure-Reasoning Audit — PR #427 (
perf/w10a-hwrt-cpu-prep,4823582)Verdict: CHANGES REQUIRED — 2
[P0], 2[P1][P0]Findings (Merge Blockers)[P0]PersistentGpuBlasTableDesync & GPU UAF ifalloc_or_reuse_asfails afterlist.plane_uploadcrates/victory-gpu/src/hwrt.rs:3073-3144(andwrite_patchathwrt.rs:724-771)execute_buildregisterslist.plane_upload(patch_bytes, ..., mgr.fill_blas_table_patch(...))ontolist.deferred().steps_rawat lines 3073-3098, and only afterwards callsself.alloc_or_reuse_as(...)at line 3122. Ifalloc_or_reuse_asreturnsNone,execute_buildreturns early at line 3143 without recordingDispatch(patch_groups, 1, 1)(hwrt.rs:3215). Whenlistis later submitted,run_deferred()still executes the queuedStep::Plane→fill_blas_table_patch→cached.write_patch, which clearscached.gpu_dirtyand setscached.gpu_needs_full = falseeven though the GPU table was never patched. Subsequent TLAS builds emitmode = 0no-ops whilegpu_table.bufferretains dangling/freed BLAS GPU VAs (or uninitialized memory on first upload) → GPU use-after-free /DXGI_ERROR_DEVICE_REMOVED.alloc_or_reuse_asbeforelist.plane_uploadso there is no fallible return after registering theStep::Planecallback (or gate the callback on anArc<AtomicBool>armed only afterpatch_tableDispatchis recorded, emitting amode = 016-byte header without touchingCachedBlasTablewhen disarmed).[P0]Unchecked OOB GPU Index Reads viashould_skip_clamp_ib&validated_ibsCachecrates/victory-gpu/src/hwrt.rs:789-812,hwrt.rs:2702-2849,hwrt.rs:4028(interacting withlist.rs:1318,host.rs:7909,8164,8190,9980,watch.rs:1321-1324,shadow.rs:4807,4922)validated_ibswas only aneff_vchint andclamp_ibstill ran on GPU after all submit-time copies/refreshes. PR #427 now uses record-timescanned_max/validated_ibsto omitclamp_ib(should_skip_clamp_ib), opening three OOB GPU crash paths:CopyBufferRegion(Step::Copy) / CPU-write /pickedUAV-write TOCTOU:prepare_trianglesruns at record time (list::external), whileCopyBufferRegion(list.defer_copy→Step::Copy, which does not setsh_ib.written()orwrites_pending_in),sh_ib.refresh(Step::Refresh), and bindless UAV write discovery (picked::declare) run later at submit time. A title recordingCopyBufferRegion(ib, upload)thenBuildRaytracingAccelerationStructure(ib)(or writingibon CPU between record and submit) scans pre-copy bytes (e.g. zeros →scanned_max = Some(0) < eff_vc), skipsclamp_ib, and then executes the BLAS build on newly copied unchecked indices → OOB vertex read / TDR. (Shadow::gpu_writescan also skipwritten.store(true)viaself.quiet.should_skipatshadow.rs:4922.)JOURNAL.aheadduring concurrentvictory-submit(ask_once): Whilevictory-submitholds globalJOURNAL.ahead(host.rs:7909..8164), a worker/title thread callingwatch::writes_since(ib_start, ib_end, true, since)(hwrt.rs:2728) hitsahead(&journal())(watch.rs:1322) without callingGetWriteWatch, returning a staledirty = falseeven if CPU wrote new indices after Frame N'sask_once→ stalevalidated_ibshit skipsclamp_ib.watch_epoch == 0hit onwas_update_req == trueeven on refit fallback:validated_ib_hit(hwrt.rs:804) trustswatch_epoch == 0(includingShadow::placedin-place memory, which forcesNOT_WATCHED) wheneverwas_update_reqis true, beforeflush_blas_waves(hwrt.rs:2082-2182) determines whether the refit matches or falls back to a full build.title_memory_freed_many(hwrt.rs:4028) only checks!gone(ib_va)rather than overlapping[ib_va, ib_va + ibytes).clamp_ibusing record-time CPU scans orvalidated_ibsonShadow-backed IBs (keepvalidated_ibsstrictly as a CPU scan skip foreff_vcexpansion while keeping GPUclamp_ib), or only skipclamp_ibif the validated IB bytes are copied into an immutable staging upload at scan time (or re-validated at submit time afterStep::Copy+ask_once_end, strictly requiringwatch_epoch != 0, no pending/historical/quiet-skipped GPU writes, and range-overlap eviction intitle_memory_freed_many).[P1]Findings[P1]Even-Interval LRU Feedback Throttling (8/16) Can Phase-Lock and Starve Alternating-Frame TLASescrates/victory-gpu/src/hwrt/budget.rs:29-36, 458-473FEEDBACK_ACTIVE_INTERVAL = 8andFEEDBACK_IDLE_INTERVAL = 16are powers of 2;frame.is_multiple_of(interval)never fires on odd frames (frame % 2 == 1) or out-of-phase 2/4-frame cadences. BLASes referenced exclusively by an alternating/half-rate TLAS never receive LRU touches, get evicted afterBLAS_KEEP_FRAMES = 120, and are never re-requested by feedback.7/13or17) or tracklast_feedback_frame: AtomicU64and sample whenframe.saturating_sub(last) >= interval.[P1]CachedBlasTableGeneric::apply_dirtySilently Drops Failedupserts Without Recoverycrates/victory-gpu/src/hwrt.rs:702-718, 1614-1652self.table.upsert(key, ...)returnsNoneduring incremental sync (e.g., a burst of BLASes pushes count to the 75% load limit between TLAS record-timeapprox_blassizing and submit-timefill_blas_table_patch, or a 64-step probe chain saturates),apply_dirtydrops the key whiledirty_blashas already been drained andcached.version = veris stored. Those BLASes remain permanently missing (Missing) from the table until an unrelated resize ormark_dirty_full().apply_dirtyreturn whether anyupsertfailed (overflowed: bool); iftrue, callself.mark_dirty_full()(or triggerrebuild_blas_table_locked) so the next TLAS sync recovers all entries once resized/freed.Verified Clean Areas
BlasHashTable&PATCH_TABLE_HLSL/REMAP_HLSL: Linear probing (0..64), Murmur3 finalizer, circular backshift delete, wrap-around, empty-slot sentinel (0), slot-deduped scatter-patch layout (16 + i*20), and barrier state machine (SRV -> UAV -> SRV) are consistent.ChunkedRefs(BlasRefs) & Lock Hierarchy:Arc::make_mutisolates in-flight TLAS snapshots;HostAs::dropretires resources past GPU fences; lock hierarchy (blas_table -> queue -> lru -> as_map/shown -> recording_tlas -> dirty_blas) is acyclic; allshown/waiting/evictedmutations mark dirty keys after mutating state.flush_blas_waveslist.scratch_held: 256B base alignment + 16Balign_stageoffsets satisfy VB/IB/Transform3x4; oversized waves (> 4 MiBSCRATCH_CHUNK) fall back cleanly totake_list_upload(host.rs:9513-9519); buffer lifetimes hold until post-fenceHostList::reset().Arc<OwnedBuild>+normalize_recipe,cached_meshlet_ibon rehydrate,decoders.rsTLS scratch,Feedbackreadback cleanup &pool.statsgating: Sound, zero leaks, zero OOB indecode_quant24_loop/decode_title_meshlet_ib.655,360 B(hwrt.rs:194,078 B,budget.rs:59,796 B,decoders.rs:26,337 B).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:36:47Z.
Gate 2 Pure-Reasoning Re-Audit — PR #426 (\ix/w9a-indoor-visuals) — VERIFIED CLEAN (0 P0, 0 P1)
d6e031f\ (delta \8b5d82e..d6e031f: 5 files, +289 / -265; full PR \origin/main...d6e031f: 9 files, +697 / -243, merge-base \b8e337)Verification of All 4 Prior Findings
[P0]\
esource::target_copy_at\ UAF — RESOLVED
[P0]\ MSAA / 3D / stand-in D3D12 validation errors — RESOLVED
.desc.dimension != TEXTURE_2D,
.desc.sample_count > 1, format stand-ins (\ arget_format(own) != own && copy.texture.GetDesc().Format.0 as u32 == target_format(own)), and multi-plane textures (\let [plane] = &t.planes[..], including console depth+stencil \118..=120).
[P0]\ \Host::submit\ \late\ override — RESOLVED
elay, then settles synchronously via \if (told && !late_writes()) || packed_linear { self.settle(&mut submitted, if packed_linear { WHY_SYNC } else { WHY_WRITES }); }\ — waiting through
elay_wait\ + \ exback::land_batch\ (when
elay()) or fence wait +
ead_backs\ (when !relay()) with no lock inversion on \self.submitted.
[P1]\ \crates/victory-gpu/src/host.rs\ size cap — RESOLVED
8b5d82e) down to \635,420 B\ LF / \649,589 B\ CRLF (**\99.12%**, -5,771 B\ below the \655,360 B\ cap and -9,143 B\ CRLF smaller than \origin/main) by movingeadback_pool_tests\ into \crates/victory-gpu/src/host/readback_pool_tests.rs\ (\8,762 B\ CRLF) and moving \ exture_copy_to_memory\ into \crates/victory-gpu/src/texback.rs\ (\36,339 B\ CRLF).
Regression & Sanity Check (\
d6e031f)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:37:18Z.
Gate 2 Adversarial Pure-Reasoning Audit — PR #428 (
905e8e7,perf/w10b-shader-opt-m1)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Pure-reasoning audit of
origin/main..905e8e7(opt.rs,lower.rs,mod.rs,cost_checks.rs) plus surrounding context (bitcode.rs,shader.rs,shader_cache.rs,build.rs,descriptor/host.rs,draw.rs,pipeline/host.rs):pred::ONE (6)never emitted: Verified acrossnegate_bool(opt.rs:665),Xor(Cmp, 1)(opt.rs:1152), andswap_pred/canonical_cmp(opt.rs:178-208);pred::UEQfalls back toXor(_, true)andKey::Cmp/facts.comparesnever emit newOp::Cmpinstructions.Op::Binfolding returns early unlessint_bits(ty).is_some(),Key::Bincommutes integer ops only,facts.valuesrecords integerEQ/NEonly (preserving-0.0), andmap_i32_to_f32_armpreserves exact 32-bit bit patterns (-0.0, NaN payloads, subnormals).fractselect preserved:(bitcast(f) & 0x7FFF_FFFF) > 0x7F80_0000yieldsa_min=0, a_max=0x7FFF_FFFFin known-bits (never folded tofcmp uno), and floatSelectis never rewritten toFMin/FMax.promote_float_webs(Select+PHI) &bitcast(select)peephole: Strictlyi32 <-> f32, never touches"dx.types.Handle"(also guarded byis_handle_tyinOp::Select), greatest fixpoint + undirectedwitnessedclosure guarantee zero mixed-type edges, and immediatemerge()removes every resultingbitcast f32 -> f32.Shl/LShrreassociation checkss1 < bits && s2 < bitsand foldssum >= bitsto0(clampingAShrtobits - 1);known_bits(depth 4) is exact across1..=64bits forAnd/Or/Xor/Add/Sub/Mul/Shl/LShr/AShr/URem/ZExt/SExt/Trunc/Select/Countbits/UMin;simplify_callmatches DXIL MSB-indexedFirstbitHi/FirstbitSHiandIMax/IMin/UMax/UMinsemantics; all in-place rewrites strictly decrease SSA DAG depth (no oscillation).FACTS:single_forwardskips onlyb-dominated back-edges, provingpstrictly dominatesb(socand alllearnoperands are loop-invariant outsideb), skips irreducible multi-entry loops, and appliesknown_valonly tobody/term(neverphis).slot_wordmark_pure&dce_insts:SLOT_STRIDES/SLOT_TABLE_STRIDESbind the host's CPU upload buffer (heap.strides) as a root SRV (immutable across the entire GPU dispatch);dce_instspreserves allStore/AtomicRmw/CmpXchg, non-pureEffect::Writescalls, and branch conditions.VICTORY_SHADER_OPTdefault255 -> 1279and build-timeVICTORY_TRANSLATORhash both invalidate old cached DXIL cleanly; 100% title-neutral, 0 local paths,opt.rsis 212,254 B LF / 217,475 B CRLF (well under 655,360 B cap).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:51:46Z.
Gate 2 Pure-Reasoning Re-Audit — PR #427 (
perf/w10a-hwrt-cpu-prep,4489200)Verdict: VERIFIED CLEAN (0 P0, 0 P1)
Audited delta
4823582..4489200and full PR diff (1193611..4489200, touchingcrates/victory-gpu/src/hwrt.rs,crates/victory-gpu/src/hwrt/budget.rs, andcrates/victory-gpu/src/hwrt/decoders.rs) against all 4 findings from comment7405972309:[P0]GpuBlasTabledesync & GPU UAF — RESOLVEDalloc_or_reuse_as(hwrt.rs:3141-3158) now executes beforelist.plane_upload(hwrt.rs:3175-3214), returningfb.readbackon failure without queueing anyStep::Plane.list.plane_upload(hwrt.rs:3175) andlist4.Dispatch(patch_groups, 1, 1)+dispatch_armed.store(true, Ordering::Release)(hwrt.rs:3277-3278).dispatch_armed: Arc<AtomicBool>is checked withOrdering::Acquireat the start of theplane_uploadcallback (hwrt.rs:3176-3182), emitting a 16-bytemode = 0no-op (write_noop_patch) without locking or mutatingCachedBlasTableif unarmed. Alsotarget_fillnow holdsArc::clone(&dest_as)directly (safe across repeated list execution), andplane_uploadfailure cleanly rolls backas_mapviaArc::ptr_eq.[P0]clamp_ibTOCTOU OOB reads — RESOLVEDshould_skip_clamp_ibis completely removed; GPUclamp_ib(hwrt.rs:2877-2898) runs unconditionally on all mutableShadow-backed standard index buffers, keepingvalidated_ibsstrictly as a CPU scan skip foreff_vcexpansion (whose expanded bounds remain verified againstcrate::shadow::find(vertex_buffer, exp_bytes)).ValidatedIbnow storesibytes, andtitle_memory_freed_many(hwrt.rs:4047-4064, 4110-4111) evictsvalidated_ibsvia exact half-open range overlap[ib_va, ib_va.saturating_add(entry.ibytes))againstjoined_spans.[P1]LRU feedback phase-lock — RESOLVEDFEEDBACK_ACTIVE_INTERVAL = 7andFEEDBACK_IDLE_INTERVAL = 13(budget.rs:28-36) are odd primes coprime to 2/3/4/6.should_sample_feedback(budget.rs:462-481) gates onframe.saturating_sub(last_feedback_frame) >= intervalwhile allowinglast_feedback_frame == NO_FEEDBACK_FRAME || frame == last_feedback_frameso all TLASes built on the same sampled frame report without starving alternating or offset-period TLASes.record_feedback_frame(budget.rs:484-500) updateslast_feedback_framemonotonically via CAS only afteralloc_or_reuse_asandplane_uploadsucceed (hwrt.rs:3228).[P1]apply_dirtyfailedupsertrecovery — RESOLVEDCachedBlasTableGeneric::apply_dirty(hwrt.rs:697-746) andrebuild(hwrt.rs:655-692) both returnoverflowed: boolwheneverrefsis uninitialized or anyupsertfails.fill_blas_table_patch(hwrt.rs:1640-1707) immediately falls back torebuild_blas_table_lockedwhenapply_dirtyoverflows, and if rebuilding still overflowscap, invokesself.mark_dirty_full()after updatingcached.version = ver(preserving the acyclicblas_table -> dirty_blaslock order) so the next TLAS sync performs a full rebuild (with a growncapwhen needed) with zero permanently lost entries.Additional Checks
[P0]/[P1]regressions in4489200.origin/mainconflicts on touchedhwrtfiles, and all modified files well under the655,360 Blimit (hwrt.rs:198,132 B,budget.rs:62,482 B,decoders.rs:25,649 B).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T09:57:36Z.
Gate 2 Adversarial Pure-Reasoning Audit — PR #429 (
perf/w11a-shader-opt-m2,2e44fc9)Verdict: CHANGES REQUESTED — 1
[P0], 1[P1]Audited full PR diff
origin/main...HEAD(2e44fc9, 5 touched files) and full context ofbitcode.rs,opt.rs,opt/cfg.rs,opt/licm.rs,emit/mod.rs,shader.rs,hdr.rs,victory-gpu/build.rs, andshader_cache.rsvia pure reasoning (zero builds/edits/runs).Findings
[P0]Cross-lane (wave*/quad*) & derivative (deriv*,unary.f3283..=86, implicit-derivativesample*/calculateLOD*) miscompilation incoalesce_guard_diamondscrates/victory-shader/src/emit/bitcode/opt/cfg.rs:700-738and844-854coalesce_guard_diamondsonly rejectsdx.op.barrieranddx.op.discard*(lines 700-711). For same-guard coalescing (is_same_guard == true), there is no effect check at all onT1/T2; for complementary-guard coalescing (!is_same_guard), lines 716-738 ignoreEffect::Lanes(_ => {}), ignoreAttr::ReadNonederivatives (dx.op.unary.f32opcodes83..=86), and allowEffect::Readsimplicit-derivative texture ops (sample,sampleBias,sampleCmp,calculateLOD) whenever the other branch has noWrites.P: CondBr(g, T1, J1)whereT1computes%v1,J1: %r1 = phi [(%v1, T1), (%x, P)]->CondBr(g, T2, J2), andT2runsquadReadLaneAt(%r1, 0)(orquadOp,waveReadLaneAt,unary.f3283..=86, orsample.f32(..., %r1)with implicit 2x2 quad derivatives). Before coalescing, inactive lane 0 holds%r1 = %xatJ1, and active lane 1 reads lane 0's%x. After coalescing, line 850 rewrites%r1 -> %v1insideT2.body; lane 0 never executedT1, so lane 1 reads uninitialized/stale garbage from lane 0's%v1instead of%x.J1: CondBr(!g, T2, J2)whereT1isEffect::PureandT2callsquadReadLaneAt(%r1, 1)orsample.f32(..., %r1)(Effect::Reads). Before coalescing, lane 1 computed%v1beforeJ1and lane 0 read lane 1's%v1; after coalescing, line 850 rewrites%r1 -> %x(and SIMT hardware may executeT2beforeT1), so lane 0 reads lane 1's%xinstead of%v1.cfg.rs:700-711whenever any instruction inT1.bodyorT2.bodyis:dx.op.barrierordx.op.discard*Effect::Lanes(self.class(&effects, i) == Effect::Lanes)Op::Callwhose strippeddx.op.name starts withwave,quad,deriv,isHelperLane,calculateLOD, or is an implicit-derivative sample op (short.starts_with(sample) && !short.starts_with(sampleLevel) && !short.starts_with(sampleGrad) && !short.starts_with(sampleCmpLevelZero)), orshort == unary.f32with opcode83..=86.quadReadLaneAt/waveReadLaneAt/sample.f32inT2are NOT coalesced.[P1]Speculative out-of-bounds constant-globalOp::LoadinLICM::hoist_safetycrates/victory-shader/src/emit/bitcode/opt/licm.rs:155-175Op::Load(p)from a constant global (space == 0 && init.is_some()) is classifiedHoistSafety::Speculativewithout proving the GEP index is in-bounds. In general IR, a loop-invariant loadif (idx < N) { load @lut[idx] }inside a conditional loop branch will be speculatively hoisted into the preheader and executed unconditionally even whenidx >= N(LLVM UB). (Currently mitigated in translated shaders only becausehdr.rs:182-184clamps itscodeindex withSelect, making this[P1]rather than[P0].)Op::LoadasHoistSafety::MustExecOnly(orHoistSafety::Speculativeonly when every intermediateOp::GepintoTypeDef::Array(len, _)uses a constant deref0and constant element index< len).Verified Clean Invariants
SimplifyCFG(opt/cfg.rs):CondBr(c, T, T) -> Br(T)): verifies PHI agreement onbbefore deduplicating.CondBr(xor(c, true), t, f)): preserves dominance, never emitspred::ONE (6).A -> Bmerge):strip_unreachable_phi_edges()runs first; checksb != a && b != 0 && preds[b] == [a]and single-value PHIs; chain resolution is acyclic and dominance-safe.Select): strictly rejectsdx.types.Handleand non-scalar differing PHIs; preserves SSA dominance.(v, P)PHI collision inTand forbids critical edges into loop headers, back-edges, and loop exits, preservingbitcode.rs:842-871AMD empty-latch folding;pred_countaccounting and PHI dominance are exact.[P0]#1): sign/polarity table across all 8(same_cond/opp_cond, p1_t1, p2_t2)cases,dx.types.HandlePHI exclusion, complementaryWritesvsReads/Writesordering,J1PHI migration toJ2(only whenpreds[j2] == {j1, t2}), andj1_g2_insthoisting toPare sound.LICM(opt/licm.rs):ph, inside +(ph_val, ph)->h), and outer-loop block/membership updates are sound.rawBufferLoadSRVs,textureLoad,sample*, and LDS/TGSMOp::Load(space == 3) areHoistSafety::Never.createHandleFromHeap, non-bindingannotateHandle,cbufferLoadLegacy,getDimensions, andpure_loadsareMustExecOnly;must_exec_limitcovers only the unconditional linear header prefix before anydx.op.discardorCondBr.[P1]#2): Shifts require const RHS< bits(MustExecOnly),UDiv/URemrequire const!= 0(MustExecOnly),SDivrequires const!= 0 && != -1(MustExecOnly);Effect::Lanes,wave*/quad*/deriv*/isHelperLane/unary.f3283..=86,Op::Phi, andEffect::WritesareNever.SIMPLIFY_CFG (256)andLICM (512)wired intoMODULE/ALL/DEFAULT = 2047, hashed viashader_opt()+VICTORY_TRANSLATOR; 100% title-neutral, zero local paths, all 5 touched files well under the 655,360 B CRLF cap (maxemit/mod.rs= 234,788 B).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T10:12:33Z.
Gate 2 Adversarial Pure-Reasoning Audit — PR #430 (
fix/w11c-flicker-ambient,6eb80e0)Verdict: BLOCKED — 3
[P0], 3[P1]Clean / Verified Areas
VICTORY_OCCLUSION_FAR(descriptor/host.rs:1125-1244, 1344-1360,resource.rs:1931-1946): Clean.ResourceDesclayout is statically asserted (56 B = 14 u32),128x72R32_FLOAT(512 B256-byte-aligned row pitch,36 KiBsingleOnceLockallocation onDEFAULTheap via synchronousCOPYqueue decay back toCOMMON) matchesmake_neutrallifetime/lock ordering, never replaces real uploaded textures (neutral_foronly runs on pending/unlanded/evicted slots), and host-filled targets are excluded bywaits_gray(title_fills).VICTORY_PLACED_BY_VIEW(descriptor/host.rs:6836-6878, 7793-7800): Clean. Bothbuffer_extentandmake_twinned_resagree onplaced_width(view)when resource width is0.ambient.rsHLSL & dispatch (CELL_BYTES,RS_STENCIL,place_stencil,gather_stencil,mean,clear_air,bound_alpha): Clean internally.CELL_BYTESmatchesINT_MEAN_IDX/INT_META_IDX,RS_STENCILroot params0..=5matchafter()and cleanly rebind&pass.rootbeforeraise,gather_stencilgroupshared barriers are unconditional,VICTORY_HW_RT=1(!hwrt_active) gating is untouched, andVICTORY_AMBIENT_ALPHAnon-stencil fallback is preserved.ds_holdlock ordering: Deadlock-free (PENDING,RECENT_WRITES,HOLDS,SHORTare never nested).GPL-3.0attribution (ReTerryDavis/ReVIctorycac3d3c), all Rust files comfortably under655,360 BCRLF (host.rs:649,393 B;descriptor/host.rs:587,468 B).[P0]Findings (Must Fix Before Merge)[P0]Out-of-bounds dynamic snapshot handle & unmirrored slot in stencil fallback scan —crates/victory-gpu/src/draw.rs:4792-4818from_usedreturnsNone, the fallback scansoffset in (0..1600u32).step_by(8)(slots0..200) in title table0and computesheap.gpu_handle((start + offset * 4) / 32)wherestartcomes fromself.ambient_tables.iter().find(|m| m.0 == 0).self.ambient_tablesholds the dynamic snapshot basefirst * 32of length ONLYn = (group.max_dword / 8) + 1(and withVICTORY_SNAPSHOT_UAV_TABLESon by default, table0is snapshotted whenever it has a CBV or UAV). If the stencil view sits atoffset / 8 >= n,(start + offset * 4) / 32 = first + offset / 8reads past the end of the snapshot — binding either an unrelated draw's descriptor (CBV/UAV/float SRV/uninitialized) or a GPU handle past the end of the D3D12 descriptor heap (gpu_handlehas no bounds check) -> D3D12 validation error / TDR / Device Removed.0is not snapshotted, slots outsidet.usedwere never mirrored into the host descriptor heap bytable_entry(), so the host slot can be null or stale.crate::descriptor::heap(self.heaps[0] as This)), verifylet Some(index) = title_heap.index(table + u64::from(offset) * 4) else { continue };(in-bounds of the bound heap's mirrored title region[0..host.count()), never offsetting off a dynamic snapshot), explicitly mirror that slot into the host heap (heap.mirror_for_table_with(index, table + u64::from(offset) * 4, |_| {})/heap.mirror) and verify it is non-null before returningheap.gpu_handle(index).[P0]Overly broadstencil_viewpredicate can bind non-uint2/ non-Texture2D/ MSAA SRVs toTexture2D<uint2> stencil_tex : register(t1)—crates/victory-gpu/src/draw.rs:4547-4555, 4783-4818stencil_view()(matches!(pc_format(d[0]), 22 | 47) || (d[1] == 4 && d[6] == 1)) was written as a depth-exclusion filter, not a strictTexture2D<uint2>inclusion check:d[1] == 4 && d[6] == 1matches non-UINT planar plane-1 SRVs (e.g.,NV12/P010UNORM chroma planes).matches!(pc_format(d[0]), 22 | 47)does not checkd[1] == 4(D3D12_SRV_DIMENSION_TEXTURE2D), allowingTEXTURE2DARRAY(5) orTEXTURE2DMS(6) SRVs whose underlyingID3D12Resourcestill reportsD3D12_RESOURCE_DIMENSION_TEXTURE2D.from_used(which omitsd.Dimensionaltogether at:4790) nor the fallback checksd.SampleDesc.Count == 1or that the host resource format has a stencil plane (R32G8X24_TYPELESS,D32_FLOAT_S8X24_UINT,R24G8_TYPELESS,D24_UNORM_S8_UINT).Texture2D<uint2>triggers D3D12 validation errors and/or Device Removed.Role::Resolvestencil selection requiringView::Shader(_, Some(d))(afterplaced_texture) withd[1] == 4(TEXTURE2D) ANDmatches!(crate::resource::pc_format(d[0]), 22 | 47), AND require on the host resourced.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D && d.SampleDesc.Count == 1 && d.Width == seen.Width && d.Height == seen.Height && matches!(d.Format, DXGI_FORMAT_R32G8X24_TYPELESS | DXGI_FORMAT_D32_FLOAT_S8X24_UINT | DXGI_FORMAT_R24G8_TYPELESS | DXGI_FORMAT_D24_UNORM_S8_UINT)in bothfrom_usedand the fallback.[P0]prepare_prelude_uploaduploads unpopulated all-zeroCpuStagingon first upload whenVICTORY_COMING_WAITSdefersrefresh()—crates/victory-gpu/src/texture.rs:2553-2566VICTORY_COMING_WAITSdefers a refresh on a new texture (self.uploaded == false), it returns0without callingdetile(), leavingguard.cpu().is_populated() == false. On the ahead path,texture/ahead.rs:395,471skips recording and falls back toahead = LISTED(prelude upload).prepare_prelude_upload(texture.rs:2554-2565) andself.refresh()defers again, line2557checksif self.uploaded.load(Acquire) && !guard.cpu().is_populated()— which is false becauseself.uploaded == false. Execution proceeds toclaim_upload, setsself.uploaded = trueandself.dirty = false, and copies the unpopulated all-zero staging buffer into VRAM (corrupting/blacking out the texture).prepare_prelude_upload(texture.rs:2557) on!guard.cpu().is_populated()regardless ofself.uploaded(abort and returnNonewithout callingclaim_uploadwheneverrefresh()leftCpuStagingunpopulated).[P1]Findings (Should Fix Before Merge)[P1]ds_hold::RECENT_WRITESring overflow check under-counts multi-rangePAGE_DESTINATIONwrites —crates/victory-gpu/src/ds_hold.rs:105-116, 157-166register_atincrementsWRITE_SEQby1per call but pushes one ring slot per non-empty range into the 64-entryRECENT_WRITESring.dstorage.rs:1717-1724(PAGE_DESTINATION) passesshown_at(&pages, ...), which frequently contains dozens to >64 scattered page ranges. A single >64-range request (or a few multi-range requests) wrapsRECENT_WRITESwhilecurrent.saturating_sub(before) <= 64, silently bypassing the overflow guard atds_hold.rs:161and missing racing writes.WRITE_SEQby the exact number of non-empty ranges written (under theRECENT_WRITESlock so sequence numbers and ring slots advance in lockstep, storingbase + 1 + idxper slot).[P1]read_short(SHORT_IN_A_ROW = 8) is never reset on normal refreshes and is double-counted on deferredaheaduploads —crates/victory-gpu/src/texture.rs:2036-2056, 2283-2383,crates/victory-gpu/src/descriptor/host.rs:1463-1481,crates/victory-gpu/src/texture/ahead.rs:472VICTORY_COMING_WAITScallsread_short(start)on every deferred refresh, andtexture/ahead.rs:472callsread_shorta second time for the same deferred job (+2 per deferred ahead upload). Meanwhileread_all(start)is ONLY called inStaging::fill(texture.rs:2391), never on normal successful refreshes.SHORT.1[start]permanently exceedsSHORT_IN_A_ROW (8)and stops re-queueingstart, leaving textures permanently stuck grey/unuploaded.read_all(start)on normal successful (non-raced) refreshes (gated by a lock-freeAtomicUsizecount ofSHORT.1so the common path takes no lock), and avoid double-incrementingSHORT.1betweentexture.rsandtexture/ahead.rs:472.[P1]In-placedetile(tiled)reads liveself.memoryafterraced_coming, andrefresh_exact_unlockedreturnssizeon race —crates/victory-gpu/src/texture.rs:2233-2247, 2145-2151, 2332-2337texture.rs:2233-2247),raced_coming(last)runs afterdigest(tiled)but beforeself.detile(tiled)readsself.memorya second time without a private scratch copy. A streaming write starting duringdetilewrites torn bytes intoCpuStagingand commitslast.hashwith no retry.refresh_exact_unlocked(texture.rs:2336), returningSome(false)causesrefresh_timed(texture.rs:2145-2151) to returnsizeinstead of0.raced_coming(last)afterself.detile(tiled)(or copy into scratch whends_hold::coming_waits()is enabled / clearlast.hashand markcpuunpopulated if raced duringdetile), and return0fromrefresh_timedwhenrefresh_exact_unlockeddefers on a race.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T10:15:14Z.
Gate 2 Pure-Reasoning Re-Audit — PR #429 (
perf/w11a-shader-opt-m2,dd6b2f0)Verdict: VERIFIED CLEAN (0 P0, 0 P1)
Re-audited delta
2e44fc9..dd6b2f0(merge457db7b+ fixdd6b2f0) and fullorigin/main..dd6b2f0(6c9e70c..dd6b2f0, 5 touched files incrates/victory-shader) via pure reasoning (zero builds, zero edits, zero GPU runs).Prior Findings Resolution (ref: comment
7408048958)[P0]Guard diamond coalescing cross-lane & derivative safety — RESOLVEDcrates/victory-shader/src/emit/bitcode/opt/cfg.rs:40-67(blocks_guard_coalescing) and722-732(coalesce_guard_diamonds):T1.bodyandT2.body;J1.bodycan only be empty or a singleOp::Cmp/Op::Bin(Bin::Xor)).Effect::Lanes,barrier,discard*,wave*,quad*,deriv*,isHelperLane*,calculateLOD*, implicit-derivativesample*(everything exceptsampleLevel*,sampleGrad*,sampleCmpLevelZero*), andunary.f32opcodes83..=86(DerivCoarseX/Y,DerivFineX/Y). Verified against alldx.op.*intrinsics emitted incrates/victory-shader/src/emit/(includinglower.rsandlower/image.rs; nounary.f16exists).simplify_cfg_skips_coalescing_cross_lane_wave_quad_and_implicit_deriv_sample_ops(cfg.rs:1391-1510) verifies rejection for bothsame_guard = trueandsame_guard = falseacrossquadReadLaneAt.i32,waveReadLaneAt.i32,sample.f32,unary.f32(83),calculateLOD, andisHelperLanewith a pureT1, plus a positive control confirming explicit-LODdx.op.sampleLevel.f32still coalesces in both polarities.[P1]Speculative constant-globalOp::Loadin LICM — RESOLVEDcrates/victory-shader/src/emit/bitcode/opt/licm.rs:166-177(hoist_safety):Op::Load(space == 0 && init.is_some()) fromHoistSafety::SpeculativetoHoistSafety::MustExecOnly, restricting hoisting strictly topos < must_exec_limit(unconditional linear header prefix before anydiscardorCondBr). ConfirmedOp::Gepencodes non-inbounds(flag = 0inbitcode.rs:991), so hoisting GEP alone cannot cause UB.licm_constant_global_load_hoists_from_must_exec_but_not_cond_branch(licm.rs:1058-1128) verifiesmust_execheader LUT load hoists intoentrywhile guarded conditional LUT load stays incond_then.Merge & Regression Check
origin/main(6c9e70cis a direct ancestor via457db7b, zero conflict diffs on PR files,origin/main..dd6b2f0touches only the 5 expectedvictory-shaderfiles;6c9e70c'slower.rsconditional exportdiscardis orthogonal and respected by bothcfg.rsandlicm.rs).[P0]or[P1]regressions introduced indd6b2f0; file sizes well below the 655,360 B CRLF cap (cfg.rs65,322 B,licm.rs46,538 B).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T10:44:58Z.
Gate 2 Pure-Reasoning Re-Audit — PR #430 (
fix/w11c-flicker-ambient,88fe4d2)Verdict:
VERIFIED CLEAN (0 P0, 0 P1)Inspected fix delta
6eb80e0..47cc44a, merge commit88fe4d2(clean merge oforigin/maindc55250, zero conflict edits invictory-gpu), and full PR difforigin/main..88fe4d2by pure reasoning only (no builds, edits, or GPU runs).Verification of All 6 Findings from Comment
7408385417[P0]Stencil fallback OOB dynamic snapshot handle & unmirrored slot (crates/victory-gpu/src/draw.rs:4492-4498, 4801-4833) — FIXEDtitle_heapviacrate::descriptor::heap(self.heaps[0] as This)andheap = title_heap.host()?.slot_handle = table + u64::from(offset) * 4and validatestitle_heap.index(slot_handle).filter(|&i| i < heap.count()), eliminating all dynamic snapshot offsetting (self.ambient_tables) and heap OOB risk.heap.mirror_for_table_with(index, slot_handle, |_| ())(skipping onNone) and verifieshandle.ptr != 0before returningheap.gpu_handle(index).[P0]StrictRole::Resolvestencil predicates (crates/victory-gpu/src/draw.rs:4787-4820, 7109-7137, 7187-7256) — FIXEDis_resolve_stencil_viewresolvesplaced_textureand strictly requiresView::Shader(_, Some(d))withd[1] == 4(TEXTURE2D) ANDmatches!(crate::resource::pc_format(d[0]), 22 | 47).is_resolve_stencil_resourcestrictly requiresD3D12_RESOURCE_DIMENSION_TEXTURE2D,SampleDesc.Count == 1,Width == width && Height == height, and stencil-bearing DXGI format (R32G8X24_TYPELESS | D32_FLOAT_S8X24_UINT | R24G8_TYPELESS | D24_UNORM_S8_UINT).from_usedand the table-0 fallback, with unit test coverage (resolve_stencil_view_and_resource_predicates_are_strict).[P0]prepare_prelude_uploadall-zero unpopulatedCpuStaging(crates/victory-gpu/src/texture.rs:2576-2598,crates/victory-gpu/src/texture_detile_tests.rs:612-669) — FIXEDif !guard.cpu().is_populated() { drop(guard); return None; }regardless ofself.uploaded, preventingclaim_upload(uploaded = true,dirty = false) or copying unpopulated zero staging on deferred first uploads.first_upload_prelude_aborts_when_coming_write_defers_refresh.[P1]ds_hold::RECENT_WRITESmulti-range sequence overflow (crates/victory-gpu/src/ds_hold.rs:105-124, 158-177, 350-377) — FIXEDregister_atacquiresRECENT_WRITES(strictly after droppingPENDING, preserving deadlock-free lock ordering), assignsseq = base + 1 + writtenfor each non-empty range, and publishesWRITE_SEQ.store(base + written, Release)under the lock.active_or_raced_since_atchecks> 64both lock-free and again underRECENT_WRITESlock so multi-rangePAGE_DESTINATIONwraps are never missed.multi_range_register_advances_seq_per_non_empty_range_and_detects_ring_overflow.[P1]read_shortreset & no double-count (crates/victory-gpu/src/descriptor/host.rs:1460-1488, 13271-13316,crates/victory-gpu/src/texture.rs:1972-2426,crates/victory-gpu/src/texture/ahead.rs:68, 222, 392-400, 475-478, 519-522) — FIXEDSHORT_TRACKED: AtomicUsizetracksSHORT.1.len()underSHORTlock (Release), givingread_alla lock-freeAcquirefast path when empty and clearing bothSHORT.1andSHORT.0when tracked.read_all(start)is called on all normal successful (non-raced, non-all-zero) refresh paths (writes_since,!committed,through_copy, in-place committed,refresh_unlocked,refresh_exact_unlocked,fill).Staging::refresh_noted_short()propagates whetherread_shortwas already invoked intoJob::short_noted, preventing double-increment inahead::finish()(both skipped-record and failure paths).read_short_caps_at_short_in_a_row_and_read_all_resets_tracking.[P1]In-placedetilerace re-check &refresh_timedreturn 0 on race (crates/victory-gpu/src/texture.rs:2154-2164, 2261-2268, 2333-2371, 2785-2789) — FIXEDraced_coming(last)is re-checked afterself.detile(tiled), clearinglast.hash = Noneandcpu.populated.store(false, Release)and returning(0, true)if a streaming write raced duringdetile.refresh_exact_unlockedreturnsExactUnlocked::{Read { changed }, Raced, Missing}, andrefresh_timedreturns(0, true)onExactUnlocked::Raced.Regressions, Policy & File-Size Check
[P0]/[P1]regressions in88fe4d2: None (0 P0,0 P1).[P2]note: Incrates/victory-gpu/src/texture.rs:2044-2050,let coming_before = crate::ds_hold::write_seq();runs immediately afterds_hold::active(start, end). Movingwrite_seq()aboveactive(start, end)would close the ~2-instruction preemption window betweenactive() == falseandwrite_seq()(pure polish, non-blocking).GPL-3.0attribution (ReTerryDavis/ReVIctory).< 655,360 BCRLF): PASS — largest in repo iscrates/victory-gpu/src/host.rs(649,399 BCRLF, untouched); largest modified in PR #430 iscrates/victory-gpu/src/descriptor/host.rs(589,862 BCRLF).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T11:00:14Z.
Gate 2 Adversarial Pure-Reasoning Soundness Audit — PR #431 (
perf/w11b-rayquery-phase3@2fb54dc)Verdict: CHANGES REQUESTED — 5
[P0], 2[P1]Audited the full diff (
origin/main...HEAD,2fb54dc) alongside full surrounding context incrates/victory-shader/src/emit/lower/rayquery/analyze.rs,emit_rq.rs,structure.rs,ir.rs,emit/lower.rs, andrayquery_tests.rs.analyze.rs403,852 B,rayquery_tests.rs308,824 B,emit_rq.rs59,455 B(all comfortably under655,360 B).[P0]Findings (Miscompiled Ray Queries — Must Fix Before Merge)1.
[P0]Inverted dynamic-opacitys_and_saveexec_b32/64callback entry (!(1 == v_opaque)) constant-folds EVERY callback commit & mask tofalseanalyze.rs:3596-3638(is_non_opaque_mask/nonop_idx),analyze.rs:6922-6944(collect_bool_atoms),analyze.rs:7170-7249(eval_pre_callback_lane_bit),emit_rq.rs:327-333,emit_rq.rs:648-660.v_cmp_eq_u32 vcc, 1, v_opaquedefineslvwithst.masks[&lv] = E0 & Atom::Lane(lv)(structure.rs:1384-1386).s_xor_b32/64(..., -1)+s_and_saveexec_b32/64sets callback entryEXECtoce = E0 & !Atom::Lane(lv).v_cmp_*(including Pattern B's commit maskv_cmp_ne_u32 vcc, 0, v0and any internalv_cndmaskcondition) buildsst.masks[&m] = EXEC & Atom::Lane(m) = E0 & !Atom::Lane(lv) & Atom::Lane(m)(unsimplified bygiven(..., reach)).collect_bool_atomsencountersAtom::Lane(lv)and callseval_pre_callback_lane_bit."v_cmp_eq_u32"has no matching arm, falling through to_ => PreboundLane::Const(true)(analyze.rs:7247)!emit_rq.rs:328bindslane_bits[lv] = true. At runtime,self.boolean(E0 & !lv & m)evaluatestrue & !true & m == false.CommitDecision::Mask(dx.op.rayQuery_CommitNonOpaqueTriangleHit) and everyv_cndmaskinside such a callback is silently constant-folded tofalse(including in PR #431's own tests_and_saveexec_inverted_opacity_callback_entry_lifts_and_rejects_unrelated, which only checkedrq.lifted == [1, 0]and DXIL validity).collect_bool_atoms(analyze.rs:6925), checkceagainstAtom::Lane(lv)(viast.masks.get(&lv)whenceimplies the compare's EXEC, or directly fromst.boolssupport polarity underce) so any atom forced false byce(includingv_cmp_eq_u32(1, v_opaque)) is prebound toPreboundLane::Const(false).v_cmp_eq_u32(1, v_opaque)->Const(false)/v_cmp_eq_u32(0, v_opaque)->Const(true)ineval_pre_callback_lane_bit, and fail closed (Err) on unknown pre-callbackAtom::Lanes whose truth value underceis not proven instead of defaulting toConst(true).s_and_saveexec_inverted_opacity_callback_entry_lifts_and_rejects_unrelatedto assert the pre-callback opacity compare atom is bound tofalse(and/or that the lowered commit branch is not constantfalse).2.
[P0]Opaque-lane mutations & post-merge discards of user accumulators are silently dropped infind_callback_accumulator_next(Inline & Case 1b Blocks) andis_callback_only_user_accumulator(Case 1b Blocks)analyze.rs:9633-9649,9702-9725(find_callback_accumulator_next);analyze.rs:4824-4837(is_callback_only_user_accumulator).CallbackKind::Inlineinfind_callback_accumulator_next(analyze.rs:9635-9646): Accepts anysiteincb_siteswithst.guards[site.0][site.1].is_some()and setsfound = Some(v)without checkingold_dst(read_old_dst_inactive). Ifsearch_blk[..ni]savesv44 = v41_hdrand mutatesv41on opaque hits (v_add_nc_u32 v41, 2, v41), and the inline callback executesv_add_nc_u32 v41, 1, v44(guarded byce, whoseold_dston opaque lanes isv41_hdr + 2),find_callback_accumulator_nextreturnsSome(v41_cb)andemit_rqemits valid DXIL that silently drops every opaque hit's+2update.CallbackKind::Blocks(without_execz_skips, no opaque skip edge totri_merge_block): Every predecessor oftri_merge_blockis incb_block_set, while opaque lanes flow throughcb_blockswithEXEC = cemasked OFF (preservingold_dst). Bothfind_callback_accumulator_next(analyze.rs:9637-9646,9702-9713) andis_callback_only_user_accumulator(analyze.rs:4824-4837) accept without walkingread_old_dst_inactive, silently dropping opaque-lane updates tohp.find_callback_accumulator_next(analyze.rs:9714-9724): ForCallbackKind::Inline(whereunvisited_non_cand/verify_post_merge_flow_unconditionaldoes not run on non-commit accumulators), a post-merge branch aftertri_merge_blockthat discards a callback update back tohpon one arm has itsarg == hparm skipped at line 9720 even when its predecessor ispost_merge_reachable, causingemit_rqto apply updates on lanes that discarded them.find_callback_accumulator_next: forInline(and for guarded defs / Case 1b inBlocks), requirecb_exec_within_entry, walkread_old_dst_inactiveontoworkso inactive/opaque lanes are proven to preservehp(or fail closed if unguarded whenst.reach[site.0]does not implyce). Also computepost_merge_reachablefromtri_merge_blockand reject anyloop_blocks \ cb_blocksPHI where apost_merge_reachablepredecessor drops the update back tohp.is_callback_only_user_accumulator(analyze.rs:4824-4837): ifst.guards[ds.0][ds.1].is_some(), walkread_old_dst_inactive(ds, di, v)ontowork; if unguarded, require!st.bools.meet(&[(st.reach[ds.0], true), (ce, false)]).3.
[P0]cb_val_routes_raw_bvh_ptronly inspectsv_mov_b32/v_cndmask_b32, allowing user accumulators to compute on fakek8/0/±1.0sentinelsanalyze.rs:4685-4746(cb_val_routes_raw_bvh_ptr),analyze.rs:6003-6014(validate_tri_merge_phi),emit_rq.rs:227-234,255-264.emit_rq.rsbindscb.cand_trisandcb.cand_inststo the fake sentinel constant8(k8),cb.cand_flagsto fake0, andcb.cand_inv_dto synthetic±1.0f32.cb_val_routes_raw_bvh_ptronly recurses into"v_mov_b32"and"v_cndmask_b32", ignoring all other VALU instructions (_ => {}at line 4740).v_or_b32 v41, cur_tri, 0,v_add_nc_u32 v41, cur_tri, 4,v_min_u32 v41, v41, cur_tri, or arithmetic oninv_d/cand_flagsinto a user accumulatorv41flowing through atri_merge_blockPHI,cb_val_routes_raw_bvh_ptrreturnsfalse,validate_tri_merge_phiaccepts it, andemit_rqemits valid DXIL computing on fake8/0/±1.0.cb_val_routes_raw_bvh_ptr, for anyFields::Valu(and scalarFields::Sop) instruction incb_block_set, push all explicit data reads (andold_dstif guarded) ontowork— stopping only atFields::Flatloads (which are already validated/replaced byattr_loads).inv_d(outsidecand_u/cand_v/front-face compare) orflags_vals_roots/cand_flags.v_add_nc_u32 v41, v36 (cur_tri), 4flowing through atri_merge_blockPHI.4.
[P0]val_has_explicit_readtreats cross-lane reads under guardug => egas dead on inactive!eglanesanalyze.rs:7628-7639(val_has_explicit_read); alsoanalyze.rs:4635-4645(read_old_dst_inactive).(db, di)ofv45under guardeg, lanes where!egstill holdstart(the loop header PHI value).(db, u.1 > di)under guardug(ug => eg) is a cross-lane read — e.g.v_mov_b32_dpp(or any VALU withdpp.is_some()),v_readlane_b32,v_readfirstlane_b32,v_permlane16_b32/v_permlanex16_b32,ds_swizzle_b32,ds_permute_b32,ds_bpermute_b32, orimage_sample*with implicit quad derivatives — activeuglanes observe inactive!eglanes'startvalue!val_has_explicit_readdoes not check thatuiis lane-local before settingread_dead_on_old_lanes = true, so it falsely returnsfalse("dead") and skips validating a live header PHI.read_old_dst_inactive(analyze.rs:4635-4645) does not stop onv_writelane_b32(which writes its target lane ignoringEXEC).val_has_explicit_read(analyze.rs:7629), requireuito be strictly lane-local (rejectFields::Valuwithdpp.is_some()or cross-lane/M0-indexed opsv_readlane_b32/v_readfirstlane_b32/v_permlane*/v_writelane_b32/v_movrel*/v_swaprel*, anyFields::Ds, and anyFields::Mimgwith implicit derivatives) before settingread_dead_on_old_lanes = true.read_old_dst_inactive, break ifpi.name() == "v_writelane_b32".5.
[P0]classify_live_outs+value_touches_cb_sites(pb != header) silently freezes non-invariant header PHIs read in callback at their pre-loop initanalyze.rs:9160-9210(classify_live_outs),analyze.rs:9520-9527(value_touches_cb_sites),emit_rq.rs:16-33.hpwithread_in_cb == truethat is NOT added toq.accumulatorsis bound byemit_rq.rs:16-33to its pre-loop entry value for everyProceed()call. That is ONLY sound ifhpis loop-invariant.value_touches_cb_sitesnow stops atpb != header(analyze.rs:9522), a 2-PHI callback shift-register (v41_next = v42_hdr,v42_next = v_add_nc_u32(v41_hdr, 1)inside callback, where onlyv41_hdris read inside the callback and neither is live-out) hasfind_callback_accumulator_next == NoneANDvalue_touches_cb_sites(v42_hdr) == false. Likewise, any header PHI mutated outside the callback (e.g. a traversal or opaque-hit counter) and read inside the callback to gate commit hasvalue_touches_cb_sites == false.q.accumulatorswithout erroring, freezinghpat its pre-loop initial value in DXIL!analyze.rs:9180-9210, wheneverread_in_cbistrueandfind_callback_accumulator_nextreturnsNone, requireis_invariant_header_phi(ir, st, hp, header, &back_edge_indices, loop_blocks)— otherwise fail closed withErr(...). (Pre-bound candidate PHIs such ascur_trialready haveread_in_cb == falsevia!cb_bound_vals.contains(ev)and will continue to lift.)[P1]Findings (Edge-Case Soundness Holes & Missing Guards/Tests)6.
[P1]is_iter_overflow_state_cndmaskchecksc0 >= thresholdinstead ofthreshold - c0 < 1024, andopaque_sets_state_zeropassesempty_cbanalyze.rs:7376,7400,7446(is_iter_overflow_state_cndmask);analyze.rs:3710-3724(opaque_sets_state_zero).threshold >= 1024andc0 < thresholdacceptsc0 = 65534, threshold = 65535(orc0 = 1023, threshold = 1024), which terminates after 1 iteration on GFX10 — dropping the clamp changes observable traversal results. Must requirethreshold.saturating_sub(c0) >= 1024(i.e., fail ifc0 > threshold.saturating_sub(1024)).opaque_sets_state_zero(analyze.rs:3710-3724) callsfeeds_latch_state_direct_or_iter_capwithempty_cbbeforeextract_callback_regionruns. Ifv_iteris mutated inside the callback whilev_stateis only written on opaque hits beforeni,is_iter_overflow_state_cndmasknever seescb_site_set. Re-verify with the realcb_site_setafterextract_callback_region.c0 = 65534, K = 65535.7.
[P1]Wave64 half-mask mismatch inis_non_opaque_mask/nonop_idxands_mov_b64high-dword word-0 bug incollapse_scalar_mov_phianalyze.rs:3596-3638(is_non_opaque_mask/nonop_idx);analyze.rs:4260-4264,4282-4286(collapse_scalar_mov_phi).is_non_opaque_mask/nonop_idxmatches"s_and_saveexec_b32" | "s_and_saveexec_b64"and"s_xor_b32" | "s_xor_b64"without checkingp.wave64or verifying that the high dword (src+1) in Wave64 matches the producer's high write (read_oponly checks the low dword). Fix: match_b64vs_b32byp.wave64and verify the Wave64 high-dword pair matches.collapse_scalar_mov_phimatches"s_mov_b64"and unconditionally callsread_op_word(si, &src[0], 0), which maps the high dword (dst+1) of ans_mov_b64to word 0 (the low source dword) instead of word 1. Sinceexec_chain_proves_neg_cmpalready bails onp.wave64, restrictcollapse_scalar_mov_phito"s_mov_b32"(or look up the matching write word index0/1).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T11:04:44Z.
Gate 2 Adversarial Audit — PR #432 (
5c16e97)Pure reasoning audit of
perf/w12a-hwrt-quant24-gpu(5c16e97) acrosscrates/victory-gpu/src/hwrt.rs,crates/victory-gpu/src/hwrt/decoders.rs, andcrates/victory-gpu/src/hwrt/sanitize.rs.Findings
1.
[P1]Unboundedvbytesinread_quant24_headerbypassesMAX_DECODE_READ_BYTESon the GPU pathcrates/victory-gpu/src/hwrt/decoders.rs:474-480, called atcrates/victory-gpu/src/hwrt.rs:2705-2712read_quant24_headerboundsstage_bytes = vcount * 12 <= MAX_DECODE_READ_BYTES(64 MiB, sovcount <= 5_592_405), but only checksusize::try_from(vbytes).is_err()forvbytes = (vcount - 1) * actual_stride + 8. It does not checkvbytes > MAX_DECODE_READ_BYTES as u64, contradicting both its own doc comment (decoders.rs:462-463) and the CPU fallback (decode_title_quant24_vb_with_header->with_scan_scratchatdecoders.rs:182,523).0x7FFC(32,764 B) and e.g.vcount = 10_000,stage_bytesis only 120 KiB (<= 64 MiB), soread_quant24_headerreturnsSome(hdr)withhdr.vbytes = 327_607_244(~312 MiB; up to ~170.6 GiB at maxvcount).hwrt.rs:2712immediately passes this unboundedhdr.vbytesintocrate::shadow::find(vertex_buffer, hdr.vbytes). Outside an existing registered buffer covering that span,shadow::findfalls back toloose_for->made_window, attempting to allocate and retain a multi-hundred-MiB (or multi-GiB) loose D3D12 shadow buffer / virtual mirror reservation and copy it onsh.refresh, whereas the pre-PR CPU path (and the CPU fallback) fail closed withNonefor anyvbytes > MAX_DECODE_READ_BYTES.crates/victory-gpu/src/hwrt/decoders.rs:478, enforce thevbytescap alongsidestage_bytes:read_quant24_header_validates_bounds_stride_and_finite_coefficientswith e.g.vcount = 10_000, stride = 0x7FFC(stage_bytes <= MAX_DECODE_READ_BYTESbutvbytes > MAX_DECODE_READ_BYTES) assertingNone.2.
[P1]Torn-read coherence split between record-time CPU header read and submission-time GPU shadow vertex readcrates/victory-gpu/src/hwrt.rs:2705-2739andcrates/victory-gpu/src/hwrt/sanitize.rs:430-441,484-513read_quant24_header(hwrt.rs:2705) snapshots the 32-byte quantization header (bias,scale,swizzle) from CPU title memory atvb_va - 0x20duringexecute_op(command-list recording /thinreplay time) and bakes those values into compute root constants (b1,hwrt.rs:1472-1485).[vb_va, vb_va + hdr.vbytes)is refreshed lazily viash.refresh(list, vertex_buffer, hdr.vbytes)(hwrt.rs:2729) atExecuteCommandListssubmission time and read fromsh.bufferwhen the GPU executesdecode_quant24_vb.[vb_va - 0x20, vb_va + vbytes)after recording the BLAS build and before submission — e.g.:CopyBufferRegioninto the quant24 VB in the same command list (list.defer_copy, which runs at submission time beforeStep::Refresh),ExecuteCommandLists(valid D3D12), orsh.buffer(Shadow::gpu_writes/VICTORY_WC_NO_BACK) —then
decode_quant24_vbdecodes the new packed vertices with the old (or all-zero on a fresh buffer, since0.0f32.is_finite()passes!)(bias, scale, swizzle)root constants, producing wrong axis swizzle, wrong scale/translation, or collapsed[0, 0, 0]geometry and corrupted BLAS bounds. Previously, the CPU decoder read header and vertices together at the same instant and could not mix mismatched generations.[vb_va - 0x20, vb_va + hdr.vbytes)to be covered by the shadow buffer inquant24_shadow_eligible(or fall back to CPU whenvb_va - 0x20 < sh_start), callsh.refresh(list, vertex_buffer - 0x20, hdr.vbytes + 0x20), and read the 7 header dwords (bias[0..3],swizzle,scale[0..3]) directly fromg_srcindecode_quant24_vb(athdr_biasrelative to(host_hdr & !15)).decode_quant24_vb, validate that all 6bias/scaledwords are finite ((bits & 0x7FFFFFFFu) < 0x7F800000u), emitting quiet NaN(0x7FC00000u, 0x7FC00000u, 0x7FC00000u)(DXR inactive primitive) if any header coefficient is non-finite. (This also shrinksRS_QUANT24from 10 root constants down to 4–5 dwords.)Non-blocking Hardening Note
quant24_shadow_eligible(crates/victory-gpu/src/hwrt/sanitize.rs:545-568) does not checkactual_stride >= 8(safe today becauseread_quant24_headerclamps.max(8), but addingactual_stride < 8makes the helper self-contained against future callers).Verified Clean Areas
Shadow::bufferstays implicitly promoted fromD3D12_RESOURCE_STATE_COMMON(decaying back toCOMMONafterHost::card_before's prelude command list), matchingcopy_vb/clamp_ib. Destinationworkleases start inUNORDERED_ACCESS, receive disjoint 16-byte-aligned bump slices per geometry and persanitize_chunksbatch, are transitionedUAV -> NON_PIXEL_SHADER_RESOURCEbeforeBuildRaytracingAccelerationStructureand backNON_PIXEL_SHADER_RESOURCE -> UAVafterflush_blas_waves(hwrt.rs:2082-2111), and are held onlistviaLeaseuntil post-fencelist.reset().ByteAddressBuffer::Load2(at)offsets are guaranteed 4-byte aligned (host_vb % 4 == 0,actual_stride % 4 == 0,q_src_bias = chunk_src & 15,chunk_src & !15 >= buffer_base_va). Unsigned 24/24/16 bit extraction (q0,q1,q2) is exact inf32and matchesdecoders.rs:430-435. Swizzle branches (0 -> (c,b,a),1 -> (b,c,a),_ -> (a,b,c)) match CPU. Unsigned bit-magnitude check(asuint(pos) & 0x7FFFFFFFu) > 0x501502F9ucatches|x| > 1e10,±Inf, and allNaNs without suffering from HLSLNaN > 1e10 == false, scrubbing to quiet NaN0x7FC00000u.RS_QUANT24(10scalar dwords atb1,SRV(t0),UAV(u0)) has zero cbuffer vector-padding drift and matchesquant24_root_paramsandSetComputeRoot*indices0/1/2.sanitize_chunkskeepsDispatch<= 65535groups,u32byte offsets in-bounds, andchunk_dst16-byte aligned. Fallback branches short-circuit cleanly before allocatingworkor setting*bound;*bound = truetriggersstate.replay(host)afterexecute_op.STATSlength (17) andreport_lineformatting match.hwrt.rs223,522 B,decoders.rs30,116 B,sanitize.rs29,824 B) and strictly title-neutral.VERDICT: NEEDS FIXES (0 P0, 2 P1)
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T11:22:04Z.
Gate 2 Pure-Reasoning Re-Audit — PR #432 (
8efed66)Pure-reasoning re-audit of
perf/w12a-hwrt-quant24-gpu(8efed66, fix commit5c16e97..8efed66, full diffdc55250..8efed66) acrosscrates/victory-gpu/src/hwrt.rs,crates/victory-gpu/src/hwrt/decoders.rs, andcrates/victory-gpu/src/hwrt/sanitize.rs.Prior
[P1]Findings Verification (comment7409603587)[P1]UnboundedvbytesbypassingMAX_DECODE_READ_BYTES— RESOLVEDquant24_bounds(decoders.rs:453-466) now enforcesvb_va >= 0x20,vcount > 0, checked arithmetic, andvbytes > MAX_DECODE_READ_BYTES as u64 || stage_bytes > MAX_DECODE_READ_BYTES, shared by both the GPU path (hwrt.rs:2700) and CPU fallback (read_quant24_header,decoders.rs:487).total_bytes = vbytes + 0x20passed tocrate::shadow::find(hwrt.rs:2707-2709) is strictly bounded to<= 64 MiB + 32 B, preventing multi-hundred-MiB/GiB loose window reservations on large strides.vbytes > MAX_DECODE_READ_BYTES(decoders.rs:782-783).[P1]Torn-read coherence between record-time CPU header and submission-time GPU vertices — RESOLVEDread_quant24_headerfrom the GPU path;decode_quant24_vb(sanitize.rs:480-519) reads the 32-byte header and packed vertices together from the same shadow SRV (g_src) at GPU execution time.hwrt.rs:2706-2738resolvescrate::shadow::find(hdr_va, total_bytes)and callssh.refresh(list, hdr_va, total_bytes)over the full[vb_va - 0x20, vb_va + vbytes)span, guarded byquant24_shadow_eligible.hwrt.rs:5509-5632).actual_stride < 8inquant24_shadow_eligible) was also addressed (sanitize.rs:553).Adversarial Verification of Fix Commit (
5c16e97..8efed66)vb_va < 0x20fails closed in bothquant24_boundsandquant24_shadow_eligible(vb_va.checked_sub(0x20)).host_hdris guarded byif hdr_va >= sh_start { sh.gpu(hdr_va) } else { 0 }(hwrt.rs:2712-2716) and validated forhost_hdr != 0, 4-byte alignment, and full[hdr_va, vb_va + vbytes) ⊆ [sh_start, sh_start + sh_len)coverage (sanitize.rs:548-568).hdr_base = host_hdr & !15(hwrt.rs:1468) is always 16-byte aligned and>= sh.buffer.GetGPUVirtualAddress()because all committed/placed D3D12 shadow buffers have 64 KiB-aligned base GPU VAs (includingShadow::placedviainplace.rs:122,130).ByteAddressBufferoffsets, chunking, and layout/endianness:hdr_bias = (host_hdr & 15) as u32∈{0, 4, 8, 12}(4-byte aligned).Load4(q_hdr_bias)reads[0..16)(bias[0..3]inh0.xyz,swizzleinh0.w) andLoad3(q_hdr_bias + 16u)reads[16..28)(scale[0..3]inh1.xyz), matchingread_quant24_header(decoders.rs:492-502) little-endian layout identically.sanitize_chunks(vcount, stride),SRV(t0)stays pinned athdr_basewhilevb_offset = hdr_bias + 0x20 + (u64::from(done).saturating_mul(stride) as u32)advances per chunk;vbytes <= MAX_DECODE_READ_BYTES(andquant24_shadow_eligible'svbytes <= u32::MAX - 0x30) prevents anyu32overflow invb_offsetorat = q_vb_offset + v * q_stride+ 8.chunk_dststays 16-byte aligned (doneis a multiple of 64 forstride <= 0x7FFC, sodone * 12is a multiple of 768).D3DCompileflags =0):uintloads directly ((h0.xyz & 0x7FFFFFFFu) >= 0x7F800000u || (h1 & 0x7FFFFFFFu) >= 0x7F800000u), catching±Infand allqNaN/sNaNvia unsigned integer comparisons immune to FXC fast-math, writing quiet NaN0x7FC00000u(DXR inactive primitive) for every vertex.madrange/finiteness scrubbing uses(asuint(pos) & 0x7FFFFFFFu) > 0x501502F9u(1e10f32), also pure integer bit comparison immune to fast-math.RS_QUANT24(RootConstants(num32BitConstants=4, b1), SRV(t0), UAV(u0)) andcbuffer Quant24Params(4uints:q_count,q_stride,q_hdr_bias,q_vb_offset, zero padding) matchquant24_root_params([u32; 4]) andSetComputeRoot32BitConstants(0, 4, ...)/SRV(1, hdr_base)/UAV(2, chunk_dst)(hwrt.rs:1473-1482).RSforclamp_ib/copy_vbis untouched.sh.bufferremains implicitly promoted fromCOMMONand pinned vialist.keep(&sh.buffer);workleases start inUNORDERED_ACCESS, transitionUAV -> NON_PIXEL_SHADER_RESOURCEbeforeBuildRaytracingAccelerationStructureand backNON_PIXEL_SHADER_RESOURCE -> UAVafterflush_blas_waves(hwrt.rs:2076-2105).has_vb_shadow = falseprevents out-of-boundseff_vcexpansion (hwrt.rs:2964) and redundantcopy_vb(hwrt.rs:3018);*bound = truetriggers state replay.decode_title_quant24_vb) sharesquant24_bounds, swizzle modes, bit unpacking, andsane_position.crates/victory-gpu/src/hwrt.rs: 229,594 B CRLF (raw 223,961 B)<= 655,360 Bcrates/victory-gpu/src/hwrt/decoders.rs: 30,822 B CRLF (raw 30,023 B)<= 655,360 Bcrates/victory-gpu/src/hwrt/sanitize.rs: 30,567 B CRLF (raw 29,706 B)<= 655,360 BVERDICT: VERIFIED CLEAN (0 P0, 0 P1)
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T11:59:51Z.
Gate 2 Pure-Reasoning Re-Audit — PR #431 (
c652351)Re-audited fix commit
81b07f8and clean mergec652351(zero conflict hunks againstorigin/main@8503d1d; PR diff touches onlyrayquery.rs,analyze.rs, andrayquery_tests.rs).<= 655,360 B): PASS —rayquery.rs29,866 B,analyze.rs421,799 B,rayquery_tests.rs329,874 B.Verification of Prior Findings (5
[P0]+ 2[P1])[P0] #1Inverted dynamic-opacitys_and_saveexec_b32/64&eval_pre_callback_lane_bit— RESOLVEDatom_forced_by(analyze.rs:3374-3412) performs exact memoized ROBDD satisfiability restriction for bothtarget_val = trueandfalse, returningSome(true)iffcond => targetandSome(false)iffcond => !target(soE0 & !Atom::Lane(lv)yieldsSome(false)).collect_bool_atoms(analyze.rs:7396-7450) checks bothceandst.reach[search_blk], rejects contradictory polarities, and propagatesResultfromeval_pre_callback_lane_bit.eval_pre_callback_lane_bit(analyze.rs:7657-7785) explicitly handlesv_cmp_{eq,ne}_u32onis_tri_opacity_val, rejects non-VALU / modified VALU ops, and fails closed (Err) on unproven pre-callbackAtom::Lanes.[P0] #2Opaque-lane mutations & post-merge discards infind_callback_accumulator_next/is_callback_only_user_accumulator— RESOLVEDcollect_opaque_preserved_vals+read_old_dst_inactive_val(analyze.rs:3539-3650) trace!celanes through guarded callback writes and Case 1b callback PHIs, failing closed onv_writelane_b32, unguarded writes reachable by!ce, orEXECmasks exceedingce.find_callback_accumulator_nextandis_callback_only_user_accumulatorverifycb_exec_within_entry_maskandopaque_lanes_preserve_hpfor Inline and Case 1b Blocks, andfind_callback_accumulator_nextusescompute_post_merge_reachableto reject post-merge branch discards back tohp.[P0] #3Raw BVH pointer / synthetic sentinel flow into user accumulators — RESOLVEDcb_val_routes_synthetic(analyze.rs:3721-3858) walks allFields::Valu,Fields::Sop, andFields::Dsexplicit non-mask reads and guardedold_dstinputs (stopping only atFields::Flatloads, lane masks, and real hardware attributescand_t/cand_u/cand_v/cand_ff), rejectingcur_tri/cur_inst/cand_flags/inv_d/committed_{tri,inst}_oldin bothvalidate_tri_merge_phiandfind_callback_accumulator_next(cb_acc_routes_synthetic_sentinel). Path-sensitive pruning viast.bools.meet_seenfails closed on step/constraint limits.[P0] #4Cross-lane reads inval_has_explicit_read&v_writelane_b32inread_old_dst_inactive— RESOLVEDis_lane_local_read_inst(analyze.rs:3416-3467) rejects DPP VALU,v_readlane_b32/v_readfirstlane_b32/v_writelane_b32/v_permlane*/v_movrel*/v_swaprel*, allFields::Ds,image_get_lod, implicit-derivativeimage_sample*, andimage_gather4*_bbefore allowingread_dead_on_old_lanesorread_unreachable_on_path.read_old_dst_inactive_valbreaks onpi.name() == v_writelane_b32.[P0] #5Non-invariant header PHIs read in callback silently frozen — RESOLVEDclassify_live_outs(analyze.rs:9739-9808) allows skippingaccumulatorsonly when!val_has_explicit_readoris_invariant_header_phi; otherwise verifies every back-edge either resolves to the same callback accumulatornext_valor is a non-post-merge back-edge preservinghp, failing closed withErrotherwise.[P1] #6is_iter_overflow_state_cndmaskboundary &opaque_sets_state_zero— RESOLVEDc0 <= threshold.saturating_sub(1024)(rejectingc0 = 65534, K = 65535).opaque_sets_state_zerocheck for callbacks moved aftercb_site_setconstruction (analyze.rs:4506-4524) and passes&cb_site_set. Covered by new negative unit tests.[P1] #7Wave64 half-mask checks &collapse_scalar_mov_phis_mov_b64— RESOLVEDis_non_opaque_mask/nonop_idx(analyze.rs:4022-4165) dispatch_b64vs_b32byp.wave64, verify both low and high dwords viaread_mask_pair/matches_mask_dst_pair/strip_mask_mov_pair, and require inline-1(Operand::Const(193)) for Wave64s_xor_b64(rejecting 32-bit zero-extended literals).collapse_scalar_mov_phirestricted tos_mov_b32. Covered bywave64_inverted_opacity_callback_entry_mask_matching.VERDICT: VERIFIED CLEAN (0 P0, 0 P1)
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T15:34:59Z.
Gate 2 Pure-Reasoning Audit — PR #434 (
e110687)Scope:
fix/high-vram-rt-buffer-caps(e110687, 2 files, +26 / -10) — pure-reasoning review ofgit diff origin/main...HEADand surrounding code inapps/victory/src/play.rs,crates/victory-gpu/src/hwrt/budget.rs,shadow.rs, andmemory.rs.Checklist
low_vrampath untouched: PASS —LOW_VRAM_THRESHOLD_MB(9216), the entireif low_vram { ... }block inplay.rs:443-485(VICTORY_CARD_BUFFERS_MB=320/512/1024,VICTORY_RT_MEMORY_MB=768,VICTORY_BVH_FAULTS_ALL=8192), andBLAS_BUDGET_DEFAULT_LOW(512 MiB) /MID(768 MiB) inbudget.rsare 100% untouched.9216 < vram_mb <= 13 * 1024): PASS —play.rs:491-498leavesVICTORY_CARD_BUFFERS_MBunset (delegating toshadow.rs::resolve_card_limits()) while preservingVICTORY_RT_MEMORY_MB=1024andVICTORY_BVH_FAULTS_ALL=8192. Covered byhw_rt_without_bvh_builder_applies_rt_vram_caps_and_honors_overridesatSome(12288).>= 14 GiBhigh-VRAM path &vram_mb: Noneedge case: PASS — ForSome(mb)withmb > 13312(16/24/32 GB cards) and forvram_mb: None, bothlow_vramandvram_mb.is_some_and(|mb| mb <= 13 * 1024)evaluate tofalse, leavingVICTORY_CARD_BUFFERS_MB,VICTORY_RT_MEMORY_MB, andVICTORY_BVH_FAULTS_ALLunset so runtime DXGI-scaled defaults apply (with conservative fallbacks inshadow.rs/budget.rsif DXGI is also unavailable). Explicit--setoverrides still win on both low- and high-VRAM paths.BLAS_BUDGET_DEFAULT_HIGH = 1536 << 20: PASS —1536 MiB(~10–12% of a 13–16 GiB effective budget, evicting down to 90% /1382 MiB) is safe on 13–16 GiB cards while keeping 12 GiB cards inMID(768 MiB). Doc comment (budget.rs:169) and unit tests (budget.rs:1288-1289, 1325) match.apps/victory/src/play.rsis80,071 BCRLF andcrates/victory-gpu/src/hwrt/budget.rsis64,251 BCRLF (both well under655,360 B). Diff is 100% title-neutral.VERDICT: VERIFIED CLEAN (0 P0, 0 P1)