Heap pass: looks on eight threads, its own looks leave the written set alone, a part forgotten after the looks, spans by parts #4876

Closed
github-bot wants to merge 1 commit from github-bot/gh-4875 into main AGit
Owner

@⁠Kenzim on GitHub · 2026-12-01 12:28 UTC · original
Kenzim:heap-pass → main · +220 −33 · 4 files · 1 commits · closed without merging

The pass over the view heap's buffer views runs beside the recording, and the list that began it waits for it at its close. In the street scene that wait was 6.3-6.6 ms a frame (16,500 slots looked at a frame, 114,000 views kept in 4,700 host copies).

What changes (each on by default, each with a switch back):

  • VICTORY_VIEW_THREADS default 8 for the views' pool (was 4).
  • VICTORY_HEAP_LOOK_QUIET on: the pass's own look at a slot no longer puts the slot back in the written set, so it is not looked at again a pass later for what the pass has just noted. Title writes and draws' looks are on other threads and still put it there.
  • VICTORY_HEAP_FORGET_AFTER on: a pass forgets what it did not find of its part once it has looked (HeapRanges::forget_part_but). Before, it forgot the whole part first and put it back slot by slot. The same views are kept, slot for slot.
  • VICTORY_HEAP_SPANS_WIDE on: the spans per host copy are found on four threads, each copy's views all by one thread (spans_of). Upstream's heap_used note (issue 4036) is kept and made as each copy's entry is first made.
  • Diagnostics only: a frame line with the pass's counts and the looks' time by kind of slot.

Measurements (RTX 3090, 32 threads, native 2560x1440, DLSS off, street scene; switches flipped inside one run with VICTORY_AB), per frame:

change effect phases
looks on 8 threads looks 5.77 -> 4.67 ms, wait at list close 5.98 -> 4.51 ms (looks summed over threads 16.5 -> 23.7) 8 each way
LOOK_QUIET slots looked at 16,300 -> 14,200; looks 4.6 -> 4.2; wait 4.5 -> 4.2 6 each way
FORGET_AFTER looks 5.38 -> 5.10, wait 5.46 -> 5.10 8 each way
SPANS_WIDE spans stage 1.42 -> 1.28 8 each way

All together: looks 6.2 -> 4.2 ms, spans 1.35 -> 1.2 ms, wait at the list's close 6.3-6.6 -> 4.2 ms.

In this card-bound scene the frame time does not move. The gains are in the processor stages named above.

Not measured: scenes other than the street; about 1 ms of the spans stage is still unexplained.

To restore the old behaviour: VICTORY_VIEW_THREADS=4, VICTORY_HEAP_LOOK_QUIET=0, VICTORY_HEAP_FORGET_AFTER=0, VICTORY_HEAP_SPANS_WIDE=0.

Shader cache / translator key: not affected (no victory-shader change).

