Skip to content

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

Done

Description

@lukaslw-lab

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 (gpu: read live aliased indices in direct translated draws #2724, gpu: allow live aliased indices with un-sliced placed vertex streams #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.

Activity

  1. added a commit that references this issue on Nov 27, 2026
    50488e1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions