raw_twins=false hosts (NVIDIA, 1M view heap): list views still make a raw twin of each buffer view (~12k-18k a frame) that no shader reads; the frame line's ~500-650 "null" twins a frame are not a rendering bug there #3807

Open
opened 2026-11-30 07:45:29 +00:00 by github-bot · 0 comments
Owner

@⁠Robotniq on GitHub · 2026-11-30 07:43 UTC · original

System

GPU NVIDIA GeForce RTX 3070 Ti 8 GB (wave32), driver 621.40 (as Streamline reports it)
CPU / RAM i7-13700F, 32 GB
OS Windows 11 (10.0.26200)
Build diagnostics build (--profile diag --features diagnostics) of 41adb551 (v2026.11.29.05), plus a few local commits that do not touch the code cited below (crates/victory-gpu/src/descriptor/ is identical to 41adb551)
Profile Series S, DLSS Quality, frame generation off
View heap views=1000000 raw_twins=false

Summary

On this card the frame line says ~500-650 raw twins a frame (median) do not begin on 16 bytes, and that every one of them is null. That looks like what #2248 found on AMD: shaders reading zeros. On a 1M-capped heap it isn't that. Raw twins are off (raw_twins=false), so the heap has no twin region and translated shaders read the title's slots in place. The twins being counted come from make_listed, which always makes a twin for a list view, and they are never copied to a slot a shader reads.

So on these hosts the line is misleading, and making the twins is wasted descriptor work: about 12,000-18,500 extra buffer views a frame here (session means), plus a null view for each unaligned one (about 3.5-4 % of them).

We found this by reading logs and code, not from a visual bug. We first read the line as a rendering bug, but the code says it is not one on this host.

Evidence

Example frame line:

2026-11-30T03:36:51.867285Z  INFO victory_gpu::descriptor: raw twins of buffer views made per frame (VICTORY_RAW_VIEWS=0: none): 17601, of them 706.5 that do not begin on 16 bytes (706.5 null)

The heap line is the same in every session:

host view heaps hold 1000000 views; view indices are clamped to the null slot at the end from the first shader on views=1000000 raw_twins=false

The table covers four sessions with our usual launcher settings. None of VICTORY_RAW_VIEWS, VICTORY_LIST_VIEWS, VICTORY_VIEW_COPY or VICTORY_PORT_CBV is set. Only frame lines with at least 5,000 twins a frame are counted, as a rough cut that drops menus and loading:

session lines twins/frame, mean off 16 bytes (= null) per frame: median (p10-p90), max
1 1,203 18,502 648.5 (549.7-944.7), 1,157.9
2 543 16,002 496.6 (329.6-872.5), 972.6
3 149 11,906 492.2 (203.2-700.8), 858.3
4 116 11,713 495.3 (187.7-650.2), 679.9

Across all ten sessions that day (6,972 frame lines, some sessions with test switches), the "do not begin on 16 bytes" count equals the null count in every line. No twin was ever moved.

