Pārlūkot izejas kodu

Structure builder: the wait for sizes is off (VICTORY_BVH_SIZES_WAIT=1 turns it on): it mended nothing and costs some 20 ms a frame (light-15)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
local 1 dienu atpakaļ
vecāks
revīzija
f4cc8d8be4
2 mainītis faili ar 26 papildinājumiem un 12 dzēšanām
  1. 9 3
      crates/victory-gpu/src/memory.rs
  2. 17 9
      docs/fork-ray-tracing.md

+ 9 - 3
crates/victory-gpu/src/memory.rs

@@ -797,8 +797,14 @@ impl Memory {
 const SIZES: usize = usize::MAX - (9 << 33);
 
 /// Whether a submission that asks for the sizes of structures is waited for,
-/// and landed, before the title goes on (`VICTORY_BVH_SIZES_WAIT=0`: it is
-/// not).
+/// and landed, before the title goes on (`VICTORY_BVH_SIZES_WAIT=1`; off).
+///
+/// Off: it does not help. In run light-15, with it, 33 of 154 copies had the
+/// slot's old size still (all of them recorded one frame after the size was
+/// asked for) against 53 of 230 in light-11, 48 of 275 dynamic structures
+/// were good, and the title asks in every frame, so every frame waits (109 ms
+/// against 90). The title reads the slot before our submission of the asking
+/// list is through, or reads it for another purpose; not known.
 ///
 /// The title asks for a new structure's compacted size (a program of one
 /// thread stores it into a small buffer), reads it a frame or two later
@@ -810,7 +816,7 @@ const SIZES: usize = usize::MAX - (9 << 33);
 /// the right size.
 fn sizes_wait() -> bool {
     static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
-    *ON.get_or_init(|| std::env::var_os("VICTORY_BVH_SIZES_WAIT").is_none_or(|v| v != "0"))
+    *ON.get_or_init(|| std::env::var_os("VICTORY_BVH_SIZES_WAIT").is_some_and(|v| v == "1"))
 }
 
 /// Whether a dispatch of the builder is its program of a structure's size:

+ 17 - 9
docs/fork-ray-tracing.md

@@ -93,7 +93,8 @@ after it was given them as an unordered access view.
 |---|---|
 | `VICTORY_BVH_BUILDER=1` | the builder's stages run |
 | `VICTORY_BVH_FENCES=0` | no fences around the builder's buffer atomics (beloooo's 72e748ea has them too) |
-| `VICTORY_BVH_SIZES_WAIT=0` | submissions that ask for structures' sizes are not waited for |
+| `VICTORY_BVH_SIZES_WAIT=1` | submissions that ask for structures' sizes are waited for (off: no help, slow) |
+| `VICTORY_BVH_BOUNDS=0` | the builder's accesses are not bounded |
 | `VICTORY_BVH_TRACE=1` | logs what sizes are asked, when they came, and the copies (diagnostics) |
 | `VICTORY_BVH_QUARANTINE=1` | nothing it stores comes back to title memory |
 | `VICTORY_MEMORY_CARD_MB` | the most of it on the card (4096) |
@@ -105,17 +106,24 @@ dispatches, faults and what came.
 
 ## Known gaps
 
-- Dynamic structures overlap each other (8 of 65 good in run light-10). Cause,
-  run light-11's trace (`VICTORY_BVH_TRACE=1`): the title asks for a new
+- Dynamic structures overlap each other (8 of 65 good in run light-10, 48 of
+  275 in light-15). Part of the cause, run light-11's trace (`VICTORY_BVH_TRACE=1`): the title asks for a new
   structure's compacted size, reads it one or two frames later without looking
   whether it is there, takes memory of that size and has the structure copied
   into it. Our submissions land up to two frames late; the title read what the
   slot held before, another structure's size, and the copy wrote over the
-  neighbours. A submission that asks is waited for now
-  (`VICTORY_BVH_SIZES_WAIT=0`: not).
-- Some 2,500 pages a frame that are not there are still touched (the notes'
-  limit): rays in structures that were written over.
-- A capture of a frame with the builder on cannot be replayed: the card hangs
+  neighbours. Waiting for a submission that asks (`VICTORY_BVH_SIZES_WAIT=1`)
+  did not mend it and costs some 20 ms a frame (light-15): the title asks in
+  every frame, and what it read was as old as before. Open.
+- What a structure that was written over says of its size sent the builder's
+  copy of it through gigabytes of other structures; bounded now
+  (`VICTORY_BVH_BOUNDS`). Pages touched that are not there: 2,500 a frame
+  before, 90 after (the dorm).
+- The card's time in the dorm with the builder (timing run light-13, title's
+  commands 84 ms): `CopyForBVHUpdate` 13.3 ms in 63 dispatches (before the
+  bound), traces 24 ms (`RaytraceVBuffer` 7.9, screen probes 6.4, irradiance
+  cache 3.5, primary probes 2.3, shadows 1.6).
+- Captures made on 2026-11-25 (builder on or off) hang the card in a replay
   (cause unknown; do not try).
 - Five shadow-mask trace programs do not translate (a structure's address out
   of a descriptor picked from the heap by a computed index: the host would have
@@ -150,7 +158,7 @@ fork's constant.
 | `VICTORY_AMBIENT=<share>` | the estimate, 1 all of it (unset: the title's own) |
 | `VICTORY_AMBIENT=constant:<level>` | the same light everywhere |
 | `VICTORY_AMBIENT_SHADE=<strength>,<metres>` | the creases (1,0.6) |
-| `VICTORY_AMBIENT_AIR=<multiple>` | what the air scatters is bounded by a multiple of the light around (off) |
+| `VICTORY_AMBIENT_AIR=<multiple>` | what the air scatters is bounded by a multiple of the light around (off: the brown veil in the day room stays with it, light-14) |
 
 It is off while the builder runs.