RTX 3060 + Ryzen 5 5500, Series S: measurements on the view-heap ring / frame allocator pool, why shared or in-place descriptors break #3980

Open
opened 2026-11-30 13:40:36 +00:00 by github-bot · 0 comments
Owner

@⁠FactorOfTheThird on GitHub · 2026-11-30 13:35 UTC · original

I tried three ways to stop building fresh descriptor tables per draw for the title's view-heap "ring" (slots ≥ 360,448): a modulo ring fold, a constants-prefix DMA mirror, and a guest-slot → host-slot indirection map read by shaders. All three failed live. Below are the measurements that explain why, and a few others that may save someone else the time.

Setup. Ryzen 5 5500, RTX 3060 12 GB (driver 616.56), Series S profile, DLSS Performance 960×540 → 1080p, release builds, route from Jason's house to Vice City.

1. The ring is the title's frame allocator pool. It's 216 pages × 128 KiB = 27 MiB = 884,736 slots. Each page header holds a frame stamp at +0x50 and a fill pointer at +0x48. The title cycles the whole pool every ~2 frames, so a fixed fold onto the ~607k spare host slots can't fit.

Log: 7-frame-allocator-samples.txt

2. Only a small part of the pool is descriptors. I scanned every changed pool page, not just the mirrored prefix heap sync looks at:

  • 555–643k view records present at any time
  • kind 0 (view table entries): ~1.4–1.9k distinct
  • constant buffers: ~12–19k distinct
  • placed views: ~78–95k distinct

That's ~100k distinct in total. One host slot per distinct view fits easily; one per record does not.

Log: 1-pool-records-by-kind.txt

3. The title rewrites pool slots before VIctory sends the lists that read them. I stamped each table read with its recording, then mapped recording → host submission → completion. At each title rewrite of a pool record, the last reader was:

  • not yet sent to the card: 15.2% (~13–22k a frame)
  • sent and still running: ~0%
  • finished: 84.7%

Log: 2-rewrite-reader-state.txt

So once a list is submitted, the card finishes before the title comes back. The hazard is the window between thin translation and the async submission line (~15 submissions deep). Per-draw fresh tables are correct because they copy at translation. Anything that reads descriptors in place at GPU time goes wrong. An indirection map built this way (99.9% of pool tables through the map, still 100% agreement with draw-time records at the next heap sync) produced heavy corruption live: static textures, black flicker, colored trapezoids, and broken physics.

Log of the corrupted run: 3-indirection-map-live.txt

Caveat: recordings the title never submits also count as "not sent"; I didn't separate them.

4. Side lead (untested). Slots 360,448–606,782 are mirrored 1:1 in place by heap sync today. By (3), a list waiting in the line can read the next record written there. That might explain some of the black/wrong texture reports.

5. Content reuse of fresh tables is limited. Of ~10k fresh tables a frame, ~90% hold a constant buffer, averaging 6.5 slots. Same content as a table made within 4 frames: 28.5%.

Log: 4-fresh-table-reuse.txt

6. VICTORY_SHADER_OPT WIDE on NVIDIA: no gain. 91% of shader time is in pipelines doing single-dword raw loads of constants (183k of 193k raw loads; only 1,736 cbuffer loads per frame). But a retranslated replay A/B showed 40.46 → 40.35 ms, with bit-identical output. The NVIDIA driver merges the loads too, same as the RX 7900 XTX result in opt.rs.

Log: 5-wide-loads-replay-ab.txt

7. Shader cost is flat. In the GPU frame, the top 10 of 1,214 pipelines are 24% of shader time, and the top single one is 1.6 ms. One noticeable pattern: packed fp16 maths is emulated through legacyF16ToF32/F32ToF16, including constants like 1.0. That's in 61% of shader time but only 4% of calls.

Log: 6-shader-cost-top.txt

Where I'd go from here. Anything that lets the GPU read pool descriptors in place, whether a fold, a map or 1:1 mirroring, has to deal with (3) first. Either every submission gets its own snapshot of what it reads, which is roughly what fresh tables already cost, or the window between translating a list and sending it shrinks to nothing. Without one of those, these ideas will keep looking right in counters and break on screen. The cheapest useful next step is probably testing (4): route slots 360,448–606,782 through fresh tables behind a switch and see whether the black textures go away.

The harder truth: on a 6-core CPU this is CPU-bound at ~11–14 fps (the overlay agrees: "limit: your CPU"), and the per-draw copying is the price of translating lists off the title's threads, not a bug to optimise away. I don't think tuning gets past that. The big win would be deciding where memory lives when the title allocates it, so it doesn't have to be found and copied afterwards. That needs the allocators reverse-engineered, which is a project, not a patch.

