Root views per list state: VICTORY_ROOT_SAME binds a root SRV or CBV the list bound before at the same epoch and buffer count without looking it up and asking its refresh again #1722

Merged
101Leafy merged 4 commits from upstream-pr/1722 into main 2026-11-29 08:16:54 +00:00
101Leafy commented 2026-11-28 23:43:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 101Leafy on 2026-11-28T23:43:27Z.


Every root SRV or CBV a draw binds goes through root_view: it finds the buffer's host copy, works out the length, and asks for that range to be brought up to date. Most draws bind the same root views the draw before them bound, so the list does that same lookup and the same refresh request over and over.

With VICTORY_ROOT_SAME=1 the list state remembers each root view it bound at an aligned address, keyed by address and kind, together with the list epoch and the count of buffer table changes. If the same view comes again while both are unchanged, it gets the same GPU address back without a lookup, because the refresh it already asked for still covers it. Constant buffers that go to scratch or a placed constant are never remembered. The memory is cleared on every reset. Two diagnostics counters show the hits and the lookups.

It is off by default. With the switch unset, every root view is looked up as before.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5545728354 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1722). Originally posted by [101Leafy](https://github.com/101Leafy) on 2026-11-28T23:43:27Z. --- Every root SRV or CBV a draw binds goes through root_view: it finds the buffer's host copy, works out the length, and asks for that range to be brought up to date. Most draws bind the same root views the draw before them bound, so the list does that same lookup and the same refresh request over and over. With VICTORY_ROOT_SAME=1 the list state remembers each root view it bound at an aligned address, keyed by address and kind, together with the list epoch and the count of buffer table changes. If the same view comes again while both are unchanged, it gets the same GPU address back without a lookup, because the refresh it already asked for still covers it. Constant buffers that go to scratch or a placed constant are never remembered. The memory is cleared on every reset. Two diagnostics counters show the hits and the lookups. It is off by default. With the switch unset, every root view is looked up as before.
eleboucher commented 2026-11-29 04:18:58 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by eleboucher on 2026-11-29T04:18:58Z.


PC result: RTX 4070 Ti SUPER 16 GB, Ryzen 7 9800X3D, 16 GB RAM, Windows 11, native 1440p, VICTORY_BVH_BUILDER=1 VICTORY_ACTIVATE_RAYS=1, diagnostics build of main 568c5e5d plus this PR and a few others, 10-minute run each, medians after 200 s.

fps preparing
switch off 24.8 29.3 ms
VICTORY_ROOT_SAME=1 24.8 30.4 ms

With the switch on, the counters stay at 0 for the whole run: root views, per frame: 0 bound as the list bound them before, 0 looked up. So State::root_view is never reached in this title. Its root views seem to go through root_srv_table (the tabled branch in draw.rs, just before the self.root_view call), so the cache has nothing to do here.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7250578750 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1722#issuecomment-7250578750). Originally posted by [eleboucher](https://github.com/eleboucher) on 2026-11-29T04:18:58Z. --- PC result: RTX 4070 Ti SUPER 16 GB, Ryzen 7 9800X3D, 16 GB RAM, Windows 11, native 1440p, `VICTORY_BVH_BUILDER=1 VICTORY_ACTIVATE_RAYS=1`, diagnostics build of main 568c5e5d plus this PR and a few others, 10-minute run each, medians after 200 s. | | fps | preparing | |---|---|---| | switch off | 24.8 | 29.3 ms | | `VICTORY_ROOT_SAME=1` | 24.8 | 30.4 ms | With the switch on, the counters stay at 0 for the whole run: `root views, per frame: 0 bound as the list bound them before, 0 looked up`. So `State::root_view` is never reached in this title. Its root views seem to go through `root_srv_table` (the `tabled` branch in `draw.rs`, just before the `self.root_view` call), so the cache has nothing to do here.
Sign in to join this conversation.
No reviewers
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
trustno1-coder/VIctory-NVIDIA!1722
No description provided.