startup: a 16 MiB table buffer copy is compared in full on every draw under draw_lock; the late load stalls on it #2976

Closed
opened 2026-11-27 01:01:59 +00:00 by lukaslw-lab · 0 comments
lukaslw-lab commented 2026-11-27 01:01:59 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-27T01:01:59Z.


In the main executable's startup run (#870), frame rate falls from about 30 fps to 4–9 fps once the post-confirm load starts. Local timers (logging only, not in any PR) put about half of the stand-in's busy threads in waits for draw_lock, and trace the hold to one buffer copy.

Windows 10 22H2, i7-4790K, RTX 3080 Ti, NVIDIA 32.0.16.1047, release on 6ee878d8 + #2949, warm shader cache, run.ps1 -Render without -Translate, scripted input, 250 s. Figures for 150–240 s, as busy threads (summed time per wall second):

Stand-in list time 3.5–3.7 threads
Waiting for draw_lock ~1.9 threads (mostly list Reset cleanup and Dispatch)
draw_lock held ~58 % of the time, ~83 % of that by draw_translated (~490 µs per draw)
Thread CPU time during the draw hold 82 % of wall time (work, not page faults)
frame_copy share of the draw hold 86 %
One view's share of frame_copy time 97 %
  • That view: a raw buffer view the title creates (device slot 18) over a 90 MiB slot 133 placed buffer that aliases title memory (placed ... aliased), bound from the descriptor table by two vertex shaders. frame_copy cuts it to 16 MiB.
  • About 140 draws per second find it already copied this frame, and each confirms that with a 16 MiB memcmp against the kept bytes (~2.2 ms, ~85 % of frame_copy time). Nearly every comparison matches.
  • The shaders read it at data-dependent offsets, so the read extent is not known from the shader.
  • Vertex streams and live indices in such a placement already bind the alias (#2724, #2834). Table buffer views never look up the placement and always take frame_copy.
  • Side effect of the cut: reads past 16 MiB of this view see zeros. Not checked whether the shaders reach there.

Proposed in #2977: an opt-in X2W_D3D12_TABLE_ALIAS=1 that binds the alias for a table buffer view whose whole range lies in an aliased placement. The GPU then reads the bytes at execution, not at record time, as on the console. The default stays as on main.

This report was prepared with AI assistance (Claude); the runs are mine.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6637778265 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2976). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-27T01:01:59Z. --- In the main executable's startup run (#870), frame rate falls from about 30 fps to 4–9 fps once the post-confirm load starts. Local timers (logging only, not in any PR) put about half of the stand-in's busy threads in waits for `draw_lock`, and trace the hold to one buffer copy. Windows 10 22H2, i7-4790K, RTX 3080 Ti, NVIDIA 32.0.16.1047, release on `6ee878d8` + #2949, warm shader cache, `run.ps1 -Render` without `-Translate`, scripted input, 250 s. Figures for 150–240 s, as busy threads (summed time per wall second): | | | |---|---| | Stand-in `list` time | 3.5–3.7 threads | | Waiting for `draw_lock` | ~1.9 threads (mostly list Reset cleanup and Dispatch) | | `draw_lock` held | ~58 % of the time, ~83 % of that by `draw_translated` (~490 µs per draw) | | Thread CPU time during the draw hold | 82 % of wall time (work, not page faults) | | `frame_copy` share of the draw hold | 86 % | | One view's share of `frame_copy` time | 97 % | - That view: a raw buffer view the title creates (device slot 18) over a 90 MiB slot 133 placed buffer that aliases title memory (`placed ... aliased`), bound from the descriptor table by two vertex shaders. `frame_copy` cuts it to 16 MiB. - About 140 draws per second find it already copied this frame, and each confirms that with a 16 MiB `memcmp` against the kept bytes (~2.2 ms, ~85 % of `frame_copy` time). Nearly every comparison matches. - The shaders read it at data-dependent offsets, so the read extent is not known from the shader. - Vertex streams and live indices in such a placement already bind the alias (#2724, #2834). Table buffer views never look up the placement and always take `frame_copy`. - Side effect of the cut: reads past 16 MiB of this view see zeros. Not checked whether the shaders reach there. Proposed in #2977: an opt-in `X2W_D3D12_TABLE_ALIAS=1` that binds the alias for a table buffer view whose whole range lies in an aliased placement. The GPU then reads the bytes at execution, not at record time, as on the console. The default stays as on `main`. This report was prepared with AI assistance (Claude); the runs are mine.
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#2976
No description provided.