Where in the code (at 41adb551)

  • crates/victory-gpu/src/descriptor/host.rs:2899: let twins = raw_twins() && fits(2 * RAW_TWINS); needs a shader-visible heap of 2^22 views (RAW_TWINS = 2^21). The driver caps heaps at 1,000,000, so set_raw_views is never called (:2901) and victory_shader::emit::raw_views() stays 0. With raw == 0 the heap's twins vector is empty (:3136), so HostHeap::twin() (:5014) is None for every slot.
  • crates/victory-shader/src/emit/lower.rs:8303-8315 (raw_twin): let first = super::shader::raw_views(); ... if first == 0 || ... { return (index, false); }. Without raw views, shaders keep the title's index and never address a twin.
  • host.rs:4973 (in make_listed): make_twinned(&view, views.slot(at), Some(views.slot(at + 1))) always passes a twin slot. At :4950-4957 the twin is copied into the heap only if made.twin && twins. Here twins (self.twins.get(index).is_some()) is false, so the code goes to clear_twin instead, which does nothing. The other make_twinned callers (:4919, :5572) pass self.twin(index), which is None here. So every twin counted on this host is a list view's.
  • host.rs:6188 (in buffer_srv) and :6312 (in buffer_uav):
    if by > 0 && !(staged(false, 1).is_some_and(|s| s.ptr == twin.ptr) && move_raw(twin, start, count.saturating_mul(4), by)) {
        TWINS[2].fetch_add(1, std::sync::atomic::Ordering::Relaxed);
        null_buffer_view(twin);
    }
    
    A list view's twin is in views.slot(at + 1), never in the staged slot, so move_raw is never tried for it, on any vendor. move_raw (:6044) also only recognises an AMD raw-buffer descriptor (address in words 0-1, size in word 2).
  • The counters (TWINS, host.rs:6036) are printed by crates/victory-gpu/src/descriptor.rs:971-978 (sync_line) whenever any twin was made, whether or not the heap has twins. By the same code, the line's own label "(VICTORY_RAW_VIEWS=0: none)" is not right either. With VICTORY_RAW_VIEWS=0 the heap has no twins, as here, but list views still make and count them. We did not run with that switch.
  • Each list view takes two of the ListViews::SLOTS (8,192, host.rs:10349) slots; the second is for its twin.