Tests: draw::heap_range_tests (3 pass, one new). Clippy on victory-gpu is clean apart from the five errors main already has (#4152). The rest of draw:: aborts on the test PC (Windows 10, no Shader Model 6.6), as on main.

**@⁠Kenzim** on GitHub · 2026-12-01 12:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4875) `Kenzim:heap-pass` → `main` · +220 −33 · 4 files · 1 commits · closed without merging The pass over the view heap's buffer views runs beside the recording, and the list that began it waits for it at its close. In the street scene that wait was 6.3-6.6 ms a frame (16,500 slots looked at a frame, 114,000 views kept in 4,700 host copies). What changes (each on by default, each with a switch back): - `VICTORY_VIEW_THREADS` default 8 for the views' pool (was 4). - `VICTORY_HEAP_LOOK_QUIET` on: the pass's own look at a slot no longer puts the slot back in the written set, so it is not looked at again a pass later for what the pass has just noted. Title writes and draws' looks are on other threads and still put it there. - `VICTORY_HEAP_FORGET_AFTER` on: a pass forgets what it did not find of its part once it has looked (`HeapRanges::forget_part_but`). Before, it forgot the whole part first and put it back slot by slot. The same views are kept, slot for slot. - `VICTORY_HEAP_SPANS_WIDE` on: the spans per host copy are found on four threads, each copy's views all by one thread (`spans_of`). Upstream's `heap_used` note (issue 4036) is kept and made as each copy's entry is first made. - Diagnostics only: a frame line with the pass's counts and the looks' time by kind of slot. Measurements (RTX 3090, 32 threads, native 2560x1440, DLSS off, street scene; switches flipped inside one run with `VICTORY_AB`), per frame: | change | effect | phases | |---|---|---| | looks on 8 threads | looks 5.77 -> 4.67 ms, wait at list close 5.98 -> 4.51 ms (looks summed over threads 16.5 -> 23.7) | 8 each way | | LOOK_QUIET | slots looked at 16,300 -> 14,200; looks 4.6 -> 4.2; wait 4.5 -> 4.2 | 6 each way | | FORGET_AFTER | looks 5.38 -> 5.10, wait 5.46 -> 5.10 | 8 each way | | SPANS_WIDE | spans stage 1.42 -> 1.28 | 8 each way | All together: looks 6.2 -> 4.2 ms, spans 1.35 -> 1.2 ms, wait at the list's close 6.3-6.6 -> 4.2 ms. **In this card-bound scene the frame time does not move.** The gains are in the processor stages named above. Not measured: scenes other than the street; about 1 ms of the spans stage is still unexplained. To restore the old behaviour: `VICTORY_VIEW_THREADS=4`, `VICTORY_HEAP_LOOK_QUIET=0`, `VICTORY_HEAP_FORGET_AFTER=0`, `VICTORY_HEAP_SPANS_WIDE=0`. Shader cache / translator key: not affected (no `victory-shader` change). Tests: `draw::heap_range_tests` (3 pass, one new). Clippy on `victory-gpu` is clean apart from the five errors main already has (#4152). The rest of `draw::` aborts on the test PC (Windows 10, no Shader Model 6.6), as on main.
The pass over the view heap's buffer views runs beside the recording, and
the list that began it waits for it at its close: 6.0 to 6.6 ms a frame in
the street scene (16,500 slots looked at a frame, 7,100 of them written
since the pass before; 114,000 views kept in 4,700 host copies).

Measured within one run, switches flipped every 10 s, eight phases each way
(20261201-043045-cg-ab-v2, RTX 3090, 32 threads, 2560x1440, DLSS off), per
frame:

- the looks on eight threads for four (VICTORY_VIEW_THREADS, now 8): the
  looks 5.77 -> 4.67 ms, the wait at the list's close 5.98 -> 4.51 ms; the
  looks' time summed over their threads 16.5 -> 23.7 ms.
- a pass forgets what it did not find of its part once it has looked,
  where it forgot the whole part first and put it back slot by slot
  (VICTORY_HEAP_FORGET_AFTER, on): the looks 5.38 -> 5.10 ms, the wait
  5.46 -> 5.10 ms. The same views are kept, slot for slot.
- the spans of the copies found on four threads, each copy's views all by
  one of them (VICTORY_HEAP_SPANS_WIDE, on): that stage 1.42 -> 1.28 ms.
  Less than expected: the table of copies is not most of the stage.
- VICTORY_HEAP_LOOK_QUIET on by default: the pass's own look of a slot put
  the slot back in the written set, so every written slot was looked at
  again a pass later for what the pass had just noted; writes of the
  title's and draws' looks are on other threads and put it there as
  before. 14,200 slots looked at a frame for 16,300, the looks 4.2 ms for
  4.6, the wait at the list's close 4.2 ms for 4.5
  (20261201-074544-cg-ab-v3, six phases of 12 s each way).

With all four the pass is 4.2 ms of looks and 1.2 ms of spans a frame, and
the list waits 4.2 ms for it; before, 6.2, 1.35 and 6.3 to 6.6. The frame
time itself does not move there: the scene is bound by the card.

The spans' table keeps upstream's `shadow::heap_used` note (issue 4036),
now made in `spans_of` as each copy's entry is first made, on whichever
thread finds it.

Diagnostics: the pass's counts and the looks' time by kind of slot, in a
frame line of their own.

Tests: draw::heap_range_tests, with one new
(a_slot_of_the_part_not_looked_at_is_forgotten).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 12:32:07 +00:00
github-bot closed this pull request 2026-12-01 18:30:43 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:29 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4875#issuecomment-7321038819) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4876
No description provided.