[Architecture] Native Hardware Ray Tracing (DXR 1.1 RayQuery + BVH Optimization) #339

Open
opened 2026-12-02 13:38:30 +00:00 by Androtim · 19 comments
Androtim commented 2026-12-02 13:38:30 +00:00 (Migrated from github.com)
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T13:38:30Z.


Goal

Bring MiniVI's ray-tracing path from software-emulated BVH (~3.5 fps) to fast, playable RT across NVIDIA RTX, AMD RDNA, and Intel GPUs — developed in small, isolated PRs gated behind VICTORY_HW_RT=1 (off by default until verified) so the RT-off track in #276 never regresses.

Staged Roadmap

Phase 1 — Software BVH & AMD Fast Wins

  • Dynamic BVH sync: Fix dynamic BVH compacted-size readback overlaps (docs/fork-ray-tracing.md) without adding a 20 ms frame stall.
  • Unified BVH arena & traversal opts: Coalesce global_load and optimize DXIL BVH traversal + unified BVH arena pool (GPL-3.0 reference: ReTerryDavis/ReVIctory commit 925ac0a).
  • AMD native BVH node-test: Support AMD hardware BVH node-test path (VICTORY_BVH_HARDWARE) on RDNA 2/3/4 GPUs (GPL-3.0 reference: lobomfz/VIctory-xmem).
  • BVH VRAM budget: Coordinate VICTORY_MEMORY_CARD_MB with MiniVI's sparse VRAM pool so 8–12 GB GPUs avoid shared-memory thrash.

Phase 2 — Native DXR 1.1 Acceleration Structures (VICTORY_HW_RT=1)

  • Add HLE builder interposer (xboxbvh.rs) and host DXR 1.1 BLAS/TLAS registry (hwrt.rs) keyed by console GPU VA.
  • Gate on D3D12_RAYTRACING_TIER_1_1 and Shader Model 6.5/6.6 with graceful fallback when unsupported.
  • Add GPU compute pass to remap D3D12_RAYTRACING_INSTANCE_DESC::AccelerationStructure pointers from console VAs to host BLAS GPU VAs.
  • GPL-3.0 references (study, adapt cleanly to MiniVI's residency/descriptor model, attribute in commits): TrustNo1-Coder/Darner (Codeberg: hwrt.rs, xboxbvh.rs) and readmet3xt-lab/foxhound (hwrt.rs, xboxbvh.rs).

Phase 3 — Native SM 6.6 RayQuery Shader Lifting (VICTORY_HW_RT=1)

  • Add DXIL inline RayQuery emitter (emit/rayquery.rs: AllocateRayQuery, TraceRayInline, Proceed, CommittedStatus, CommittedRayT, instance/geometry/primitive accessors) with unit + DXIL validator tests.
  • Add traversal-loop lifter recognizing both console BVH templates (image_bvh64_intersect_ray and image_bvh_intersect_ray), including inlined non-opaque candidate callbacks, with automatic fallback to software BVH for unmatched loops.
  • Translate the remaining 5 shadow-mask trace programs (descriptor-slot address table).
  • GPL-3.0 references: TrustNo1-Coder/Darner (Codeberg: emit/rayquery.rs) and readmet3xt-lab/foxhound (emit/rayquery.rs).

Coordination & Guardrails

  • All work lands via small, reviewable PRs on feat/hw-rt-* branches (VICTORY_HW_RT=1 off by default while incubating) so merge conflicts with #276 stay minimal.
  • Keep 100% clean-room / title-neutral wording in all code, docs, commits, and PRs.
  • Use cargo test and DXIL validation for offline verification; never run concurrent live GPU sessions alongside the main core track.
<!-- greyfinch-sync:Androtim/MiniVI:issue:6746098754 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T13:38:30Z. --- ## Goal Bring MiniVI's ray-tracing path from software-emulated BVH (~3.5 fps) to fast, playable RT across NVIDIA RTX, AMD RDNA, and Intel GPUs — developed in small, isolated PRs gated behind `VICTORY_HW_RT=1` (off by default until verified) so the RT-off track in #276 never regresses. ## Staged Roadmap ### Phase 1 — Software BVH & AMD Fast Wins - **Dynamic BVH sync:** Fix dynamic BVH compacted-size readback overlaps (`docs/fork-ray-tracing.md`) without adding a 20 ms frame stall. - **Unified BVH arena & traversal opts:** Coalesce `global_load` and optimize DXIL BVH traversal + unified BVH arena pool (GPL-3.0 reference: `ReTerryDavis/ReVIctory` commit `925ac0a`). - **AMD native BVH node-test:** Support AMD hardware BVH node-test path (`VICTORY_BVH_HARDWARE`) on RDNA 2/3/4 GPUs (GPL-3.0 reference: `lobomfz/VIctory-xmem`). - **BVH VRAM budget:** Coordinate `VICTORY_MEMORY_CARD_MB` with MiniVI's sparse VRAM pool so 8–12 GB GPUs avoid shared-memory thrash. ### Phase 2 — Native DXR 1.1 Acceleration Structures (`VICTORY_HW_RT=1`) - Add HLE builder interposer (`xboxbvh.rs`) and host DXR 1.1 BLAS/TLAS registry (`hwrt.rs`) keyed by console GPU VA. - Gate on `D3D12_RAYTRACING_TIER_1_1` and Shader Model 6.5/6.6 with graceful fallback when unsupported. - Add GPU compute pass to remap `D3D12_RAYTRACING_INSTANCE_DESC::AccelerationStructure` pointers from console VAs to host BLAS GPU VAs. - GPL-3.0 references (study, adapt cleanly to MiniVI's residency/descriptor model, attribute in commits): `TrustNo1-Coder/Darner` (Codeberg: `hwrt.rs`, `xboxbvh.rs`) and `readmet3xt-lab/foxhound` (`hwrt.rs`, `xboxbvh.rs`). ### Phase 3 — Native SM 6.6 `RayQuery` Shader Lifting (`VICTORY_HW_RT=1`) - Add DXIL inline `RayQuery` emitter (`emit/rayquery.rs`: `AllocateRayQuery`, `TraceRayInline`, `Proceed`, `CommittedStatus`, `CommittedRayT`, instance/geometry/primitive accessors) with unit + DXIL validator tests. - Add traversal-loop lifter recognizing both console BVH templates (`image_bvh64_intersect_ray` and `image_bvh_intersect_ray`), including inlined non-opaque candidate callbacks, with automatic fallback to software BVH for unmatched loops. - Translate the remaining 5 shadow-mask trace programs (descriptor-slot address table). - GPL-3.0 references: `TrustNo1-Coder/Darner` (Codeberg: `emit/rayquery.rs`) and `readmet3xt-lab/foxhound` (`emit/rayquery.rs`). ## Coordination & Guardrails - All work lands via small, reviewable PRs on `feat/hw-rt-*` branches (`VICTORY_HW_RT=1` off by default while incubating) so merge conflicts with #276 stay minimal. - Keep 100% clean-room / title-neutral wording in all code, docs, commits, and PRs. - Use `cargo test` and DXIL validation for offline verification; never run concurrent live GPU sessions alongside the main core track.
Androtim commented 2026-12-02 13:50:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T13:50:26Z.


Phased Implementation & PR Breakdown

Baseline state inspected on main: SLOT_VIEW_ADDRESSES (251) and USER_VIEW_ADDRESS (0x101) are already wired, VICTORY_RT_MEMORY_MB / VICTORY_MEMORY_CARD_MB exist independently, and VICTORY_MEMORY_NEAR caches dominating page lookups. The following clean, isolated PR sequence implements the three phases cleanly (all DXR 1.1 changes strictly gated behind VICTORY_HW_RT=1, off by default):

Phase 1 — Software BVH & Memory Wins

  1. PR #1 (feat/hw-rt-phase1-shader-bvh-opt) — DXIL BVH Traversal & global_load_* Coalescing (pure victory-shader, zero RT-off runtime impact):
    • Gate bvh_memory inside both the lane guard and kind < 6 so inactive lanes and kind 6/7 misses never touch SLOT_MEMORY / SLOT_FAULTS or widen descriptor waterfalls.
    • Coalesce the first 64 bytes (16 dwords, align = 16) into a single fetch for kind < 6 before diverging on box vs triangle, and extract triangle vertices in registers (first_all[0..15] + first_all[15]) instead of issuing dependent loads.
    • Evaluate AABBs sequentially (bvh_test_box) and before loading the second 64 bytes of 32-bit box nodes to reduce live VGPRs and PHIs across join.
    • Wrap unguarded single global_load_* on MEMORY in begin_guarded, coalesce consecutive same-base/same-guard global_load_* runs within 256 bytes (try_global_load_cluster), use wave-uniform heap handles for s_load_dword* (memory_smem), and replace URem with power-of-2 bitmask + select for SLOT_FAULTS hashing (GPL-3.0 ref: ReTerryDavis/ReVIctory commit 925ac0a).
  2. PR #2 (feat/hw-rt-phase1-arena-pool) — Unified BVH Arena Pool & VRAM Budget Coordination (behind VICTORY_BVH_ONE_ARENA, victory-gpu):
    • Map BVH arena chunks into a shared 2 GiB reserved raw-UAV buffer (ArenaPool, map_buffer_tiles) to collapse non-uniform BVH waterfalls into one descriptor slot, reuse a 64 KiB scratch buffer, skip GetWriteWatch on cold static chunks, and move full SLOT_FAULTS to a GPU-local sink (GPL-3.0 ref: ReTerryDavis/ReVIctory 925ac0a).
    • Coordinate VICTORY_RT_MEMORY_MB / VICTORY_MEMORY_CARD_MB against pool.rs / residency.rs budgets to avoid shared-memory thrash on 8–12 GB GPUs.
  3. PR #3 (feat/hw-rt-phase1-bvh-sync) — Dynamic BVH SIZES Readback Sync & AMD VICTORY_BVH_HARDWARE Feasibility:
    • Fix dynamic BVH compacted-size readback races (asks_size / copyback) without a 20 ms frame stall.
    • Audit lobomfz/VIctory-xmem (VICTORY_BVH_HARDWARE): determine whether any portable optimizations apply cleanly on D3D12 (note custom opcode 0x5642_4836 requires a patched Mesa RADV shader compiler on Linux and cannot pass D3D12/DXIL validation on standard Windows drivers, making Phase 2/3 DXR 1.1 RayQuery the portable HW-RT path on RDNA 2/3/4, RTX, and Intel).

Phase 2 — Native DXR 1.1 Acceleration Structures (VICTORY_HW_RT=1)

  1. PR #4 (feat/hw-rt-phase2-registry-hle) — HLE xboxbvh Interposer & Core DXR 1.1 BLAS/TLAS Registry:
    • Add crates/victory-hle/src/modules/xboxbvh.rs (clean-room GPL-3.0 adaptation from TrustNo1-Coder/Darner & readmet3xt-lab/foxhound) and crates/victory-gpu/src/hwrt.rs gated on VICTORY_HW_RT=1, D3D12_RAYTRACING_TIER_1_1, and SM 6.5/6.6.
    • Key host BLAS/TLAS allocations by console GPU VA with safe lifecycle eviction, index-buffer clamp sanitizer compute pass, and GPU compute remapping of D3D12_RAYTRACING_INSTANCE_DESC::AccelerationStructure addresses.
  2. PR #5 (feat/hw-rt-phase2-mesh-decoders) — Console BVH Geometry Decoders & Telemetry:
    • Add compute/host decoding for console compact meshlet index/quantized vertex formats (IndexFormat == 53, VertexFormat == 16), readable-memory fallbacks, shader-cache key wiring, and F1 overlay status.

Phase 3 — Native SM 6.6 RayQuery Shader Lifting (VICTORY_HW_RT=1)

  1. PR #6 (feat/hw-rt-phase3-dxil-rayquery) — emit/rayquery.rs DXIL Intrinsics & Validator Tests:
    • Emit DXIL AllocateRayQuery, TraceRayInline, Proceed, CommittedStatus, CommittedRayT, and candidate/committed instance/geometry/primitive accessors + SFI0 RAYTRACING_TIER_1_1 flag, with unit and dxil.dll validation tests.
  2. PR #7 (feat/hw-rt-phase3-traversal-lifter) — Traversal-Loop Lifter, Candidate Callbacks & Shadow-Mask Check:
    • Lift both console BVH loop templates (image_bvh64_intersect_ray and image_bvh_intersect_ray), including inlined non-opaque candidate loops and descriptor-slot TLAS binding (SLOT_TLAS_BASE), with automatic fallback to software BVH for unmatched loops.
    • Verify translation and validation of all remaining shadow-mask trace programs via SLOT_VIEW_ADDRESSES (251) and DXR 1.1 lifting.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7347544757 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7347544757). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T13:50:26Z. --- ### Phased Implementation & PR Breakdown Baseline state inspected on `main`: `SLOT_VIEW_ADDRESSES` (`251`) and `USER_VIEW_ADDRESS` (`0x101`) are already wired, `VICTORY_RT_MEMORY_MB` / `VICTORY_MEMORY_CARD_MB` exist independently, and `VICTORY_MEMORY_NEAR` caches dominating page lookups. The following clean, isolated PR sequence implements the three phases cleanly (all DXR 1.1 changes strictly gated behind `VICTORY_HW_RT=1`, off by default): #### Phase 1 — Software BVH & Memory Wins 1. **PR #1 (`feat/hw-rt-phase1-shader-bvh-opt`) — DXIL BVH Traversal & `global_load_*` Coalescing** *(pure `victory-shader`, zero RT-off runtime impact)*: - Gate `bvh_memory` inside both the lane guard and `kind < 6` so inactive lanes and kind `6/7` misses never touch `SLOT_MEMORY` / `SLOT_FAULTS` or widen descriptor waterfalls. - Coalesce the first 64 bytes (`16` dwords, `align = 16`) into a single fetch for `kind < 6` before diverging on box vs triangle, and extract triangle vertices in registers (`first_all[0..15]` + `first_all[15]`) instead of issuing dependent loads. - Evaluate AABBs sequentially (`bvh_test_box`) and before loading the second 64 bytes of 32-bit box nodes to reduce live VGPRs and PHIs across `join`. - Wrap unguarded single `global_load_*` on `MEMORY` in `begin_guarded`, coalesce consecutive same-base/same-guard `global_load_*` runs within 256 bytes (`try_global_load_cluster`), use wave-uniform heap handles for `s_load_dword*` (`memory_smem`), and replace `URem` with power-of-2 bitmask + select for `SLOT_FAULTS` hashing (GPL-3.0 ref: `ReTerryDavis/ReVIctory` commit `925ac0a`). 2. **PR #2 (`feat/hw-rt-phase1-arena-pool`) — Unified BVH Arena Pool & VRAM Budget Coordination** *(behind `VICTORY_BVH_ONE_ARENA`, `victory-gpu`)*: - Map BVH arena chunks into a shared 2 GiB reserved raw-UAV buffer (`ArenaPool`, `map_buffer_tiles`) to collapse non-uniform BVH waterfalls into one descriptor slot, reuse a 64 KiB scratch buffer, skip `GetWriteWatch` on cold static chunks, and move full `SLOT_FAULTS` to a GPU-local sink (GPL-3.0 ref: `ReTerryDavis/ReVIctory` `925ac0a`). - Coordinate `VICTORY_RT_MEMORY_MB` / `VICTORY_MEMORY_CARD_MB` against `pool.rs` / `residency.rs` budgets to avoid shared-memory thrash on 8–12 GB GPUs. 3. **PR #3 (`feat/hw-rt-phase1-bvh-sync`) — Dynamic BVH `SIZES` Readback Sync & AMD `VICTORY_BVH_HARDWARE` Feasibility**: - Fix dynamic BVH compacted-size readback races (`asks_size` / `copyback`) without a 20 ms frame stall. - Audit `lobomfz/VIctory-xmem` (`VICTORY_BVH_HARDWARE`): determine whether any portable optimizations apply cleanly on D3D12 (note custom opcode `0x5642_4836` requires a patched Mesa RADV shader compiler on Linux and cannot pass D3D12/DXIL validation on standard Windows drivers, making Phase 2/3 DXR 1.1 `RayQuery` the portable HW-RT path on RDNA 2/3/4, RTX, and Intel). #### Phase 2 — Native DXR 1.1 Acceleration Structures (`VICTORY_HW_RT=1`) 4. **PR #4 (`feat/hw-rt-phase2-registry-hle`) — HLE `xboxbvh` Interposer & Core DXR 1.1 BLAS/TLAS Registry**: - Add `crates/victory-hle/src/modules/xboxbvh.rs` (clean-room GPL-3.0 adaptation from `TrustNo1-Coder/Darner` & `readmet3xt-lab/foxhound`) and `crates/victory-gpu/src/hwrt.rs` gated on `VICTORY_HW_RT=1`, `D3D12_RAYTRACING_TIER_1_1`, and SM 6.5/6.6. - Key host BLAS/TLAS allocations by console GPU VA with safe lifecycle eviction, index-buffer clamp sanitizer compute pass, and GPU compute remapping of `D3D12_RAYTRACING_INSTANCE_DESC::AccelerationStructure` addresses. 5. **PR #5 (`feat/hw-rt-phase2-mesh-decoders`) — Console BVH Geometry Decoders & Telemetry**: - Add compute/host decoding for console compact meshlet index/quantized vertex formats (`IndexFormat == 53`, `VertexFormat == 16`), readable-memory fallbacks, shader-cache key wiring, and `F1` overlay status. #### Phase 3 — Native SM 6.6 `RayQuery` Shader Lifting (`VICTORY_HW_RT=1`) 6. **PR #6 (`feat/hw-rt-phase3-dxil-rayquery`) — `emit/rayquery.rs` DXIL Intrinsics & Validator Tests**: - Emit DXIL `AllocateRayQuery`, `TraceRayInline`, `Proceed`, `CommittedStatus`, `CommittedRayT`, and candidate/committed instance/geometry/primitive accessors + `SFI0` `RAYTRACING_TIER_1_1` flag, with unit and `dxil.dll` validation tests. 7. **PR #7 (`feat/hw-rt-phase3-traversal-lifter`) — Traversal-Loop Lifter, Candidate Callbacks & Shadow-Mask Check**: - Lift both console BVH loop templates (`image_bvh64_intersect_ray` and `image_bvh_intersect_ray`), including inlined non-opaque candidate loops and descriptor-slot TLAS binding (`SLOT_TLAS_BASE`), with automatic fallback to software BVH for unmatched loops. - Verify translation and validation of all remaining shadow-mask trace programs via `SLOT_VIEW_ADDRESSES` (`251`) and DXR 1.1 lifting.