A possible change, not tried: in make_listed, pass None as the twin when raw_views() == 0, and only count or print the twin line when raw views are on. The global raw_views() looks safer than self.twins.is_empty(). The list-view cache is per thread and keyed by the record, not by the heap, so an entry made for one heap can be copied into another. Hosts that do have twins would be unchanged. Optionally, list views could take one slot instead of two there.

  • #2248 (open) lets move_raw fix unaligned list-view twins in place. It was tested on an RX 9070 XT (~870 null a frame down to 0), and #1165 confirms the AMD tree flicker is gone with it.
  • ProjectLeonida/mandy 1bb188cf5, "d3d12: raw twins off 16 bytes kept with a bias the shaders add (LEONIDA_TWIN_BIAS)", does not move the descriptor. It makes the twin from the multiple of 16 below the view and stores the 0-15 bytes it starts early by in bits 24..27 of the slot's stride word. Translated programs add that bias to their offsets through the table of strides. This does not depend on the driver's descriptor layout: on its RX 6800 the CPU handles held host pointers, so move_raw never applied. It was tested only on an RX 6800 (0 null and up to ~1,100 biased a frame); whether the flicker is gone was not confirmed.
  • Neither of these changes what shaders read on a raw_twins=false host, because shaders there don't read twins. #3396 describes the same raw_views() == 0 state on NVIDIA for constant buffers. By this reading of the code, #2248's descriptor part should not change what is drawn on NVIDIA, so NVIDIA reports of the tree flicker (#1165 on an RTX 3080, #3142 on an RTX 5070 Ti) would need another cause. That is an inference from code; we did not test it.
  • For scale only: #1338's profile on an RTX 2070 SUPER has make_listed at 30.1 %, make_twinned at 12.5 % and buffer_srv at 8.1 % of the list threads' samples, with ~9.6k twins a frame. Those percentages are inclusive and cover the main views too, so the twins' share is not known. #3102 (open) reuses list views across recordings, which would cut the count, but it still makes a twin for each.

What is not known

  • We don't claim any visual effect. Nothing we saw on screen is tied to these twins, and the code says shaders on this host don't read them.
  • We did not measure the CPU cost of the extra twin views.
  • We did not check whether in-place reads are right on this host for views that don't begin on 16 bytes. One example is the structured view of 8-byte elements at offset 8 that 3711fdad456538a1 reads as raw bytes, which the raw_twin comment names. That is a different path from the twins.
  • We did not check whether move_raw would recognise NVIDIA descriptors, or whether a recording ever fills the 8,192 list-view slots.
**@⁠Robotniq** on GitHub · 2026-11-30 07:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3807) ### System | | | |---|---| | GPU | NVIDIA GeForce RTX 3070 Ti 8 GB (wave32), driver 621.40 (as Streamline reports it) | | CPU / RAM | i7-13700F, 32 GB | | OS | Windows 11 (10.0.26200) | | Build | diagnostics build (`--profile diag --features diagnostics`) of 41adb551 (v2026.11.29.05), plus a few local commits that do not touch the code cited below (`crates/victory-gpu/src/descriptor/` is identical to 41adb551) | | Profile | Series S, DLSS Quality, frame generation off | | View heap | `views=1000000 raw_twins=false` | ### Summary On this card the frame line says ~500-650 raw twins a frame (median) do not begin on 16 bytes, and that every one of them is null. That looks like what #2248 found on AMD: shaders reading zeros. On a 1M-capped heap it isn't that. Raw twins are off (`raw_twins=false`), so the heap has no twin region and translated shaders read the title's slots in place. The twins being counted come from `make_listed`, which always makes a twin for a list view, and they are never copied to a slot a shader reads. So on these hosts the line is misleading, and making the twins is wasted descriptor work: about 12,000-18,500 extra buffer views a frame here (session means), plus a null view for each unaligned one (about 3.5-4 % of them). We found this by reading logs and code, not from a visual bug. We first read the line as a rendering bug, but the code says it is not one on this host. ### Evidence Example frame line: ``` 2026-11-30T03:36:51.867285Z INFO victory_gpu::descriptor: raw twins of buffer views made per frame (VICTORY_RAW_VIEWS=0: none): 17601, of them 706.5 that do not begin on 16 bytes (706.5 null) ``` The heap line is the same in every session: ``` host view heaps hold 1000000 views; view indices are clamped to the null slot at the end from the first shader on views=1000000 raw_twins=false ``` The table covers four sessions with our usual launcher settings. None of `VICTORY_RAW_VIEWS`, `VICTORY_LIST_VIEWS`, `VICTORY_VIEW_COPY` or `VICTORY_PORT_CBV` is set. Only frame lines with at least 5,000 twins a frame are counted, as a rough cut that drops menus and loading: | session | lines | twins/frame, mean | off 16 bytes (= null) per frame: median (p10-p90), max | |---|---|---|---| | 1 | 1,203 | 18,502 | 648.5 (549.7-944.7), 1,157.9 | | 2 | 543 | 16,002 | 496.6 (329.6-872.5), 972.6 | | 3 | 149 | 11,906 | 492.2 (203.2-700.8), 858.3 | | 4 | 116 | 11,713 | 495.3 (187.7-650.2), 679.9 | Across all ten sessions that day (6,972 frame lines, some sessions with test switches), the "do not begin on 16 bytes" count equals the null count in every line. No twin was ever moved. ### Where in the code (at 41adb551) - `crates/victory-gpu/src/descriptor/host.rs:2899`: `let twins = raw_twins() && fits(2 * RAW_TWINS);` needs a shader-visible heap of 2^22 views (`RAW_TWINS` = 2^21). The driver caps heaps at 1,000,000, so `set_raw_views` is never called (`:2901`) and `victory_shader::emit::raw_views()` stays 0. With `raw == 0` the heap's `twins` vector is empty (`:3136`), so `HostHeap::twin()` (`:5014`) is `None` for every slot. - `crates/victory-shader/src/emit/lower.rs:8303-8315` (`raw_twin`): `let first = super::shader::raw_views(); ... if first == 0 || ... { return (index, false); }`. Without raw views, shaders keep the title's index and never address a twin. - `host.rs:4973` (in `make_listed`): `make_twinned(&view, views.slot(at), Some(views.slot(at + 1)))` always passes a twin slot. At `:4950-4957` the twin is copied into the heap only `if made.twin && twins`. Here `twins` (`self.twins.get(index).is_some()`) is false, so the code goes to `clear_twin` instead, which does nothing. The other `make_twinned` callers (`:4919`, `:5572`) pass `self.twin(index)`, which is `None` here. So every twin counted on this host is a list view's. - `host.rs:6188` (in `buffer_srv`) and `:6312` (in `buffer_uav`): ```rust if by > 0 && !(staged(false, 1).is_some_and(|s| s.ptr == twin.ptr) && move_raw(twin, start, count.saturating_mul(4), by)) { TWINS[2].fetch_add(1, std::sync::atomic::Ordering::Relaxed); null_buffer_view(twin); } ``` A list view's twin is in `views.slot(at + 1)`, never in the staged slot, so `move_raw` is never tried for it, on any vendor. `move_raw` (`:6044`) also only recognises an AMD raw-buffer descriptor (address in words 0-1, size in word 2). - The counters (`TWINS`, `host.rs:6036`) are printed by `crates/victory-gpu/src/descriptor.rs:971-978` (`sync_line`) whenever any twin was made, whether or not the heap has twins. By the same code, the line's own label "(VICTORY_RAW_VIEWS=0: none)" is not right either. With `VICTORY_RAW_VIEWS=0` the heap has no twins, as here, but list views still make and count them. We did not run with that switch. - Each list view takes two of the `ListViews::SLOTS` (8,192, `host.rs:10349`) slots; the second is for its twin. A possible change, not tried: in `make_listed`, pass `None` as the twin when `raw_views() == 0`, and only count or print the twin line when raw views are on. The global `raw_views()` looks safer than `self.twins.is_empty()`. The list-view cache is per thread and keyed by the record, not by the heap, so an entry made for one heap can be copied into another. Hosts that do have twins would be unchanged. Optionally, list views could take one slot instead of two there. ### Related - #2248 (open) lets `move_raw` fix unaligned list-view twins in place. It was tested on an RX 9070 XT (~870 null a frame down to 0), and #1165 confirms the AMD tree flicker is gone with it. - ProjectLeonida/mandy 1bb188cf5, "d3d12: raw twins off 16 bytes kept with a bias the shaders add (LEONIDA_TWIN_BIAS)", does not move the descriptor. It makes the twin from the multiple of 16 below the view and stores the 0-15 bytes it starts early by in bits 24..27 of the slot's stride word. Translated programs add that bias to their offsets through the table of strides. This does not depend on the driver's descriptor layout: on its RX 6800 the CPU handles held host pointers, so `move_raw` never applied. It was tested only on an RX 6800 (0 null and up to ~1,100 biased a frame); whether the flicker is gone was not confirmed. - Neither of these changes what shaders read on a `raw_twins=false` host, because shaders there don't read twins. #3396 describes the same `raw_views() == 0` state on NVIDIA for constant buffers. By this reading of the code, #2248's descriptor part should not change what is drawn on NVIDIA, so NVIDIA reports of the tree flicker (#1165 on an RTX 3080, #3142 on an RTX 5070 Ti) would need another cause. That is an inference from code; we did not test it. - For scale only: #1338's profile on an RTX 2070 SUPER has `make_listed` at 30.1 %, `make_twinned` at 12.5 % and `buffer_srv` at 8.1 % of the list threads' samples, with ~9.6k twins a frame. Those percentages are inclusive and cover the main views too, so the twins' share is not known. #3102 (open) reuses list views across recordings, which would cut the count, but it still makes a twin for each. ### What is not known - We don't claim any visual effect. Nothing we saw on screen is tied to these twins, and the code says shaders on this host don't read them. - We did not measure the CPU cost of the extra twin views. - We did not check whether in-place reads are right on this host for views that don't begin on 16 bytes. One example is the structured view of 8-byte elements at offset 8 that `3711fdad456538a1` reads as raw bytes, which the `raw_twin` comment names. That is a different path from the twins. - We did not check whether `move_raw` would recognise NVIDIA descriptors, or whether a recording ever fills the 8,192 list-view slots.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 07:45:31 +00:00
This discussion has been locked. Commenting is limited to contributors.
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#3807
No description provided.