Texture blocks made with the pool's lock let go #683
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/683"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 0xkn0wh3r3 on 2026-11-28T03:32:45Z.
Stacked on #630. Its commits come first on this branch; it needs
Made::Blockfrom there. New here: the last two commits,Texture blocks made with the pool's lock let goand its bench.Why
A new 64 MiB block of textures was made inside
Pool::take_ripe, under the texture pool's lock:CreateHeap, thenMakeResident, then a mapping copy waited for. Every other thread that placed a texture, whether a block had room for it or not, waited until the new block was resident and mapped. That wait is as long as the paging queued before it, which is longest while a scene loads, when most textures are made.What
take_ripeis split intoplace(where a piece goes, or "a new block is needed"), the block, andfinish(the ripe blocks made ahead, bookkeeping). Its behaviour is unchanged, and the existing pool unit tests cover it.pool::texturemakes the block with the lock released (VICTORY_BLOCKS_UNLOCKED=0: under it, as before), then takes the lock again to add it. If two threads both found no room, both make a block; the second one is just one more empty block, kept or released by the usual spare rule. The failure backoff (500 ms) is kept.VICTORY_RIPE_BLOCKSabove 0 it counts as ripe no sooner than it should.main's pool census (VICTORY_POOL_STATS): both are kept.Before / after
bench_textures_placed_while_another_thread_makes_blocks(--ignored --nocapture,VICTORY_RIPE_BLOCKS=0 VICTORY_BLOCK_AHEAD=0): one thread places 256 KiB textures that blocks with pieces have room for, while another places 24 MiB textures that need a new block every second one. RTX card. Latency of the small textures' placing:VICTORY_BLOCKS_UNLOCKED=0), 4 runsCorrectness
threads_that_place_textures_at_once_make_blocks_and_keep_their_pieces_apart: eight threads place 192 textures of 4 MiB at once, several of them making blocks. Every texture is placed, the pieces held cover all of them, the device stays, and the debug layer reports nothing. It passes with the switch either way.VICTORY_RIPE_BLOCKSunset and with=0(the launcher's setting).-D warnings, andcargo test --workspace --locked, all pass.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 0xkn0wh3r3 on 2026-11-28T06:49:47Z.
Replaced by #816, one smaller change of the same kind (blocks made with the pool's lock let go, for both textures and staging). It has no switch and no separate thread making blocks ahead, and comes with before/after numbers against current main.
Pull request closed