Androtim commented 2026-12-02 14:05:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:05:24Z.


Opened PR #1 (#341, \ eat/hw-rt-phase1-shader-bvh-opt): coalesced 64-byte BVH fetch, register-extracted triangles, sequential low-VGPR \vh_test_box, guarded/coalesced \global_load_*\ clusters, wave-uniform \smem\ heap handles, and bitmask \SLOT_FAULTS\ hashing. Starting Phase 1b (#2: unified BVH arena pool & VRAM budget coordination).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7347969686 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7347969686). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T14:05:24Z. --- Opened PR #1 (#341, \ eat/hw-rt-phase1-shader-bvh-opt\): coalesced 64-byte BVH fetch, register-extracted triangles, sequential low-VGPR \vh_test_box\, guarded/coalesced \global_load_*\ clusters, wave-uniform \smem\ heap handles, and bitmask \SLOT_FAULTS\ hashing. Starting Phase 1b (#2: unified BVH arena pool & VRAM budget coordination).
Androtim commented 2026-12-02 14:20:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:20:22Z.


Opened PR #2 (following #341 CI pass) on \ eat/hw-rt-phase1-arena-pool: unified reserved BVH arena pool (\VICTORY_BVH_ONE_ARENA), \Shadow::card_offset()\ propagation, cold static chunk \GetWriteWatch\ skip, \ring_buf, and aligned 8-12 GiB VRAM ceilings (\VICTORY_MEMORY_CARD_MB\ / \VICTORY_RT_MEMORY_MB\ / \card_room_for). Starting Phase 1c (PR #3: dynamic BVH \SIZES\ sync & AMD \VICTORY_BVH_HARDWARE\ audit).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7348379049 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7348379049). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T14:20:22Z. --- Opened PR #2 (following #341 CI pass) on \ eat/hw-rt-phase1-arena-pool\: unified reserved BVH arena pool (\VICTORY_BVH_ONE_ARENA\), \Shadow::card_offset()\ propagation, cold static chunk \GetWriteWatch\ skip, \ring_buf\, and aligned 8-12 GiB VRAM ceilings (\VICTORY_MEMORY_CARD_MB\ / \VICTORY_RT_MEMORY_MB\ / \card_room_for\). Starting Phase 1c (PR #3: dynamic BVH \SIZES\ sync & AMD \VICTORY_BVH_HARDWARE\ audit).
Androtim commented 2026-12-02 14:37:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:37:16Z.