**@⁠FactorOfTheThird** on GitHub · 2026-11-30 13:35 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3980) I tried three ways to stop building fresh descriptor tables per draw for the title's view-heap "ring" (slots ≥ 360,448): a modulo ring fold, a constants-prefix DMA mirror, and a guest-slot → host-slot indirection map read by shaders. All three failed live. Below are the measurements that explain why, and a few others that may save someone else the time. **Setup.** Ryzen 5 5500, RTX 3060 12 GB (driver 616.56), Series S profile, DLSS Performance 960×540 → 1080p, release builds, route from Jason's house to Vice City. **1. The ring is the title's frame allocator pool.** It's 216 pages × 128 KiB = 27 MiB = 884,736 slots. Each page header holds a frame stamp at +0x50 and a fill pointer at +0x48. The title cycles the whole pool every ~2 frames, so a fixed fold onto the ~607k spare host slots can't fit. Log: [7-frame-allocator-samples.txt](https://github.com/user-attachments/files/35620668/7-frame-allocator-samples.txt) **2. Only a small part of the pool is descriptors.** I scanned every changed pool page, not just the mirrored prefix heap sync looks at: - 555–643k view records present at any time - kind 0 (view table entries): **~1.4–1.9k distinct** - constant buffers: ~12–19k distinct - placed views: ~78–95k distinct That's ~100k distinct in total. One host slot per distinct view fits easily; one per record does not. Log: [1-pool-records-by-kind.txt](https://github.com/user-attachments/files/35620670/1-pool-records-by-kind.txt) **3. The title rewrites pool slots before VIctory sends the lists that read them.** I stamped each table read with its recording, then mapped recording → host submission → completion. At each title rewrite of a pool record, the last reader was: - **not yet sent to the card: 15.2%** (~13–22k a frame) - sent and still running: ~0% - finished: 84.7% Log: [2-rewrite-reader-state.txt](https://github.com/user-attachments/files/35620672/2-rewrite-reader-state.txt) So once a list is submitted, the card finishes before the title comes back. The hazard is the window between thin translation and the async submission line (~15 submissions deep). Per-draw fresh tables are correct because they copy at translation. Anything that reads descriptors in place at GPU time goes wrong. An indirection map built this way (99.9% of pool tables through the map, still 100% agreement with draw-time records at the next heap sync) produced heavy corruption live: static textures, black flicker, colored trapezoids, and broken physics. Log of the corrupted run: [3-indirection-map-live.txt](https://github.com/user-attachments/files/35620673/3-indirection-map-live.txt) Caveat: recordings the title never submits also count as "not sent"; I didn't separate them. **4. Side lead (untested).** Slots 360,448–606,782 are mirrored 1:1 in place by heap sync today. By (3), a list waiting in the line can read the next record written there. That might explain some of the black/wrong texture reports. **5. Content reuse of fresh tables is limited.** Of ~10k fresh tables a frame, ~90% hold a constant buffer, averaging 6.5 slots. Same content as a table made within 4 frames: **28.5%**. Log: [4-fresh-table-reuse.txt](https://github.com/user-attachments/files/35620669/4-fresh-table-reuse.txt) **6. `VICTORY_SHADER_OPT` WIDE on NVIDIA: no gain.** 91% of shader time is in pipelines doing single-dword raw loads of constants (183k of 193k raw loads; only 1,736 cbuffer loads per frame). But a retranslated replay A/B showed 40.46 → 40.35 ms, with bit-identical output. The NVIDIA driver merges the loads too, same as the RX 7900 XTX result in `opt.rs`. Log: [5-wide-loads-replay-ab.txt](https://github.com/user-attachments/files/35620674/5-wide-loads-replay-ab.txt) **7. Shader cost is flat.** In the GPU frame, the top 10 of 1,214 pipelines are 24% of shader time, and the top single one is 1.6 ms. One noticeable pattern: packed fp16 maths is emulated through `legacyF16ToF32`/`F32ToF16`, including constants like 1.0. That's in 61% of shader time but only 4% of calls. Log: [6-shader-cost-top.txt](https://github.com/user-attachments/files/35620671/6-shader-cost-top.txt) **Where I'd go from here.** Anything that lets the GPU read pool descriptors in place, whether a fold, a map or 1:1 mirroring, has to deal with (3) first. Either every submission gets its own snapshot of what it reads, which is roughly what fresh tables already cost, or the window between translating a list and sending it shrinks to nothing. Without one of those, these ideas will keep looking right in counters and break on screen. The cheapest useful next step is probably testing (4): route slots 360,448–606,782 through fresh tables behind a switch and see whether the black textures go away. The harder truth: on a 6-core CPU this is CPU-bound at ~11–14 fps (the overlay agrees: "limit: your CPU"), and the per-draw copying is the price of translating lists off the title's threads, not a bug to optimise away. I don't think tuning gets past that. The big win would be deciding where memory lives when the title allocates it, so it doesn't have to be found and copied afterwards. That needs the allocators reverse-engineered, which is a project, not a patch.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 13:40:36 +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#3980
No description provided.