Repository navigation
texture: SEEDS and HOST_WRITTEN behind a RwLock — asked of every texture read on every recording thread (3–5× cheaper under contention) - #2226
Conversation
…n every recording thread, written only when a view is seeded, a texture is written by the host, or forgotten
SEEDS and HOST_WRITTEN behind a RwLock: asked of every texture read on every recording thread, written only when a view is seeded, a texture is written by the host, or forgotten Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…N behind a RwLock — asked of every texture read on every recording thread (3–5× cheaper under contention) trustno1-coder#2226 by birdneststream, head ad26de6.
|
Measured this on an RTX 5080 + 9800X3D with a CPU micro-benchmark of the texture-read path (
With realistic spacing, the RwLock alone lands within noise of main. There are two reasons: On the "2× slower per draw since .01" reports: in our logs that came from the compile-memory guard, not from these tables. Recording threads measured 3.6–4.5 µs a list call on .28.03, 15–128 µs on .29.01 with the guard on, and 3.7–4.8 µs with it off (#3347). These tables are worth about 1–5 % of recording time per draw. AI use: Claude Code (Claude Opus 5.5). |
…a RwLock — asked of every texture read on every recording thread (3–5× cheaper under contention)
SEEDSandHOST_WRITTENintexture.rsare asked of every texture read on every recording thread (seed_pendingper SRV,upload_from,host_wrote,is_host_written), and written only when a view is seeded, a texture is written by the host, or a resource is forgotten. Behind aMutex, every one of those reads serialises against every other thread's read.Measured under Wine (wine-staging 11.22, i9-13900KF), eight threads hashing a key in a 32-element set behind each lock, 200k lookups a thread, three runs:
Three to five times cheaper per lookup under contention, the same answers (writers still exclusive).
seed_pendingtakes the read first and only the write when the view really waits, so the usual "not waiting" costs one read.This lock per texture read came in with e530c00 (11-28,
UPLOAD_GUARDon by default), which is why I am pointing at it in #2129 as a candidate for the per-draw cost: with thousands of texture reads a frame across the recording threads, a globalMutexthere is on the per-draw path. No behaviour change; the GPU suite under Wine is at its usual baseline with it (913/6, the six known Wine/vkd3d ones).