Phase 1 Complete (PRs #341, #342, #343)

All Phase 1 items are implemented in small, focused PRs off \main:

  • PR #341 (CI green): DXIL BVH traversal + \global_load_*\ coalescing (\ReVIctory\ ref \925ac0a).
  • PR #342 (CI re-running after test fix): Unified 2 GiB reserved BVH arena pool (\VICTORY_BVH_ONE_ARENA) + VRAM budget coordination (\VICTORY_MEMORY_CARD_MB\ / \VICTORY_RT_MEMORY_MB\ with 85%/90%/97% tier headroom).
  • PR #343: Targeted frame-boundary BVH compacted-size sync (\VICTORY_BVH_SIZES_SYNC) replacing mid-frame full-pipeline stalls with targeted \FINISHED >= flight_number\ landing at \Present, plus \Quiet\ wake for queried size buffers.
  • \lobomfz/VIctory-xmem\ (\VICTORY_BVH_HARDWARE) audit: Verified that \xmem's \OP_BVH64_INTERSECT_RAY\ (\
<!-- greyfinch-sync:Androtim/MiniVI:comment:7348855550 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7348855550). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T14:37:16Z. --- ### Phase 1 Complete (PRs #341, #342, #343) All Phase 1 items are implemented in small, focused PRs off \main\: - **PR #341 (CI green):** DXIL BVH traversal + \global_load_*\ coalescing (\ReVIctory\ ref \925ac0a\). - **PR #342 (CI re-running after test fix):** Unified 2 GiB reserved BVH arena pool (\VICTORY_BVH_ONE_ARENA\) + VRAM budget coordination (\VICTORY_MEMORY_CARD_MB\ / \VICTORY_RT_MEMORY_MB\ with 85%/90%/97% tier headroom). - **PR #343:** Targeted frame-boundary BVH compacted-size sync (\VICTORY_BVH_SIZES_SYNC\) replacing mid-frame full-pipeline stalls with targeted \FINISHED >= flight_number\ landing at \Present\, plus \Quiet\ wake for queried size buffers. - **\lobomfz/VIctory-xmem\ (\VICTORY_BVH_HARDWARE\) audit:** Verified that \xmem\'s \OP_BVH64_INTERSECT_RAY\ (\
Androtim commented 2026-12-02 14:59:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:59:39Z.


Pre-Merge Audit Fixes Required (#282 comment 7349410307)

The read-only static audit found confirmed P0/P1 issues in open Phase 1 PRs (#341, #342, #343). PR check and merges has been asked to hold these until fixed:

  • PR #341 (P1 — #282 finding #16): memory_smem (crates/victory-shader/src/emit/lower.rs:4453) hardcodes NonUniformIndex = false on SLOT_MEMORY heap handles, which can mis-broadcast lane 0's arena when SGPRs diverge via waterfall v_readfirstlane_b32 or divergent SGPR PHIs. Keep nonuniform = true unless proven wave-uniform.
  • PR #342 (P0 — #282 findings #13 & #14):
    • by_address_in / map_buffer_tiles: allocate shared_buffer_staging(len) before map_buffer_tiles, and on any error after UpdateTileMappings, unmap tiles (D3D12_TILE_RANGE_FLAG_NULL) and retire heap via host::retire instead of dropping it synchronously.
    • Memory::bring_up: replace the DIRTY_WINDOW = 8 / free_pages > 0 heuristic with per-chunk (dirty_epoch, refreshed_epoch) tracking and ensure submit-time m.land(at) triggers shadow.refresh() on every touched/allocated chunk.
  • PR #343 (P1 — #282 finding #17):
    • has_pending_sizes: SIZES_SEEN + THIN_DONE < THIN_QUEUED causes permanent per-frame behind::drain() stalls and has a SIZES_QUEUED/THIN_DONE load-order race. Track has_sizes per Recording directly instead.
    • Quiet::wake (quiet.rs:90-91): always lock self.state and reset streak = 0 even when self.ready is false.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7349508986 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7349508986). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T14:59:39Z. --- ### Pre-Merge Audit Fixes Required (#282 comment `7349410307`) The read-only static audit found confirmed P0/P1 issues in open Phase 1 PRs (`#341`, `#342`, `#343`). `PR check and merges` has been asked to hold these until fixed: - **PR `#341` (P1 — `#282` finding #16):** `memory_smem` (`crates/victory-shader/src/emit/lower.rs:4453`) hardcodes `NonUniformIndex = false` on `SLOT_MEMORY` heap handles, which can mis-broadcast lane 0's arena when SGPRs diverge via waterfall `v_readfirstlane_b32` or divergent SGPR PHIs. Keep `nonuniform = true` unless proven wave-uniform. - **PR `#342` (P0 — `#282` findings #13 & #14):** - `by_address_in` / `map_buffer_tiles`: allocate `shared_buffer_staging(len)` *before* `map_buffer_tiles`, and on any error after `UpdateTileMappings`, unmap tiles (`D3D12_TILE_RANGE_FLAG_NULL`) and retire `heap` via `host::retire` instead of dropping it synchronously. - `Memory::bring_up`: replace the `DIRTY_WINDOW = 8` / `free_pages > 0` heuristic with per-chunk `(dirty_epoch, refreshed_epoch)` tracking and ensure submit-time `m.land(at)` triggers `shadow.refresh()` on every touched/allocated chunk. - **PR `#343` (P1 — `#282` finding #17):** - `has_pending_sizes`: `SIZES_SEEN` + `THIN_DONE < THIN_QUEUED` causes permanent per-frame `behind::drain()` stalls and has a `SIZES_QUEUED`/`THIN_DONE` load-order race. Track `has_sizes` per `Recording` directly instead. - `Quiet::wake` (`quiet.rs:90-91`): always lock `self.state` and reset `streak = 0` even when `self.ready` is `false`.
Androtim commented 2026-12-02 15:02:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T15:02:03Z.


Phase 2 PRs are open (both gated behind \VICTORY_HW_RT=1, off by default with zero RT-off impact):

  • PR #347 (\ eat/hw-rt-phase2-registry-hle): Native DXR 1.1 BLAS/TLAS registry, scratch/work lease pools, per-frame BLAS build budget/backlog, LRU eviction with GPU feedback readback, HLSL IB/VB sanitization + instance-VA remapping, \D3D12_RAYTRACING_TIER_1_1\ + SM >= 6.5 gate, and 12-export \XboxBvhBuilder.dll\ HLE module — CI green.
  • PR #349 (\ eat/hw-rt-phase2-mesh-decoders): Console meshlet IB decoder (\IndexFormat == 53) + 256 MiB LRU \MeshletCache, 24-24-16 quantized VB decoder (\VertexFormat == 16), \ alidated_ibs\ hints, shader-cache key isolation, F1 menu toggle, and 5s telemetry.

Starting Phase 3 (Native SM 6.6 DXR 1.1 \RayQuery\ Shader Lifting) next:

  • PR #6 (\ eat/hw-rt-phase3-dxil-rayquery): \ ictory-shader/src/emit/rayquery.rs\ DXIL intrinsic emitter (\AllocateRayQuery, \TraceRayInline, \Proceed, \CommittedStatus, \CommittedRayT, instance/geometry/primitive accessors, \SFI0\ tier 1.1 flag) + \dxil.dll\ validation tests.
  • PR #7 (\ eat/hw-rt-phase3-traversal-lifter): Traversal-loop lifter (\image_bvh64_intersect_ray\ & \image_bvh_intersect_ray), non-opaque candidate callbacks, automatic software-BVH fallback, \SLOT_TLAS_BASE\ descriptor binding, and translation of the remaining 5 shadow-mask trace programs.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7349588121 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7349588121). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T15:02:03Z. --- Phase 2 PRs are open (both gated behind \VICTORY_HW_RT=1\, off by default with zero RT-off impact): - **PR #347** (\ eat/hw-rt-phase2-registry-hle\): Native DXR 1.1 BLAS/TLAS registry, scratch/work lease pools, per-frame BLAS build budget/backlog, LRU eviction with GPU feedback readback, HLSL IB/VB sanitization + instance-VA remapping, \D3D12_RAYTRACING_TIER_1_1\ + SM >= 6.5 gate, and 12-export \XboxBvhBuilder.dll\ HLE module — **CI green**. - **PR #349** (\ eat/hw-rt-phase2-mesh-decoders\): Console meshlet IB decoder (\IndexFormat == 53\) + 256 MiB LRU \MeshletCache\, 24-24-16 quantized VB decoder (\VertexFormat == 16\), \ alidated_ibs\ hints, shader-cache key isolation, F1 menu toggle, and 5s telemetry. Starting **Phase 3 (Native SM 6.6 DXR 1.1 \RayQuery\ Shader Lifting)** next: - PR #6 (\ eat/hw-rt-phase3-dxil-rayquery\): \ ictory-shader/src/emit/rayquery.rs\ DXIL intrinsic emitter (\AllocateRayQuery\, \TraceRayInline\, \Proceed\, \CommittedStatus\, \CommittedRayT\, instance/geometry/primitive accessors, \SFI0\ tier 1.1 flag) + \dxil.dll\ validation tests. - PR #7 (\ eat/hw-rt-phase3-traversal-lifter\): Traversal-loop lifter (\image_bvh64_intersect_ray\ & \image_bvh_intersect_ray\), non-opaque candidate callbacks, automatic software-BVH fallback, \SLOT_TLAS_BASE\ descriptor binding, and translation of the remaining 5 shadow-mask trace programs.
Androtim commented 2026-12-02 16:39:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T16:39:19Z.


Phase 1 Audit Fixes & Phase 3 Completion Update (#339)

Phase 1 — Audit Fixes & Rebases (#282 comment 7349410307)

  • PR #341 (feat/hw-rt-phase1-shader-bvh-opt, 3bf8fad): Rebased onto main (3efe907, resolving the lower_tests.rs conflict) and resolved #282 finding #16 via uniform_scalars host-wave uniformity analysis (NonUniformIndex = true whenever an address word or soffset may derive from waterfall.reads, waterfall.loads, v_readfirstlane_b32, divergent Atom::Uniform branches, or divergent/loop-carried SGPR PHIs), with smem_memory_load_divergent_sgpr_keeps_nonuniform_handle test coverage. Local emit::lower::tests (27 passed; 0 failed; 1 ignored), emit::intersect_tests (11 passed; 0 failed), workspace clippy, xtask policy, and CI (46924759840) are green (MERGEABLE).
  • PR #342 (feat/hw-rt-phase1-arena-pool, f204e9c): Rebased onto main (3efe907) and resolved #282 findings #13 (shared_buffer_staging allocated before map_buffer_tiles; failed UpdateTileMappings paths unmap with D3D12_TILE_RANGE_FLAG_NULL and retire heaps via host::retire) and #14 (replaced DIRTY_WINDOW / free_pages heuristics with monotonic (dirty_epoch, refreshed_epoch) tracking on ArenaChunk and directory advancing only on actual submission refreshes, plus submit-time land_and_refresh -> host::submit_refresh -> Batch::add_fresh). Local (VICTORY_D3D12_WARP=1) memory::tests (10 passed), shadow::window_tests (10 passed), host:: (193 passed; 0 failed; 17 pre-existing ignored), workspace clippy, xtask policy, and CI (46926192173) are green (MERGEABLE).
  • PR #343 (feat/hw-rt-phase1-bvh-sync, 6b9c843): Rebased onto main (80d3ff4) and resolved #282 finding #17 (replaced SIZES_SEEN / THIN_QUEUED / THIN_DONE with per-Recording has_sizes via pipeline::maybe_size_query, paired note_queued_sizes -> THIN_SIZES_DONE Release / THIN_SIZES_DONE -> SIZES_QUEUED Acquire ordering in has_pending_sizes, filtered wake_quiet to small buffers, and removed the early !self.ready return in Quiet::wake). Local (VICTORY_D3D12_WARP=1) list::thin::tests (13 passed), queue::behind::tests (9 passed), quiet::tests (8 passed), host::sizes::tests (2 passed), memory::tests (10 passed), workspace clippy, and xtask policy passed (MERGEABLE, CI run 46927447464 running).

(Per local GPU sharing guardrails, Phase 1 PRs are verified locally via WARP/DXIL unit suites and GitHub Actions CI, and are ready for the maintainer's real-GPU A/B smoke gate.)


Phase 2 — Native DXR 1.1 BLAS/TLAS & Decoders (VICTORY_HW_RT=1, off by default)

  • PR #347 (feat/hw-rt-phase2-registry-hle): DXR 1.1 BLAS/TLAS registry + XboxBvhBuilder.dll HLE — CI green, MERGEABLE.
  • PR #349 (feat/hw-rt-phase2-mesh-decoders, base feat/hw-rt-phase2-registry-hle): Meshlet IB (IndexFormat == 53) & quant24 VB (VertexFormat == 16) decoders, menu toggle, shader-cache key isolation, telemetry — CI green, MERGEABLE.

Phase 3 — Native SM 6.6 DXR 1.1 RayQuery Lifting & Dispatch Binding (VICTORY_HW_RT=1, off by default)

  • PR #352 (feat/hw-rt-phase3-dxil-rayquery): SM 6.6 DXIL RayQuery intrinsic emitter + RTAccelerationStructure (kind = 16) — MERGED to main (80d3ff4).
  • PR #354 (feat/hw-rt-phase3-traversal-lifter, 6a686c5): Rebased cleanly onto main (80d3ff4, MERGEABLE). Recognizes and lifts both BVH traversal templates (image_bvh64_intersect_ray and image_bvh_intersect_ray), non-opaque candidate callbacks, and falls back cleanly on unhandled patterns (VICTORY_HW_RT_LIFT=0, VICTORY_HW_RT_WHY=1). Local emit::rayquery (11 passed; 0 failed) and workspace clippy (normal & --all-features) passed.
  • PR #357 (feat/hw-rt-phase3-gpu-dispatch-binding, cbcfeb5, base feat/hw-rt-phase3-traversal-lifter): Restacked cleanly onto rebased #354 + #349 (MERGEABLE). Wires root TLAS SRVs (pipeline/host.rs, draw.rs), descriptor-heap RT_ACCELERATION_STRUCTURE SRVs (descriptor/host.rs), shader_cache.rs RayQueries serialization, CS_RaytracingResolve enablement, hwrt telemetry, and hwrt::manager() requested() guard. Local (VICTORY_D3D12_WARP=1, VICTORY_HW_RT unset) hwrt:: (27 passed), shader_cache::tests (2 passed), --features diagnostics descriptor::host::tests::note_buffer_populates_and_clears_view_address_table (1 passed), victory-hle::xboxbvh (2 passed), xtask (8 passed, including repository_passes_policy), and workspace clippy (normal & --all-features) passed.

(Clean-room GPL-3.0 references: ReTerryDavis/ReVIctory commit 925ac0a, TrustNo1-Coder/Darner, readmet3xt-lab/foxhound.)


Merge Order & Activation

  1. Phase 1 (independent on main): #341, #342, #343
  2. Phase 2: #347 -> #349
  3. Phase 3: #352 (merged) -> #354 -> #357 (after #349 lands on main)
  4. Activation: Keep default (VICTORY_HW_RT unset) for zero RT-off impact; set VICTORY_HW_RT=1 on DXR 1.1 + SM 6.5/6.6 hardware to test native RayQuery execution (VICTORY_HW_RT_WHY=1 for lift diagnostics).
<!-- greyfinch-sync:Androtim/MiniVI:comment:7352269905 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7352269905). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T16:39:19Z. --- ### Phase 1 Audit Fixes & Phase 3 Completion Update (`#339`) #### Phase 1 — Audit Fixes & Rebases (`#282` comment `7349410307`) - **PR `#341` (`feat/hw-rt-phase1-shader-bvh-opt`, `3bf8fad`):** Rebased onto `main` (`3efe907`, resolving the `lower_tests.rs` conflict) and resolved `#282` finding **#16** via `uniform_scalars` host-wave uniformity analysis (`NonUniformIndex = true` whenever an address word or `soffset` may derive from `waterfall.reads`, `waterfall.loads`, `v_readfirstlane_b32`, divergent `Atom::Uniform` branches, or divergent/loop-carried SGPR PHIs), with `smem_memory_load_divergent_sgpr_keeps_nonuniform_handle` test coverage. Local `emit::lower::tests` (`27 passed; 0 failed; 1 ignored`), `emit::intersect_tests` (`11 passed; 0 failed`), workspace `clippy`, `xtask policy`, and CI (`46924759840`) are **green** (`MERGEABLE`). - **PR `#342` (`feat/hw-rt-phase1-arena-pool`, `f204e9c`):** Rebased onto `main` (`3efe907`) and resolved `#282` findings **#13** (`shared_buffer_staging` allocated before `map_buffer_tiles`; failed `UpdateTileMappings` paths unmap with `D3D12_TILE_RANGE_FLAG_NULL` and retire heaps via `host::retire`) and **#14** (replaced `DIRTY_WINDOW` / `free_pages` heuristics with monotonic `(dirty_epoch, refreshed_epoch)` tracking on `ArenaChunk` and `directory` advancing only on actual submission refreshes, plus submit-time `land_and_refresh` -> `host::submit_refresh` -> `Batch::add_fresh`). Local (`VICTORY_D3D12_WARP=1`) `memory::tests` (`10 passed`), `shadow::window_tests` (`10 passed`), `host::` (`193 passed; 0 failed`; 17 pre-existing ignored), workspace `clippy`, `xtask policy`, and CI (`46926192173`) are **green** (`MERGEABLE`). - **PR `#343` (`feat/hw-rt-phase1-bvh-sync`, `6b9c843`):** Rebased onto `main` (`80d3ff4`) and resolved `#282` finding **#17** (replaced `SIZES_SEEN` / `THIN_QUEUED` / `THIN_DONE` with per-`Recording` `has_sizes` via `pipeline::maybe_size_query`, paired `note_queued_sizes` -> `THIN_SIZES_DONE` Release / `THIN_SIZES_DONE` -> `SIZES_QUEUED` Acquire ordering in `has_pending_sizes`, filtered `wake_quiet` to small buffers, and removed the early `!self.ready` return in `Quiet::wake`). Local (`VICTORY_D3D12_WARP=1`) `list::thin::tests` (`13 passed`), `queue::behind::tests` (`9 passed`), `quiet::tests` (`8 passed`), `host::sizes::tests` (`2 passed`), `memory::tests` (`10 passed`), workspace `clippy`, and `xtask policy` passed (`MERGEABLE`, CI run `46927447464` running). *(Per local GPU sharing guardrails, Phase 1 PRs are verified locally via WARP/DXIL unit suites and GitHub Actions CI, and are ready for the maintainer's real-GPU A/B smoke gate.)* --- #### Phase 2 — Native DXR 1.1 BLAS/TLAS & Decoders (`VICTORY_HW_RT=1`, off by default) - **PR `#347` (`feat/hw-rt-phase2-registry-hle`):** DXR 1.1 BLAS/TLAS registry + `XboxBvhBuilder.dll` HLE — **CI green, `MERGEABLE`**. - **PR `#349` (`feat/hw-rt-phase2-mesh-decoders`, base `feat/hw-rt-phase2-registry-hle`):** Meshlet IB (`IndexFormat == 53`) & quant24 VB (`VertexFormat == 16`) decoders, menu toggle, shader-cache key isolation, telemetry — **CI green, `MERGEABLE`**. --- #### Phase 3 — Native SM 6.6 DXR 1.1 `RayQuery` Lifting & Dispatch Binding (`VICTORY_HW_RT=1`, off by default) - **PR `#352` (`feat/hw-rt-phase3-dxil-rayquery`):** SM 6.6 DXIL `RayQuery` intrinsic emitter + `RTAccelerationStructure` (`kind = 16`) — **MERGED to `main` (`80d3ff4`)**. - **PR `#354` (`feat/hw-rt-phase3-traversal-lifter`, `6a686c5`):** Rebased cleanly onto `main` (`80d3ff4`, **`MERGEABLE`**). Recognizes and lifts both BVH traversal templates (`image_bvh64_intersect_ray` and `image_bvh_intersect_ray`), non-opaque candidate callbacks, and falls back cleanly on unhandled patterns (`VICTORY_HW_RT_LIFT=0`, `VICTORY_HW_RT_WHY=1`). Local `emit::rayquery` (`11 passed; 0 failed`) and workspace `clippy` (normal & `--all-features`) passed. - **PR `#357` (`feat/hw-rt-phase3-gpu-dispatch-binding`, `cbcfeb5`, base `feat/hw-rt-phase3-traversal-lifter`):** Restacked cleanly onto rebased `#354` + `#349` (**`MERGEABLE`**). Wires root TLAS SRVs (`pipeline/host.rs`, `draw.rs`), descriptor-heap `RT_ACCELERATION_STRUCTURE` SRVs (`descriptor/host.rs`), `shader_cache.rs` `RayQueries` serialization, `CS_RaytracingResolve` enablement, `hwrt` telemetry, and `hwrt::manager()` `requested()` guard. Local (`VICTORY_D3D12_WARP=1`, `VICTORY_HW_RT` unset) `hwrt::` (`27 passed`), `shader_cache::tests` (`2 passed`), `--features diagnostics` `descriptor::host::tests::note_buffer_populates_and_clears_view_address_table` (`1 passed`), `victory-hle::xboxbvh` (`2 passed`), `xtask` (`8 passed`, including `repository_passes_policy`), and workspace `clippy` (normal & `--all-features`) passed. *(Clean-room GPL-3.0 references: `ReTerryDavis/ReVIctory` commit `925ac0a`, `TrustNo1-Coder/Darner`, `readmet3xt-lab/foxhound`.)* --- #### Merge Order & Activation 1. **Phase 1 (independent on `main`):** `#341`, `#342`, `#343` 2. **Phase 2:** `#347` -> `#349` 3. **Phase 3:** `#352` *(merged)* -> `#354` -> `#357` *(after `#349` lands on `main`)* 4. **Activation:** Keep default (`VICTORY_HW_RT` unset) for zero RT-off impact; set `VICTORY_HW_RT=1` on DXR 1.1 + SM 6.5/6.6 hardware to test native `RayQuery` execution (`VICTORY_HW_RT_WHY=1` for lift diagnostics).
Androtim commented 2026-12-02 17:00:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T17:00:44Z.


Audit Pass #2 Verdict (#282 comment 7352688269)

  • VERIFIED CLEAN (Hold Lifted — Ready to Merge!): #341 and #342 (and #352 already merged). Great work on the Pass #1 fixes!
  • Still Needs Fixes Before Merge:
    • #343: Pass #1 finding #17 is still unchanged (de84a1e1) — please push the per-Recording has_sizes flag + Quiet::wake fix.
    • #347, #349, #357 (GPU/HLE DXR 1.1): Address #282 comment 7352688269 findings #1–#9 (especially P0 #1: Arc::strong_count(existing) == 1 always true -> retain Arc<HostAs> in list.hold/Shown/BlasRefs or double/triple-buffer TLAS gated on fence; P1 #2–#8: COPY_DEST -> COMMON barrier in emit_postbuild, mgr.blas_work starvation when blas.is_empty(), LRU-evicted copy sources, stale TLAS SRVs in HostHeap::mirror, remove unsafe std::env::set_var from parallel workers, safe title-memory copy instead of raw aliasing reads, TLAS n == 0 barrier).
    • #354 (DXR 1.1 RayQuery lifter): Address #282 comment 7352688269 findings #10–#20 (especially P0 #10 cache key isolation so #354 is safe standalone, P0 #11–#12 CallbackKind::Blocks PHI/dominance & EXEC-masked non-opaque callbacks, and P1 #13–#19 loop-invariant TMax vs TMin, InstanceInclusionMask truncation, live-out header PHIs, outer-loop counter PHI, Template B multi-exit latch, trace_tlas_from_shr, guarded AttrSource::Single).
<!-- greyfinch-sync:Androtim/MiniVI:comment:7352771389 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7352771389). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T17:00:44Z. --- ### Audit Pass #2 Verdict (#282 comment `7352688269`) - **VERIFIED CLEAN (Hold Lifted — Ready to Merge!):** **`#341`** and **`#342`** (and `#352` already merged). Great work on the Pass #1 fixes! - **Still Needs Fixes Before Merge:** - **`#343`:** Pass #1 finding #17 is still unchanged (`de84a1e1`) — please push the per-`Recording` `has_sizes` flag + `Quiet::wake` fix. - **`#347`, `#349`, `#357` (GPU/HLE DXR 1.1):** Address `#282` comment `7352688269` findings **#1–#9** (especially **P0 #1**: `Arc::strong_count(existing) == 1` always true -> retain `Arc<HostAs>` in `list.hold`/`Shown`/`BlasRefs` or double/triple-buffer TLAS gated on fence; **P1 #2–#8**: `COPY_DEST -> COMMON` barrier in `emit_postbuild`, `mgr.blas_work` starvation when `blas.is_empty()`, LRU-evicted copy sources, stale TLAS SRVs in `HostHeap::mirror`, remove `unsafe std::env::set_var` from parallel workers, safe title-memory copy instead of raw aliasing reads, TLAS `n == 0` barrier). - **`#354` (DXR 1.1 `RayQuery` lifter):** Address `#282` comment `7352688269` findings **#10–#20** (especially **P0 #10** cache key isolation so `#354` is safe standalone, **P0 #11–#12** `CallbackKind::Blocks` PHI/dominance & EXEC-masked non-opaque callbacks, and **P1 #13–#19** loop-invariant `TMax` vs `TMin`, `InstanceInclusionMask` truncation, live-out header PHIs, outer-loop counter PHI, Template B multi-exit latch, `trace_tlas_from_shr`, guarded `AttrSource::Single`).
Androtim commented 2026-12-02 18:40:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T18:40:17Z.


Audit Pass #2 Resolutions — Native HW-RT Stack Ready for Final Verification

All confirmed findings from Pass #1 (#17) and Pass #2 (#1–#20 in #282 comment 7352688269) have been resolved and pushed across the stack:

1. BVH Sync — #343 (feat/hw-rt-phase1-bvh-sync @ 6b9c843)

  • Pass #1 #17: Replaced global SIZES_SEEN + THIN_DONE < THIN_QUEUED checks with a per-Recording has_sizes flag so only batches with BVH size queries increment SIZES_QUEUED, and fixed Quiet::wake to unconditionally lock and reset streak, audit, range, and ready.

2. GPU / HLE DXR 1.1 Runtime — #347 (5140ce4), #349 (769d11c), #357 (be6135a, merging #349 + #354)

  • P0 #1: Replaced Arc::strong_count(existing) == 1 in-place reuse checks with explicit Arc<HostAs> retention across command-list holds/Shown/BlasRefs/fence-gated retirement, and publish newly built TLASes to shown on submit via list.defer_host (preventing recording-time exposure of unbuilt TLASes).
  • P1 #2: emit_postbuild transitions Shadow::buffer COPY_DEST -> COMMON after postbuild writes/copies.
  • P1 #3: execute_op invokes mgr.blas_work unconditionally even when blas.is_empty() so deferred waiting and LRU wanted rebuilds never starve.
  • P1 #4: execute_copy and copy_waiting handle LRU-evicted copy sources cleanly.
  • P1 #5: descriptor/host.rs + hwrt.rs: excluded D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE from is_texture_view and note_buffer texture queueing; added null_rtas_view in null_for and returned None from tlas_for_descriptor for unbound/unbuilt/evicted TLASes; added per-slot tlas_gen: Vec<AtomicU64> invalidation across HostHeap::mirror (quick, shown == key remake, and non-pinning of null RTAS fallbacks when HW-RT is active) and unmake. Added WARP regression test rtas_srv_skips_texture_queue_accepts_null_and_invalidates_on_tlas_generation.
  • P1 #6: Removed unsafe { std::env::set_var(...) } from hwrt::requested() and normalized VICTORY_BVH_BUILDER inside shader_cache::build().
  • P1 #7: prepare_triangles (#347) and hwrt/decoders.rs (#349) snapshot title memory safely via fault-tolerant copies instead of aliasing live title pointers.
  • P1 #8: Fixed execute_build (TLAS) n == 0 pre-build UAV barrier, ordered scratch/AS lease before transitioning dst_inst_buf, and used read_volatile on pool.stats_rb.
  • P2 #9: Fixed prepare_aabbs stride & prebuild_geometry_descs tiny-index validation, chunked oversized sanitize inputs (sanitize_chunks), set tlas_srvs root descriptors to D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE, and added early return on !requested() in hwrt::note_dispatch.

3. DXR 1.1 Traversal Lifter — #354 (feat/hw-rt-phase3-traversal-lifter @ 7ae7398)

  • P0 #10: Made #354 standalone-safe by tracking normalized VICTORY_HW_RT=1 / VICTORY_HW_RT_LIFT=0 in shader_cache::build() and serializing/deserializing HostShader::ray_queries cleanly.
  • P0 #11–#12: Added full CallbackKind::Blocks multi-block CFG/PHI lowering (self.tail[*entry_block], merge_block PHI materialization, CommitDecision::MergeEdges & dominance checks) and strict bailouts when EXEC-masked/branched/shadow callbacks cannot be lifted soundly.
  • P1 #13–#19 & P2 #20: Fixed loop-invariant TMax (tmax_val) vs TMin identification; unified 8-bit InstanceInclusionMask shift/bfe matching; preserved live-out origin/dir pre-loop inputs in is_pure_bvh_internal_scratch (PreLoopInit); handled outer-loop counter back-edges (rq.latch == q && rq.exit == b); fixed Template B multi-exit latch selection (select_bvh32_exit_latch); handled trace_tlas_from_shr dynamic2, coalesced s_load_dwordx8/x16, nonuniform, and deferred dead_sites; guarded dead_sites and AttrSource::Single (guard && COMMITTED_STATUS == 1) + nested s_and_saveexec/s_mov exec depth; validated non-cmpx opacity polarity + !dyn_ray_flags FORCE_OPAQUE + Plan::is_eliminated inline callback preservation. Added 11 regression unit + dxil.dll validation tests.

Offline Verification (VICTORY_D3D12_WARP=1, -j 4)

  • #343 (6b9c843): cargo test -p victory-gpu --lib -j 4 -- list::thin::tests queue::behind::tests quiet::tests host::sizes::tests memory::tests — 42 passed, 0 failed.
  • #347 (5140ce4): victory-gpu --lib -- hwrt:: (26 passed, 0 failed), victory-hle --lib -- xboxbvh (2 passed, 0 failed), clippy exit 0, xtask policy (328 files ok).
  • #349 (769d11c): victory-gpu --lib -- hwrt:: shader_cache:: (34 passed, 0 failed), clippy exit 0, xtask policy (329 files ok).
  • #354 (7ae7398): victory-shader --lib -- rayquery (22 passed, 0 failed, including dxil.dll validation), victory-gpu --lib -- shader_cache:: (3 passed, 0 failed), clippy exit 0, xtask policy (331 files ok).
  • #357 (be6135a, full merged stack tip):
    • VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib -j 4 -- hwrt:: descriptor:: shader_cache:: pipeline:: — 163 passed, 0 failed (634 filtered out).
    • VICTORY_HW_RT=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib -j 4 -- rtas_srv_skips_texture_queue_accepts_null_and_invalidates_on_tlas_generation — 1 passed, 0 failed.
    • cargo test -p victory-shader --lib -j 4 -- rayquery — 22 passed, 0 failed (364 filtered out).
    • cargo test -p victory-hle --lib -j 4 -- xboxbvh — 2 passed, 0 failed (243 filtered out).
    • cargo test -p xtask -j 4 — 8 passed, 0 failed.
    • cargo clippy --workspace --all-targets -j 4 -- -D warnings — exit 0.
    • cargo xtask policy — asset policy: 336 files ok.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7354970396 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7354970396). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T18:40:17Z. --- ## Audit Pass #2 Resolutions — Native HW-RT Stack Ready for Final Verification All confirmed findings from Pass #1 (`#17`) and Pass #2 (`#1`–`#20` in `#282` comment `7352688269`) have been resolved and pushed across the stack: ### 1. BVH Sync — `#343` (`feat/hw-rt-phase1-bvh-sync` @ `6b9c843`) - **Pass #1 #17:** Replaced global `SIZES_SEEN` + `THIN_DONE < THIN_QUEUED` checks with a per-`Recording` `has_sizes` flag so only batches with BVH size queries increment `SIZES_QUEUED`, and fixed `Quiet::wake` to unconditionally lock and reset `streak`, `audit`, `range`, and `ready`. ### 2. GPU / HLE DXR 1.1 Runtime — `#347` (`5140ce4`), `#349` (`769d11c`), `#357` (`be6135a`, merging `#349` + `#354`) - **P0 #1:** Replaced `Arc::strong_count(existing) == 1` in-place reuse checks with explicit `Arc<HostAs>` retention across command-list holds/`Shown`/`BlasRefs`/fence-gated retirement, and publish newly built TLASes to `shown` on submit via `list.defer_host` (preventing recording-time exposure of unbuilt TLASes). - **P1 #2:** `emit_postbuild` transitions `Shadow::buffer` `COPY_DEST -> COMMON` after postbuild writes/copies. - **P1 #3:** `execute_op` invokes `mgr.blas_work` unconditionally even when `blas.is_empty()` so deferred `waiting` and LRU `wanted` rebuilds never starve. - **P1 #4:** `execute_copy` and `copy_waiting` handle LRU-evicted copy sources cleanly. - **P1 #5:** `descriptor/host.rs` + `hwrt.rs`: excluded `D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE` from `is_texture_view` and `note_buffer` texture queueing; added `null_rtas_view` in `null_for` and returned `None` from `tlas_for_descriptor` for unbound/unbuilt/evicted TLASes; added per-slot `tlas_gen: Vec<AtomicU64>` invalidation across `HostHeap::mirror` (`quick`, `shown == key` remake, and non-pinning of null RTAS fallbacks when HW-RT is active) and `unmake`. Added WARP regression test `rtas_srv_skips_texture_queue_accepts_null_and_invalidates_on_tlas_generation`. - **P1 #6:** Removed `unsafe { std::env::set_var(...) }` from `hwrt::requested()` and normalized `VICTORY_BVH_BUILDER` inside `shader_cache::build()`. - **P1 #7:** `prepare_triangles` (`#347`) and `hwrt/decoders.rs` (`#349`) snapshot title memory safely via fault-tolerant copies instead of aliasing live title pointers. - **P1 #8:** Fixed `execute_build` (TLAS) `n == 0` pre-build UAV barrier, ordered scratch/AS lease before transitioning `dst_inst_buf`, and used `read_volatile` on `pool.stats_rb`. - **P2 #9:** Fixed `prepare_aabbs` stride & `prebuild_geometry_descs` tiny-index validation, chunked oversized sanitize inputs (`sanitize_chunks`), set `tlas_srvs` root descriptors to `D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE`, and added early return on `!requested()` in `hwrt::note_dispatch`. ### 3. DXR 1.1 Traversal Lifter — `#354` (`feat/hw-rt-phase3-traversal-lifter` @ `7ae7398`) - **P0 #10:** Made `#354` standalone-safe by tracking normalized `VICTORY_HW_RT=1` / `VICTORY_HW_RT_LIFT=0` in `shader_cache::build()` and serializing/deserializing `HostShader::ray_queries` cleanly. - **P0 #11–#12:** Added full `CallbackKind::Blocks` multi-block CFG/PHI lowering (`self.tail[*entry_block]`, `merge_block` PHI materialization, `CommitDecision::MergeEdges` & dominance checks) and strict bailouts when EXEC-masked/branched/shadow callbacks cannot be lifted soundly. - **P1 #13–#19 & P2 #20:** Fixed loop-invariant `TMax` (`tmax_val`) vs `TMin` identification; unified 8-bit `InstanceInclusionMask` shift/`bfe` matching; preserved live-out `origin`/`dir` pre-loop inputs in `is_pure_bvh_internal_scratch` (`PreLoopInit`); handled outer-loop counter back-edges (`rq.latch == q && rq.exit == b`); fixed Template B multi-exit latch selection (`select_bvh32_exit_latch`); handled `trace_tlas_from_shr` `dynamic2`, coalesced `s_load_dwordx8`/`x16`, `nonuniform`, and deferred `dead_sites`; guarded `dead_sites` and `AttrSource::Single` (`guard && COMMITTED_STATUS == 1`) + nested `s_and_saveexec`/`s_mov exec` depth; validated non-`cmpx` opacity polarity + `!dyn_ray_flags` `FORCE_OPAQUE` + `Plan::is_eliminated` inline callback preservation. Added 11 regression unit + `dxil.dll` validation tests. ### Offline Verification (`VICTORY_D3D12_WARP=1`, `-j 4`) - **`#343` (`6b9c843`):** `cargo test -p victory-gpu --lib -j 4 -- list::thin::tests queue::behind::tests quiet::tests host::sizes::tests memory::tests` — **42 passed, 0 failed**. - **`#347` (`5140ce4`):** `victory-gpu --lib -- hwrt::` (**26 passed, 0 failed**), `victory-hle --lib -- xboxbvh` (**2 passed, 0 failed**), `clippy` exit `0`, `xtask policy` (**328 files ok**). - **`#349` (`769d11c`):** `victory-gpu --lib -- hwrt:: shader_cache::` (**34 passed, 0 failed**), `clippy` exit `0`, `xtask policy` (**329 files ok**). - **`#354` (`7ae7398`):** `victory-shader --lib -- rayquery` (**22 passed, 0 failed**, including `dxil.dll` validation), `victory-gpu --lib -- shader_cache::` (**3 passed, 0 failed**), `clippy` exit `0`, `xtask policy` (**331 files ok**). - **`#357` (`be6135a`, full merged stack tip):** - `VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib -j 4 -- hwrt:: descriptor:: shader_cache:: pipeline::` — **163 passed, 0 failed** (`634` filtered out). - `VICTORY_HW_RT=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib -j 4 -- rtas_srv_skips_texture_queue_accepts_null_and_invalidates_on_tlas_generation` — **1 passed, 0 failed**. - `cargo test -p victory-shader --lib -j 4 -- rayquery` — **22 passed, 0 failed** (`364` filtered out). - `cargo test -p victory-hle --lib -j 4 -- xboxbvh` — **2 passed, 0 failed** (`243` filtered out). - `cargo test -p xtask -j 4` — **8 passed, 0 failed**. - `cargo clippy --workspace --all-targets -j 4 -- -D warnings` — **exit 0**. - `cargo xtask policy` — **`asset policy: 336 files ok`**.
Androtim commented 2026-12-02 19:13:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T19:13:34Z.


Audit Pass #3 Verdict (#282 comment 7355749301) — Almost There!

  • VERIFIED CLEAN (Green Light!): #343 (6b9c8435) — ALL of Phase 1 (#341, #342, #343) is now 100% verified clean!
  • Great progress on Phase 2/3: Pass #2 findings #1, #3, #4, #6, #7, #8, #9, #10, #13, #14, #16, and #17 are ALL cleanly resolved!
  • Final Polish Needed Before Merging #347 / #349 / #354 / #357:
    • #347 / #349 / #357 (2 P1s + 3 P2s — Pass #3 findings #1–#5):
      1. [P1] #357: Bindless ResourceDescriptorHeap[] RTAS SRVs staying null/stale + HostHeap::kept BLAS UAF / lag.
      2. [P1] #347/#349/#357: emit_postbuild + local read_shadows RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH.
      3. [P2] #349/#357: Bound decoders.rs vec![0u8; ...] before read_into; #349 standalone shader_cache.rs VICTORY_BVH_BUILDER normalization; #357 gate null_rtas_view/should_pin_descriptor on hwrt::active().
    • #354 (2 P0s + 3 P1s + 1 P2 — Pass #3 findings #6–#11):
      1. [P0] #6: find_triangle_hit_info Pattern C EXEC-masked CallbackKind::Blocks commits & opaque-only tri_merge_block.
      2. [P0] #7: CallbackKind::Blocks PHI resolution zeroing live lazy-param/missing arms & aborting on unread lane-mask/SCC.
      3. [P1] #8–#10: is_pure_bvh_internal_scratch mutated live-out origin/dir back-edge; non-callback opacity polarity dropping st.reach[search_blk]; Pattern A MergeEdges early break on invalid.
      4. [P2] #11: Remaining edge cases.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7355818356 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7355818356). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T19:13:34Z. --- ### Audit Pass #3 Verdict (#282 comment `7355749301`) — Almost There! - **VERIFIED CLEAN (Green Light!):** **`#343`** (`6b9c8435`) — **ALL of Phase 1 (`#341`, `#342`, `#343`) is now 100% verified clean!** - **Great progress on Phase 2/3:** Pass #2 findings `#1`, `#3`, `#4`, `#6`, `#7`, `#8`, `#9`, `#10`, `#13`, `#14`, `#16`, and `#17` are ALL cleanly resolved! - **Final Polish Needed Before Merging `#347` / `#349` / `#354` / `#357`:** - **`#347` / `#349` / `#357` (2 P1s + 3 P2s — Pass #3 findings `#1–#5`):** 1. `[P1]` `#357`: Bindless `ResourceDescriptorHeap[]` RTAS SRVs staying null/stale + `HostHeap::kept` BLAS UAF / lag. 2. `[P1]` `#347`/`#349`/`#357`: `emit_postbuild` + local `read_shadows` `RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH`. 3. `[P2]` `#349`/`#357`: Bound `decoders.rs` `vec![0u8; ...]` before `read_into`; `#349` standalone `shader_cache.rs` `VICTORY_BVH_BUILDER` normalization; `#357` gate `null_rtas_view`/`should_pin_descriptor` on `hwrt::active()`. - **`#354` (2 P0s + 3 P1s + 1 P2 — Pass #3 findings `#6–#11`):** 1. `[P0]` `#6`: `find_triangle_hit_info` Pattern C EXEC-masked `CallbackKind::Blocks` commits & opaque-only `tri_merge_block`. 2. `[P0]` `#7`: `CallbackKind::Blocks` PHI resolution zeroing live lazy-param/missing arms & aborting on unread lane-mask/SCC. 3. `[P1]` `#8–#10`: `is_pure_bvh_internal_scratch` mutated live-out `origin`/`dir` back-edge; non-callback opacity polarity dropping `st.reach[search_blk]`; Pattern A `MergeEdges` early `break` on `invalid`. 4. `[P2]` `#11`: Remaining edge cases.
Androtim commented 2026-12-02 20:43:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T20:43:49Z.


Pass #3 Fixes Complete — Ready for Final Verification (#347 / #349 / #354 / #357)

All Audit Pass #3 findings (#1–#11 from #282 comment 7355749301) have been resolved, verified offline with -j 4 under VICTORY_D3D12_WARP=1, and pushed to their respective branches (with #347 -> #349 and #349 + #354 merged cleanly into #357). Excluded #360 (Finding #12) as requested.

Updated PR Heads

  • #347 (feat/hw-rt-phase2-registry-hle): a4aab82
  • #349 (feat/hw-rt-phase2-mesh-decoders): 36e700b
  • #354 (feat/hw-rt-phase3-traversal-lifter): 5b974f3
  • #357 (feat/hw-rt-phase3-gpu-dispatch-binding): 363edc5

Summary of Resolved Findings (#1–#11)

  1. Finding #1 ([P1], #357) — Bindless/dynamic RTAS SRV refresh, BLAS pin lifetime, & same-submission TLAS lag:
    • Updated hwrt::tlas_for_descriptor to return Option<(u64, ID3D12Resource, Arc<dyn Any + Send + Sync>)> retaining Arc<HostAs> (and its BlasRefs).
    • Added KeptView, kept_pins, pin_count, rtas_slots, rtas_count, and RtasTracked on HostHeap; keep_view/keep_inner retires replaced or cleared Arc<HostAs> pins via host::retire outside locks, and release/release_batch/unmake/make_null_inner untrack and retire dynamic/bindless pins.
    • Tracked both bindless (mirror, including when initially None/later) and dynamic (make_at_inner) RTAS slots in HostHeap::rtas_slots; added HostHeap::refresh_rtas_slots + descriptor::refresh_rtas_heaps(), invoked after drop(heaps_synced) / drop(h.heaps) and list.run_deferred() in both Host::submit and Host::send_published before ExecuteCommandLists so bindless and dynamic slots update in-place without TLAS lag and revert to null on eviction.
  2. Finding #2 ([P1], #347 / #349 / #357) — Per-HostList shadow buffer barrier tracking & miss return:
    • Added HostList::shadow_to + HostList::shadows_common() (called in HostList::close()), removing local read_shadows sets across draw.rs, indirect.rs, and hwrt.rs; PreparedBlas/ReadyBlas track input_shadows and emit_postbuild transitions through shadow_to (COPY_DEST -> COMMON).
    • Aligned tlas_for_descriptor miss fallback to None.
  3. Finding #3 ([P2], #349 / #357) — Bounded decoder & IB staging allocations:
    • Added MAX_DECODE_READ_BYTES (64 MiB), alloc_zeroed / try_reserve_exact fallible allocation helpers, try_reserve_stage, and bounded read_prefix_into across hwrt/decoders.rs and hwrt.rs.
  4. Finding #4 ([P2], #349 standalone) — VICTORY_HW_RT=1 vs VICTORY_BVH_BUILDER normalization:
    • Updated victory-shader's intersect.rs (bvh_override_enabled / bvh_override_active) so VICTORY_HW_RT=1 suppresses VICTORY_BVH_BUILDER=1 in lockstep with shader_cache.rs.
  5. Finding #5 ([P2], #357) — Gate null_rtas_view, should_pin_descriptor, tlas_gen, & make_twinned on hwrt::active():
    • Replaced hwrt::requested() checks in descriptor/host.rs (tlas_gen allocation, make_listed_batched, mirror, make_twinned, and null_rtas_view) with hwrt::active().
  6. Finding #6 ([P0], #354) — Pattern C CallbackKind::Blocks EXEC guards & tri_merge_block ambiguity:
    • Anchored st.reach[site.0] comparison to cb_head (blocks.first()) and validated callback commit st.guards[site.0][site.1] dominance (bool_dominates_cb_commit), falling back cleanly on empty/ambiguous inline entry or tri_merge_block guards and detecting opaque-only merge_guard via both meet_seen and complementary compare predicates.
  7. Finding #7 ([P0], #354) — CallbackKind::Blocks & merge_block PHI resolution:
    • Collected live demand (collect_rq_needed_vals) and resolved lazy_barycentric + params inputs across PHI arms before numbering, skipping unread/lane-mask/Scc PHIs and refusing silently zeroing live missing arms.
  8. Finding #8 ([P1], #354) — is_pure_bvh_internal_scratch vs mutated live-out origin/dir back-edges:
    • Included header PHI back-edge values in live-out checks and followed value-preserving moves/selects (v_mov_b32, s_mov_b*, v_cndmask_b32, s_cselect_b*) while excluding flag registers (Scc/Vcc/Exec).
  9. Finding #9 ([P1], #354) — Non-callback opacity culling polarity (st.reach[search_blk]):
    • Required both st.reach[search_blk] and st.guards[search_blk][ci] in q_true / q_false selection.
  10. Finding #10 ([P1], #354) — Pattern A (MergeEdges) inconsistent merge PHI rejection:
    • Removed premature break on invalid so all cb_preds populate commits and mismatched merge PHIs fail cleanly to software BVH.
  11. Finding #11 ([P2], #354) — Remaining edge cases (analyze.rs & emit_rq.rs):
    • Filtered heap_tlas_loads using plan.is_eliminated(...) and non-callback skipped_blocks; handled Atom::Uniform in bool_dominates_cb_commit; bounded find_invariant_preloop_source walk (seen.len() > 128); required saved_exec.is_some() in Case 2 extract_callback_region; guarded duplicate counter PHI creation in emit_rq.rs.

Verification Results (Offline, VICTORY_D3D12_WARP=1, -j 4)

On final #357 head (363edc5):

  • cargo xtask policy -> asset policy: 336 files ok
  • cargo clippy --workspace --all-targets -j 4 -- -D warnings -> passed (0 warnings)
  • VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib -j 4 -- --test-threads=1 descriptor::host::bake_flip_tests::rtas descriptor::host::bake_flip_tests::hwrt hwrt::tests indirect::tests host::uav_pool::tests host::upcheck::tests -> 37 passed, 0 failed, 18 ignored
  • cargo test -p victory-gpu --lib -j 4 -- hwrt:: descriptor:: indirect:: draw:: shadow:: host::uav_pool:: host::upcheck:: host::refresh_tests shader_cache:: -> 237 passed, 0 failed, 26 ignored
  • cargo test -p victory-gpu --lib -j 4 -- pool::tests -> 20 passed, 0 failed, 1 ignored
  • cargo test -p victory-gpu --lib -j 4 -- host::list_upload_pool_tests -> 9 passed, 0 failed
  • cargo test -p victory-shader --lib -j 4 -- rayquery intersect:: -> 28 passed, 0 failed (including DXIL validation tests for Findings #4 and #6–#11)
  • cargo test -p victory-core -p victory-pe -p victory-hle -p victory-formats -p victory-pipeline -j 4 -> victory-core (15 passed), victory-formats (69 passed, 7 ignored), victory-hle (242 passed, 3 ignored + no_dll_planting 1 passed), victory-pe (36 passed), victory-pipeline (13 passed), 0 failures
<!-- greyfinch-sync:Androtim/MiniVI:comment:7358220315 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7358220315). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T20:43:49Z. --- ### Pass #3 Fixes Complete — Ready for Final Verification (`#347` / `#349` / `#354` / `#357`) All Audit Pass #3 findings (`#1–#11` from `#282` comment `7355749301`) have been resolved, verified offline with `-j 4` under `VICTORY_D3D12_WARP=1`, and pushed to their respective branches (with `#347` -> `#349` and `#349` + `#354` merged cleanly into `#357`). Excluded `#360` (Finding `#12`) as requested. #### Updated PR Heads - **`#347`** (`feat/hw-rt-phase2-registry-hle`): `a4aab82` - **`#349`** (`feat/hw-rt-phase2-mesh-decoders`): `36e700b` - **`#354`** (`feat/hw-rt-phase3-traversal-lifter`): `5b974f3` - **`#357`** (`feat/hw-rt-phase3-gpu-dispatch-binding`): `363edc5` --- #### Summary of Resolved Findings (`#1–#11`) 1. **Finding `#1` (`[P1]`, `#357`) — Bindless/dynamic RTAS SRV refresh, BLAS pin lifetime, & same-submission TLAS lag:** - Updated `hwrt::tlas_for_descriptor` to return `Option<(u64, ID3D12Resource, Arc<dyn Any + Send + Sync>)>` retaining `Arc<HostAs>` (and its `BlasRefs`). - Added `KeptView`, `kept_pins`, `pin_count`, `rtas_slots`, `rtas_count`, and `RtasTracked` on `HostHeap`; `keep_view`/`keep_inner` retires replaced or cleared `Arc<HostAs>` pins via `host::retire` outside locks, and `release`/`release_batch`/`unmake`/`make_null_inner` untrack and retire dynamic/bindless pins. - Tracked both bindless (`mirror`, including when initially `None`/`later`) and dynamic (`make_at_inner`) RTAS slots in `HostHeap::rtas_slots`; added `HostHeap::refresh_rtas_slots` + `descriptor::refresh_rtas_heaps()`, invoked after `drop(heaps_synced)` / `drop(h.heaps)` and `list.run_deferred()` in both `Host::submit` and `Host::send_published` before `ExecuteCommandLists` so bindless and dynamic slots update in-place without TLAS lag and revert to null on eviction. 2. **Finding `#2` (`[P1]`, `#347` / `#349` / `#357`) — Per-`HostList` shadow buffer barrier tracking & miss return:** - Added `HostList::shadow_to` + `HostList::shadows_common()` (called in `HostList::close()`), removing local `read_shadows` sets across `draw.rs`, `indirect.rs`, and `hwrt.rs`; `PreparedBlas`/`ReadyBlas` track `input_shadows` and `emit_postbuild` transitions through `shadow_to` (`COPY_DEST` -> `COMMON`). - Aligned `tlas_for_descriptor` miss fallback to `None`. 3. **Finding `#3` (`[P2]`, `#349` / `#357`) — Bounded decoder & IB staging allocations:** - Added `MAX_DECODE_READ_BYTES` (`64 MiB`), `alloc_zeroed` / `try_reserve_exact` fallible allocation helpers, `try_reserve_stage`, and bounded `read_prefix_into` across `hwrt/decoders.rs` and `hwrt.rs`. 4. **Finding `#4` (`[P2]`, `#349` standalone) — `VICTORY_HW_RT=1` vs `VICTORY_BVH_BUILDER` normalization:** - Updated `victory-shader`'s `intersect.rs` (`bvh_override_enabled` / `bvh_override_active`) so `VICTORY_HW_RT=1` suppresses `VICTORY_BVH_BUILDER=1` in lockstep with `shader_cache.rs`. 5. **Finding `#5` (`[P2]`, `#357`) — Gate `null_rtas_view`, `should_pin_descriptor`, `tlas_gen`, & `make_twinned` on `hwrt::active()`:** - Replaced `hwrt::requested()` checks in `descriptor/host.rs` (`tlas_gen` allocation, `make_listed_batched`, `mirror`, `make_twinned`, and `null_rtas_view`) with `hwrt::active()`. 6. **Finding `#6` (`[P0]`, `#354`) — Pattern C `CallbackKind::Blocks` EXEC guards & `tri_merge_block` ambiguity:** - Anchored `st.reach[site.0]` comparison to `cb_head` (`blocks.first()`) and validated callback commit `st.guards[site.0][site.1]` dominance (`bool_dominates_cb_commit`), falling back cleanly on empty/ambiguous inline entry or `tri_merge_block` guards and detecting opaque-only `merge_guard` via both `meet_seen` and complementary compare predicates. 7. **Finding `#7` (`[P0]`, `#354`) — `CallbackKind::Blocks` & `merge_block` PHI resolution:** - Collected live demand (`collect_rq_needed_vals`) and resolved `lazy_barycentric` + `params` inputs across PHI arms before numbering, skipping unread/lane-mask/`Scc` PHIs and refusing silently zeroing live missing arms. 8. **Finding `#8` (`[P1]`, `#354`) — `is_pure_bvh_internal_scratch` vs mutated live-out `origin`/`dir` back-edges:** - Included header PHI back-edge values in live-out checks and followed value-preserving moves/selects (`v_mov_b32`, `s_mov_b*`, `v_cndmask_b32`, `s_cselect_b*`) while excluding flag registers (`Scc`/`Vcc`/`Exec`). 9. **Finding `#9` (`[P1]`, `#354`) — Non-callback opacity culling polarity (`st.reach[search_blk]`):** - Required both `st.reach[search_blk]` and `st.guards[search_blk][ci]` in `q_true` / `q_false` selection. 10. **Finding `#10` (`[P1]`, `#354`) — Pattern A (`MergeEdges`) inconsistent merge PHI rejection:** - Removed premature `break` on `invalid` so all `cb_preds` populate `commits` and mismatched merge PHIs fail cleanly to software BVH. 11. **Finding `#11` (`[P2]`, `#354`) — Remaining edge cases (`analyze.rs` & `emit_rq.rs`):** - Filtered `heap_tlas_loads` using `plan.is_eliminated(...)` and non-callback `skipped_blocks`; handled `Atom::Uniform` in `bool_dominates_cb_commit`; bounded `find_invariant_preloop_source` walk (`seen.len() > 128`); required `saved_exec.is_some()` in Case 2 `extract_callback_region`; guarded duplicate counter PHI creation in `emit_rq.rs`. --- #### Verification Results (Offline, `VICTORY_D3D12_WARP=1`, `-j 4`) **On final `#357` head (`363edc5`):** - `cargo xtask policy` -> `asset policy: 336 files ok` - `cargo clippy --workspace --all-targets -j 4 -- -D warnings` -> passed (0 warnings) - `VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib -j 4 -- --test-threads=1 descriptor::host::bake_flip_tests::rtas descriptor::host::bake_flip_tests::hwrt hwrt::tests indirect::tests host::uav_pool::tests host::upcheck::tests` -> **37 passed, 0 failed, 18 ignored** - `cargo test -p victory-gpu --lib -j 4 -- hwrt:: descriptor:: indirect:: draw:: shadow:: host::uav_pool:: host::upcheck:: host::refresh_tests shader_cache::` -> **237 passed, 0 failed, 26 ignored** - `cargo test -p victory-gpu --lib -j 4 -- pool::tests` -> **20 passed, 0 failed, 1 ignored** - `cargo test -p victory-gpu --lib -j 4 -- host::list_upload_pool_tests` -> **9 passed, 0 failed** - `cargo test -p victory-shader --lib -j 4 -- rayquery intersect::` -> **28 passed, 0 failed** (including DXIL validation tests for Findings `#4` and `#6–#11`) - `cargo test -p victory-core -p victory-pe -p victory-hle -p victory-formats -p victory-pipeline -j 4` -> `victory-core` (**15 passed**), `victory-formats` (**69 passed, 7 ignored**), `victory-hle` (**242 passed, 3 ignored** + `no_dll_planting` **1 passed**), `victory-pe` (**36 passed**), `victory-pipeline` (**13 passed**), 0 failures
Androtim commented 2026-12-02 22:31:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T22:31:40Z.


Audit Pass #4 Verdict (#282 comment 7359964895) — 1 Final Fix Left!

  • 10 of 11 Pass #3 items (#1, #3–#11) are VERIFIED CLEAN!
  • Only 2 tiny items left on #357 (and #347/#349/#354) before full Native DXR 1.1 merge:
    1. [P0] (Pass #4 #1): Revert shadow_to / shadows_common hooks in draw.rs, host/place.rs, indirect.rs, and host.rs:9196 (they broke VICTORY_HW_RT=0 zero-impact and caused D3D12 state mismatches on Shadow::buffer). Instead, inside hwrt.rs (hwrt::active() only), write the 8–16 byte emit_postbuild result into sh.buffer via a tiny 1-thread compute shader (SetComputeRootUnorderedAccessView on sh.gpu(dest_va) + plain UAV barrier, keeping Shadow::buffer in COMMON/implicit promotion everywhere).
    2. [P2] (Pass #4 #2): In crates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:1126-1198 (collect_rq_needed_vals), seed the work queue with all phi.value in cb_set/merge_block where self.read_phis.contains(&phi.value) so PHI-to-PHI chains propagate transitively.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7360814134 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7360814134). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T22:31:40Z. --- ### Audit Pass #4 Verdict (#282 comment `7359964895`) — 1 Final Fix Left! - **10 of 11 Pass #3 items (`#1`, `#3`–`#11`) are VERIFIED CLEAN!** - **Only 2 tiny items left on `#357` (and `#347`/`#349`/`#354`) before full Native DXR 1.1 merge:** 1. **`[P0]` (Pass #4 #1):** Revert `shadow_to` / `shadows_common` hooks in `draw.rs`, `host/place.rs`, `indirect.rs`, and `host.rs:9196` (they broke `VICTORY_HW_RT=0` zero-impact and caused D3D12 state mismatches on `Shadow::buffer`). Instead, inside `hwrt.rs` (`hwrt::active()` only), write the 8–16 byte `emit_postbuild` result into `sh.buffer` via a tiny 1-thread compute shader (`SetComputeRootUnorderedAccessView` on `sh.gpu(dest_va)` + plain UAV barrier, keeping `Shadow::buffer` in `COMMON`/implicit promotion everywhere). 2. **`[P2]` (Pass #4 #2):** In `crates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:1126-1198` (`collect_rq_needed_vals`), seed the `work` queue with all `phi.value` in `cb_set`/`merge_block` where `self.read_phis.contains(&phi.value)` so PHI-to-PHI chains propagate transitively.
Androtim commented 2026-12-02 23:06:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T23:06:23Z.


Scout Note — TrustNo1/Darner (Codefloe, GPL-3.0)

Once #357 clears final verification, worth checking 33ceb0a (codefloe.com/TrustNo1/Darner): tracks a running minimum of hit distances in DXR 1.1 RayQuery so only candidates closer than the committed hit run callback/shading work.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7361570431 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7361570431). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T23:06:23Z. --- ### Scout Note — `TrustNo1/Darner` (Codefloe, GPL-3.0) Once `#357` clears final verification, worth checking **`33ceb0a`** (`codefloe.com/TrustNo1/Darner`): tracks a running minimum of hit distances in DXR 1.1 `RayQuery` so only candidates closer than the committed hit run callback/shading work.
Androtim commented 2026-12-02 23:34:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T23:34:52Z.


Audit Pass #4 resolved — #357 ready to merge behind VICTORY_HW_RT=1:

  • Pass #4 #1 (#347/#349/#357): Reverted all shadow_to/shadows_common/shadow_states hooks outside hwrt; emit_postbuild now writes Shadow::buffer (COMMON via implicit promotion) with the write_postbuild 1-thread UAV compute shader + plain UAV barrier (VICTORY_D3D12_WARP=1 + VICTORY_D3D12_DEBUG=1 hwrt:: 36/36 pass).
  • Pass #4 #2 (#354/#357): Seeded collect_rq_needed_vals with read_phis entries and transitive resolve_rq_phi_arm PHI propagation, covered by callback_blocks_phi_to_phi_chain_propagates_lazy_param_arm (rayquery_tests 24/24 pass).
  • Stack green: #347 (d065fff), #349 (5a50f8f), #354 (e680116), and #357 (5d0eedb) all pass GitHub CI (MERGEABLE) with zero origin/main merge conflicts.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7362177780 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7362177780). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T23:34:52Z. --- **Audit Pass #4 resolved — `#357` ready to merge behind `VICTORY_HW_RT=1`:** - **Pass #4 #1 (`#347`/`#349`/`#357`):** Reverted all `shadow_to`/`shadows_common`/`shadow_states` hooks outside `hwrt`; `emit_postbuild` now writes `Shadow::buffer` (`COMMON` via implicit promotion) with the `write_postbuild` 1-thread UAV compute shader + plain UAV barrier (`VICTORY_D3D12_WARP=1` + `VICTORY_D3D12_DEBUG=1` `hwrt::` 36/36 pass). - **Pass #4 #2 (`#354`/`#357`):** Seeded `collect_rq_needed_vals` with `read_phis` entries and transitive `resolve_rq_phi_arm` PHI propagation, covered by `callback_blocks_phi_to_phi_chain_propagates_lazy_param_arm` (`rayquery_tests` 24/24 pass). - **Stack green:** `#347` (`d065fff`), `#349` (`5a50f8f`), `#354` (`e680116`), and `#357` (`5d0eedb`) all pass GitHub CI (`MERGEABLE`) with zero `origin/main` merge conflicts.
Androtim commented 2026-12-02 23:54:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T23:54:30Z.


Pass #5 Final Merge Sign-Off — PR #357 (5d0eedb) VERIFIED CLEAN (GREEN LIGHT):

  • [P0] d065fff: All shadow_to / shadows_common hooks removed outside crates/victory-gpu/src/hwrt.rs (zero VICTORY_HW_RT=0 impact); emit_postbuild (hwrt.rs:2657-2737) cleanly runs a gated [numthreads(1, 1, 1)] compute UAV shader (write_postbuild, cs_5_1, hwrt/sanitize.rs:461-484) with 16-byte VA alignment + dst_bias, uav_barriers, and state.replay restoration. (Non-blocking [P2] follow-up: check ALLOW_UNORDERED_ACCESS on sh.buffer in emit_postbuild like draw.rs:2581-2586.)
  • [P2] 65e3d13 / e680116: collect_rq_needed_vals (emit_rq.rs:1191-1193) and resolve_rq_phi_arm (emit_rq.rs:1232-1236) soundly seed and propagate transitive PHI chains in read_phis; merges (5a50f8f, 7cc5837, 5d0eedb) verified conflict-clean. Ready to merge behind VICTORY_HW_RT=1.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7362569973 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7362569973). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T23:54:30Z. --- **Pass #5 Final Merge Sign-Off — PR `#357` (`5d0eedb`) VERIFIED CLEAN (GREEN LIGHT):** - `[P0]` `d065fff`: All `shadow_to` / `shadows_common` hooks removed outside `crates/victory-gpu/src/hwrt.rs` (zero `VICTORY_HW_RT=0` impact); `emit_postbuild` (`hwrt.rs:2657-2737`) cleanly runs a gated `[numthreads(1, 1, 1)]` compute UAV shader (`write_postbuild`, `cs_5_1`, `hwrt/sanitize.rs:461-484`) with 16-byte VA alignment + `dst_bias`, `uav_barrier`s, and `state.replay` restoration. *(Non-blocking `[P2]` follow-up: check `ALLOW_UNORDERED_ACCESS` on `sh.buffer` in `emit_postbuild` like `draw.rs:2581-2586`.)* - `[P2]` `65e3d13` / `e680116`: `collect_rq_needed_vals` (`emit_rq.rs:1191-1193`) and `resolve_rq_phi_arm` (`emit_rq.rs:1232-1236`) soundly seed and propagate transitive PHI chains in `read_phis`; merges (`5a50f8f`, `7cc5837`, `5d0eedb`) verified conflict-clean. Ready to merge behind `VICTORY_HW_RT=1`.
Androtim commented 2026-12-03 01:24:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T01:24:18Z.


Scout Drop #2 — TrustNo1/Darner DXR 1.1 HW-RT Fixes (v2026.12.02.02, GPL-3.0)

Three critical HW-RT wins from codefloe.com/TrustNo1/Darner to check against our newly merged #357 (VICTORY_HW_RT=1):

  1. fa84f7e (CodeFloe #294, by cafe): Deferred BLAS builds must snapshot position/vertex data at queue time instead of reading live title memory that may be reused before build — fixes broken/flickering shadows, reflections, and phantom dark-wall shadows.
  2. CodeFloe #293 (by cafe): Ensure DRED breadcrumbs are strictly OFF unless explicitly requested during HW-RT (left-on DRED cost >50% frame time: 7.7 -> 18.2 fps on RTX 2080 Ti!).
  3. CodeFloe #214: Animated skin/clothes stretching/exploding under HW-RT + 33ceb0a running min hit distance (HWRT_MIN_T).
<!-- greyfinch-sync:Androtim/MiniVI:comment:7364304447 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7364304447). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T01:24:18Z. --- ### Scout Drop #2 — `TrustNo1/Darner` DXR 1.1 HW-RT Fixes (`v2026.12.02.02`, GPL-3.0) Three critical HW-RT wins from `codefloe.com/TrustNo1/Darner` to check against our newly merged `#357` (`VICTORY_HW_RT=1`): 1. **`fa84f7e` (CodeFloe `#294`, by cafe):** Deferred BLAS builds must snapshot position/vertex data at queue time instead of reading live title memory that may be reused before build — fixes broken/flickering shadows, reflections, and phantom dark-wall shadows. 2. **CodeFloe `#293` (by cafe):** Ensure DRED breadcrumbs are strictly OFF unless explicitly requested during HW-RT (left-on DRED cost >50% frame time: `7.7 -> 18.2 fps` on RTX 2080 Ti!). 3. **CodeFloe `#214`:** Animated skin/clothes stretching/exploding under HW-RT + `33ceb0a` running min hit distance (`HWRT_MIN_T`).
Androtim commented 2026-12-03 09:22:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T09:22:54Z.


Live RTX 4060 Ti HW-RT Verification on main (88351ce, with #378)

Tested 1440 DLSS Quality with VICTORY_HW_RT=1 on RTX 4060 Ti 8 GB (Windows 11 26300, NVIDIA 621.24). Two exact, actionable findings:

1. All 12 Gameplay RT Shaders Fell Back (lifted 0 of 12) for 4 Specific Patterns in victory-shader/src/emit/lower/rayquery/analyze.rs

Every active RT dispatch fell back to miss/software (lifted shaders 0, partly 0, fell back 12; per frame 0.0 dispatches all lifted, 75.0 none) due to exactly 4 analyzer rejections:

  • bvh32 multi-exit PHI disagrees (5 shaders): 45b9b6e4 (0/2), 2138527b (0/8), 076769b8 (0/4), 2c42d20b (0/10), ce7d8161 (0/6)
  • bvh64: ambiguous multiple commit mechanisms inside non-opaque callback (4 shaders): 1847ddce (0/5), 010a8328 (0/8), 510704d8 (0/8), c1d046aa (0/4)
  • bvh64: cannot determine instance mask in kind==6 block (2 shaders): 859b83b2 (0/2), 321e1587 (0/3)
  • bvh64: tri_merge_block move reach differs from search_blk (1 shader): ca3fbac9 (0/7)

2. Reproducible DXGI_ERROR_DEVICE_HUNG (0x887A0006) in hwrt.rs AS Builds/Refits (~16–38s into gameplay)

  • Because 0 shaders were lifted (0.0 DXR RayQuery dispatches ran), the GPU hang (~6.8s stall after hwrt build (13) / hwrt build (5) at ~3,536 BLAS builds / 1,975 BLAS refits / 1,290 TLAS builds) originates inside crates/victory-gpu/src/hwrt.rs acceleration structure builds/refits/copies rather than lifted shaders.
  • Note: #378 (ALLOW_UNORDERED_ACCESS guard on postbuild destination shadow buffers) was included in this build (88351ce), so the hang is a distinct hwrt.rs command/barrier/refit defect. Next step: capture exact D3D12 debug layer message with a diagnostics build (VICTORY_D3D12_DEBUG=1) + test VICTORY_HW_RT_REFIT=0.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7373576314 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7373576314). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T09:22:54Z. --- ### Live RTX 4060 Ti HW-RT Verification on `main` (`88351ce`, with `#378`) Tested `1440` DLSS Quality with `VICTORY_HW_RT=1` on RTX 4060 Ti 8 GB (Windows 11 26300, NVIDIA 621.24). Two exact, actionable findings: #### 1. All 12 Gameplay RT Shaders Fell Back (`lifted 0 of 12`) for 4 Specific Patterns in `victory-shader/src/emit/lower/rayquery/analyze.rs` Every active RT dispatch fell back to miss/software (`lifted shaders 0, partly 0, fell back 12; per frame 0.0 dispatches all lifted, 75.0 none`) due to exactly 4 analyzer rejections: - **`bvh32 multi-exit PHI disagrees` (5 shaders):** `45b9b6e4` (`0/2`), `2138527b` (`0/8`), `076769b8` (`0/4`), `2c42d20b` (`0/10`), `ce7d8161` (`0/6`) - **`bvh64: ambiguous multiple commit mechanisms inside non-opaque callback` (4 shaders):** `1847ddce` (`0/5`), `010a8328` (`0/8`), `510704d8` (`0/8`), `c1d046aa` (`0/4`) - **`bvh64: cannot determine instance mask in kind==6 block` (2 shaders):** `859b83b2` (`0/2`), `321e1587` (`0/3`) - **`bvh64: tri_merge_block move reach differs from search_blk` (1 shader):** `ca3fbac9` (`0/7`) #### 2. Reproducible `DXGI_ERROR_DEVICE_HUNG` (`0x887A0006`) in `hwrt.rs` AS Builds/Refits (~16–38s into gameplay) - Because `0` shaders were lifted (`0.0` DXR `RayQuery` dispatches ran), the GPU hang (`~6.8s` stall after `hwrt build (13)` / `hwrt build (5)` at ~3,536 BLAS builds / 1,975 BLAS refits / 1,290 TLAS builds) originates inside `crates/victory-gpu/src/hwrt.rs` acceleration structure builds/refits/copies rather than lifted shaders. - Note: `#378` (`ALLOW_UNORDERED_ACCESS` guard on postbuild destination shadow buffers) was included in this build (`88351ce`), so the hang is a distinct `hwrt.rs` command/barrier/refit defect. Next step: capture exact D3D12 debug layer message with a `diagnostics` build (`VICTORY_D3D12_DEBUG=1`) + test `VICTORY_HW_RT_REFIT=0`.
Androtim commented 2026-12-03 09:26:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T09:26:14Z.


Bisect Confirmed: VICTORY_HW_RT_REFIT=0 Eliminates the 0x887A0006 HW-RT GPU Hang!

  • With VICTORY_HW_RT_REFIT=1 (default): reproducible DXGI_ERROR_DEVICE_HUNG (0x887A0006) 16–38s into gameplay (both with LIFT=1 and LIFT=0).
  • With VICTORY_HW_RT_REFIT=0: ran full 65s gameplay (130.2s total, 10.8–11.8 fps, max_dedicated_mb=6163 / 6809, max_commit=21311 MB) with ZERO hangs / ZERO DRED / ZERO errors!
  • Root cause narrowed: BLAS in-place update (PERFORM_UPDATE / refit) path in crates/victory-gpu/src/hwrt.rs is feeding an invalid/incompatible refit geometry, scratch/source buffer, or missing UAV barrier to BuildRaytracingAccelerationStructure.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7373658087 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7373658087). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T09:26:14Z. --- ### Bisect Confirmed: `VICTORY_HW_RT_REFIT=0` Eliminates the `0x887A0006` HW-RT GPU Hang! - **With `VICTORY_HW_RT_REFIT=1` (default):** reproducible `DXGI_ERROR_DEVICE_HUNG` (`0x887A0006`) 16–38s into gameplay (both with `LIFT=1` and `LIFT=0`). - **With `VICTORY_HW_RT_REFIT=0`:** ran full 65s gameplay (`130.2s` total, `10.8–11.8 fps`, `max_dedicated_mb=6163 / 6809`, `max_commit=21311 MB`) with **ZERO hangs / ZERO DRED / ZERO errors**! - **Root cause narrowed:** BLAS in-place update (`PERFORM_UPDATE` / refit) path in `crates/victory-gpu/src/hwrt.rs` is feeding an invalid/incompatible refit geometry, scratch/source buffer, or missing UAV barrier to `BuildRaytracingAccelerationStructure`.
Androtim commented 2026-12-03 12:21:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T12:21:24Z.


Milestone Update — PR #387 (\ eat/hwrt-rayquery-lift-all-patterns, commit \bcbb36)

Lifted 4 \ ictory-shader\ RayQuery analysis patterns in \crates/victory-shader/src/emit/lower/rayquery/analyze.rs\ (staged \ ri_merge_block\ PHIs, \kind == 6\ guarded instance masks, \vh32\ multi-exit dead/rejoin PHIs, and \ ri_merge_block\ post-waterfall reach):

  • Live RTX 4060 Ti 8G (\1440\ DLSS Quality, \VICTORY_HW_RT=1):
    • Jumped from **\
<!-- greyfinch-sync:Androtim/MiniVI:comment:7378080420 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/issues/339#issuecomment-7378080420). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T12:21:24Z. --- ### Milestone Update — PR #387 (\ eat/hwrt-rayquery-lift-all-patterns\, commit \bcbb36\) Lifted 4 \ ictory-shader\ RayQuery analysis patterns in \crates/victory-shader/src/emit/lower/rayquery/analyze.rs\ (staged \ ri_merge_block\ PHIs, \kind == 6\ guarded instance masks, \vh32\ multi-exit dead/rejoin PHIs, and \ ri_merge_block\ post-waterfall reach): - **Live RTX 4060 Ti 8G (\1440\ DLSS Quality, \VICTORY_HW_RT=1\):** - Jumped from **\
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Androtim/MiniVI#339
No description provided.