RTX 5090 / Linux: ~25 ms of CPU per frame caps play at ~27 fps; 87% of refresh checks copy nothing, and sampled-slot marks cost up to 31 ms of card time in one shader #473

Open
opened 2026-11-30 19:44:33 +00:00 by github-bot · 3 comments
Owner

@⁠zmelumian972 on GitHub · 2026-11-30 19:43 UTC · original

Setup. As in the cache issue: CachyOS, RTX 5090 32 GB (driver 620.73.04), Ryzen 7 9800X3D, 62 GB, GE-Proton11-14, main adaa77a3 release, vice-tay play --res 1440 --dlss off --set VICE_TAY_CODE_TABLE_AFTER=1 --set VICE_TAY_LIBRARY=0, saved game in the world. Pipelines warm (no compiles, 0 pipeline waits).

Where a frame goes (steady play, run 13, 5 s reports)

Mean 27.0 fps. Per frame:

ms
Submitting thread preparing (preparing per frame, the submitting thread) 21-26
… refreshes ("in the lists' steps") 7.8-9.4, in 38-42 flushes of ~10,000 refreshes, 8,700-9,000 of them "known to copy nothing"
… copies in the card's memory 3.0-3.4
… asking the write watch 2.4
… planning steps done on the card 2.1-2.2
… waiting for the heaps' records 1.0-1.7
Copying back (relay thread, beside it) 7-9
Card time of the title's lists (card meter) 16.7 mean

So the submitting thread is the limit, and its largest single item is establishing that ~9,000 ranges a frame have not changed. Data actually moved is ~45 MB a frame.

The GPU is not saturated either. Nsight Systems GPU metrics (gb20x, 30 s of play, run 9) while the card had work (GR Active 92%): SMs Active 39%, SM Issue 11%, compute warps in flight 9% of capacity, DRAM read 3%, PCIe RX 6%. Power 220-290 W of 500 W. So the card is fed many small, serialized jobs (4,000-5,000 draws and ~4,600 indirect executions per frame; VICE_TAY_INDIRECT_MERGE reports 0 that could join) rather than heavy shaders.

Sampled-slot marks in a heavy compute shader

In one area fps fell to 8-9. The card meter showed compute 2561af9577c47289 at 31-33 ms a frame (one list). Its translation (VICE_TAY_SHADER_SAVE, 24,664-byte container → 331 KB DXIL) has no code table; it has 141 sampleLevel and 154 atomicBinOp (Or), all into u251 (SLOT_SAMPLED): each sample does a rawBufferLoad, a test and an atomic Or behind WaveIsFirstLane. VICE_TAY_SAMPLED_MARKS=1 is in play.rs SETTINGS; VICE_TAY_SAMPLED_EVICT was 0 in these runs.

A/B with VICE_TAY_SAMPLED_MARKS=0 (warm, same route): mean fps 27.0 → 26.5 (no change: the CPU limit above dominates), but the worst frame cost of 2561af… was 4.7 ms against 32.8 ms with marks on. Those are different moments of play, so this is a strong hint, not a controlled measurement. No texture problems were noticed with marks off on this 32 GB card; the marks feed texture priority since 739f8339, which matters more on small cards.

Suggestions

  1. Refreshes: skip ranges known clean before queuing them (or keep a per-range clean bit cleared by the write watch), so the ~9,000 no-op refreshes a frame cost nothing.
  2. Sampled marks: mark each heap slot once per shader invocation (dedupe by handle) instead of at every sample, or make them opt-in only where slot_evict needs them.

Related: #267 (submitting thread at 65 ms on a 5070 Ti), #36, #88. Logs and the Nsight report are kept locally.

**@⁠zmelumian972** on GitHub · 2026-11-30 19:43 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/473) **Setup.** As in the cache issue: CachyOS, RTX 5090 32 GB (driver 620.73.04), Ryzen 7 9800X3D, 62 GB, GE-Proton11-14, `main` `adaa77a3` release, `vice-tay play --res 1440 --dlss off --set VICE_TAY_CODE_TABLE_AFTER=1 --set VICE_TAY_LIBRARY=0`, saved game in the world. Pipelines warm (no compiles, 0 pipeline waits). ### Where a frame goes (steady play, run 13, 5 s reports) Mean 27.0 fps. Per frame: | | ms | |---|---| | Submitting thread preparing (`preparing per frame, the submitting thread`) | 21-26 | | … refreshes ("in the lists' steps") | 7.8-9.4, in 38-42 flushes of **~10,000 refreshes, 8,700-9,000 of them "known to copy nothing"** | | … copies in the card's memory | 3.0-3.4 | | … asking the write watch | 2.4 | | … planning steps done on the card | 2.1-2.2 | | … waiting for the heaps' records | 1.0-1.7 | | Copying back (relay thread, beside it) | 7-9 | | Card time of the title's lists (card meter) | 16.7 mean | So the submitting thread is the limit, and its largest single item is establishing that ~9,000 ranges a frame have not changed. Data actually moved is ~45 MB a frame. The GPU is not saturated either. Nsight Systems GPU metrics (`gb20x`, 30 s of play, run 9) while the card had work (GR Active 92%): **SMs Active 39%, SM Issue 11%**, compute warps in flight 9% of capacity, DRAM read 3%, PCIe RX 6%. Power 220-290 W of 500 W. So the card is fed many small, serialized jobs (4,000-5,000 draws and ~4,600 indirect executions per frame; `VICE_TAY_INDIRECT_MERGE` reports 0 that could join) rather than heavy shaders. ### Sampled-slot marks in a heavy compute shader In one area fps fell to 8-9. The card meter showed `compute 2561af9577c47289` at **31-33 ms a frame** (one list). Its translation (`VICE_TAY_SHADER_SAVE`, 24,664-byte container → 331 KB DXIL) has no code table; it has 141 `sampleLevel` and 154 `atomicBinOp` (Or), all into `u251` (`SLOT_SAMPLED`): each sample does a `rawBufferLoad`, a test and an atomic Or behind `WaveIsFirstLane`. `VICE_TAY_SAMPLED_MARKS=1` is in `play.rs` SETTINGS; `VICE_TAY_SAMPLED_EVICT` was 0 in these runs. A/B with `VICE_TAY_SAMPLED_MARKS=0` (warm, same route): mean fps 27.0 → 26.5 (no change: the CPU limit above dominates), but the worst frame cost of `2561af…` was **4.7 ms** against 32.8 ms with marks on. Those are different moments of play, so this is a strong hint, not a controlled measurement. No texture problems were noticed with marks off on this 32 GB card; the marks feed texture priority since 739f8339, which matters more on small cards. ### Suggestions 1. Refreshes: skip ranges known clean before queuing them (or keep a per-range clean bit cleared by the write watch), so the ~9,000 no-op refreshes a frame cost nothing. 2. Sampled marks: mark each heap slot once per shader invocation (dedupe by handle) instead of at every sample, or make them opt-in only where `slot_evict` needs them. Related: #267 (submitting thread at 65 ms on a 5070 Ti), #36, #88. Logs and the Nsight report are kept locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 19:44:33 +00:00
Author
Owner

@⁠zmelumian972 on GitHub · 2026-11-30 21:29 UTC · original

Sampled marks (suggestion 2): tried, no measurable gain

Change tested (local branch, not pushed): marks are made once per descriptor load at the end of each IR block instead of after every image instruction. On compute 2561af9577c47289, translated as on a 32-lane host (the game's 330 KB DXIL), that is 271 marks → 140, DXIL 329,952 → 316,704 bytes. Skipping loads already marked in a dominating block saved nothing more.

A/B (RTX 5090, Linux, 1440p, DLSS off, VICE_TAY_CODE_TABLE_AFTER=1 VICE_TAY_LIBRARY=0, VICE_TAY_CARD_METER_PIPELINES=1 on both sides; 180 s per run from a fixed start; runs alternated; each build's cache warmed by an unmeasured run first; closed with WM_CLOSE, all exit 0, no Xid).

Intro cinematic from a fresh save (same scene every run):

baseline 3aad3bf3: b5 / b6 / b7 candidate: c6 / c7
fps (whole 180 s) 14.0 / 14.2 / 14.4 14.2 / 14.3
2561af card time, mean ms/frame 3.58 / 3.51 / 3.44 2.50 / 3.99
all pipelines card time, mean ms/frame 33.4 / 33.5 / 33.4 30.2 / 33.8

Saved game (prison window scene), 4 alternating runs: 14.6–15.5 fps on both sides, and 2561af never reached the per-pipeline top 48.

So the difference is within noise. Note also that the 25–33 ms spike of 2561af in the first report happened with VICE_TAY_SAMPLED_MARKS=0 too (25.8 ms in one of those runs) and could not be reproduced in 9 later runs, so the marks are not shown to cause it. Fps here is low because the per-pipeline meter costs ~10 fps; without it this scene runs at ~27 fps, limited by the submitting thread.

Next: suggestion 1 (refreshes that copy nothing). The existing VICE_TAY_FLUSH_SIFT / VICE_TAY_FRONT_SIFT do that reordering and are off by default with no recorded measurement; they are being A/B'd now, together with VICE_TAY_NARROW_BARRIERS and VICE_TAY_BARRIER_STATS for the GPU side.

**@⁠zmelumian972** on GitHub · 2026-11-30 21:29 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/473#issuecomment-7292490109) ### Sampled marks (suggestion 2): tried, no measurable gain **Change tested** (local branch, not pushed): marks are made once per descriptor load at the end of each IR block instead of after every image instruction. On `compute 2561af9577c47289`, translated as on a 32-lane host (the game's 330 KB DXIL), that is **271 marks → 140**, DXIL 329,952 → 316,704 bytes. Skipping loads already marked in a dominating block saved nothing more. **A/B** (RTX 5090, Linux, 1440p, DLSS off, `VICE_TAY_CODE_TABLE_AFTER=1 VICE_TAY_LIBRARY=0`, `VICE_TAY_CARD_METER_PIPELINES=1` on both sides; 180 s per run from a fixed start; runs alternated; each build's cache warmed by an unmeasured run first; closed with WM_CLOSE, all exit 0, no Xid). Intro cinematic from a fresh save (same scene every run): | | baseline 3aad3bf3: b5 / b6 / b7 | candidate: c6 / c7 | |---|---|---| | fps (whole 180 s) | 14.0 / 14.2 / 14.4 | 14.2 / 14.3 | | `2561af` card time, mean ms/frame | 3.58 / 3.51 / 3.44 | 2.50 / 3.99 | | all pipelines card time, mean ms/frame | 33.4 / 33.5 / 33.4 | 30.2 / 33.8 | Saved game (prison window scene), 4 alternating runs: 14.6–15.5 fps on both sides, and `2561af` never reached the per-pipeline top 48. So the difference is within noise. Note also that the 25–33 ms spike of `2561af` in the first report happened with `VICE_TAY_SAMPLED_MARKS=0` too (25.8 ms in one of those runs) and could not be reproduced in 9 later runs, so the marks are not shown to cause it. Fps here is low because the per-pipeline meter costs ~10 fps; without it this scene runs at ~27 fps, limited by the submitting thread. Next: suggestion 1 (refreshes that copy nothing). The existing `VICE_TAY_FLUSH_SIFT` / `VICE_TAY_FRONT_SIFT` do that reordering and are off by default with no recorded measurement; they are being A/B'd now, together with `VICE_TAY_NARROW_BARRIERS` and `VICE_TAY_BARRIER_STATS` for the GPU side.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-30 23:43 UTC · original

Good to have the sampled-marks A/B in writing, including the part where the 25-33 ms spike showed up with marks off too. That rules them out as the cause better than any guess would. I'm leaving VICE_TAY_SAMPLED_MARKS as it is.

On suggestion 1, you're testing exactly what I'd test. VICE_TAY_FLUSH_SIFT and VICE_TAY_FRONT_SIFT were written for those ~9,000 no-op refreshes and have never been measured as defaults. Before either one goes on by default here, it needs the same A/B on the Windows 4K boat route, since the submitting thread is the limit there too. So post your numbers when you have them, including the runs where one of them doesn't help.

One thing from #472 that matters for these runs: current main drops the pipeline library under Wine on NVIDIA by default now (#485). You don't need VICE_TAY_LIBRARY=0 anymore, and it won't change your baseline either way.

**@⁠TaynanGT** on GitHub · 2026-11-30 23:43 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/473#issuecomment-7295455173) Good to have the sampled-marks A/B in writing, including the part where the 25-33 ms spike showed up with marks off too. That rules them out as the cause better than any guess would. I'm leaving `VICE_TAY_SAMPLED_MARKS` as it is. On suggestion 1, you're testing exactly what I'd test. `VICE_TAY_FLUSH_SIFT` and `VICE_TAY_FRONT_SIFT` were written for those ~9,000 no-op refreshes and have never been measured as defaults. Before either one goes on by default here, it needs the same A/B on the Windows 4K boat route, since the submitting thread is the limit there too. So post your numbers when you have them, including the runs where one of them doesn't help. One thing from #472 that matters for these runs: current `main` drops the pipeline library under Wine on NVIDIA by default now (#485). You don't need `VICE_TAY_LIBRARY=0` anymore, and it won't change your baseline either way.
Author
Owner

@⁠zmelumian972 on GitHub · 2026-12-01 17:41 UTC · original

Suggestion 1: VICE_TAY_FLUSH_SIFT + VICE_TAY_FRONT_SIFT: no measurable gain here

Same setup as the sampled-marks A/B (RTX 5090, Linux, 1440p, DLSS off, 3aad3bf3, warm cache, intro cinematic from a fresh save, 180 s per run, alternating runs, no per-pipeline meter). Both flags off vs both on:

run sift flags fps mean (median) submitting thread ms refreshes ms
s0a off 20.34 (21.50) 26.8 8.9
s1a on 20.35 (21.00) 28.0 9.5
s0b off 20.71 (21.20) 28.3 9.8
s1b on 20.97 (21.70) 27.4 9.2

The flags take effect (refreshes handed to the thread pool fall from ~1,230 to ~960 a frame), but fps and the submitting thread's time don't move beyond noise. All runs exited cleanly, with no Xid. This is not the Windows 4K boat route, so it doesn't settle a Windows default; on this Linux setup they don't help.

**@⁠zmelumian972** on GitHub · 2026-12-01 17:41 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/473#issuecomment-7319687738) ### Suggestion 1: `VICE_TAY_FLUSH_SIFT` + `VICE_TAY_FRONT_SIFT`: no measurable gain here Same setup as the sampled-marks A/B (RTX 5090, Linux, 1440p, DLSS off, `3aad3bf3`, warm cache, intro cinematic from a fresh save, 180 s per run, alternating runs, no per-pipeline meter). Both flags off vs both on: | run | sift flags | fps mean (median) | submitting thread ms | refreshes ms | |---|---|---|---|---| | s0a | off | 20.34 (21.50) | 26.8 | 8.9 | | s1a | on | 20.35 (21.00) | 28.0 | 9.5 | | s0b | off | 20.71 (21.20) | 28.3 | 9.8 | | s1b | on | 20.97 (21.70) | 27.4 | 9.2 | The flags take effect (refreshes handed to the thread pool fall from ~1,230 to ~960 a frame), but fps and the submitting thread's time don't move beyond noise. All runs exited cleanly, with no Xid. This is not the Windows 4K boat route, so it doesn't settle a Windows default; on this Linux setup they don't help.
This discussion has been locked. Commenting is limited to contributors.
No description provided.