[PR #425] vulkan_bindless: a new set-0 generation reuses a spare set and writes only the delta; retired generations fit the pool limit (BINDLESS-SPARE-SET-DELTA) #477

Open
opened 2026-11-26 20:18:00 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/425
Author: @Kokonotcu
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: pr/bindless-delta-log


📝 Commits (2)

  • b69d590 Bindless: cap retired generations by the update-after-bind pool limit (D4)
  • 5ab98b3 Bindless: a new generation reuses a spare set and writes only the delta (I8)

📊 Changes

5 files changed (+305 additions, -8 deletions)

View changed files

📝 runtime/CMakeLists.txt (+17 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+6 -3)
📝 runtime/src/vulkan_bindless.h (+125 -5)
📝 runtime/test/bindless_sizing_test.cpp (+31 -0)
➕ runtime/test/vk_bindless_generation_test.cpp (+126 -0)

📄 Description

Claim: BINDLESS-SPARE-SET-DELTA

What was wrong

Every generation of the bindless set 0 (a flush that changes a live hash-table entry: a live key's index replaced, or a key moved by a relocating insert) was a new descriptor pool and set into which every descriptor written so far was written again (write_shadow): up to the whole set (~94k descriptors at full size without partially bound) for a one-entry change, on the submitting thread. And the number of retired generations kept alive (each a pool of the whole set's size) was capped at 8 whatever maxUpdateAfterBindDescriptorsInAllPools allows, so on a device whose limit holds fewer, a replacing flush could fail to make its pool.

What changed (two commits)

  1. bindless::retired_generation_cap (D4): how many retired generations may wait for their submissions, at most 8, and fewer where their pools, the current set's and the new one's would not fit maxUpdateAfterBindDescriptorsInAllPools (BindlessFeatures::pool_limit, set by size_bindings). The device waits for the oldest past that cap, as it did at 8. BindlessSet::features() exposes the sizing for it.
  2. Spare set and delta log (I8): a retired generation whose submissions are done keeps its pool and set as a spare (one, where bindless::spare_sets says the budget has room), and the next generation takes it instead of making one. A numbered log of the descriptor writes applied since (binding, index) brings it up to date: write_delta writes each element changed since its last sync, once. The log is pruned to what the spare and the retired generations still need, and dropped when it grows past four times the shadow (those sets then take write_shadow, as before). retired_generation_cap leaves room for the spare.

Note: open draft #113 (bindless zero-allocation pending writes, vulkan_bindless.h) edits the same flush / pending-write code; the two will conflict textually, not in what they do.

Testing

RTX 3080 Laptop GPU, i7-11800H, Windows 10 19045, NVIDIA driver, MSVC 2022 RelWithDebInfo, Vulkan SDK 1.4.350.

  • New vk_bindless_generation_test (real GPU, vkUpdateDescriptorSets counted, 3000 images, partially bound): descriptors written per new generation: 3788 every round before; 3769 for the first (no spare yet) and 1 (the table binding) for each one after.
  • bindless_sizing_test: the cap with synthetic pool limits, the spare included (8 retired generations within 1048576 on this GPU).
  • d3d12_set0_compute (four dispatches through set 0, every texel matched) and d3d12_bindless_churn (96 frames on a direct and a compute queue, 3 new generations, every sampled texel matched): pass.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/425 **Author:** [@Kokonotcu](https://github.com/Kokonotcu) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/bindless-delta-log` --- ### 📝 Commits (2) - [`b69d590`](https://github.com/ubiquitarianism/leonida/commit/b69d590abf087127dbd4a933c858effef9aae1f5) Bindless: cap retired generations by the update-after-bind pool limit (D4) - [`5ab98b3`](https://github.com/ubiquitarianism/leonida/commit/5ab98b38dc271195dd7301bc95cf7135309be6a5) Bindless: a new generation reuses a spare set and writes only the delta (I8) ### 📊 Changes **5 files changed** (+305 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+17 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+6 -3) 📝 `runtime/src/vulkan_bindless.h` (+125 -5) 📝 `runtime/test/bindless_sizing_test.cpp` (+31 -0) ➕ `runtime/test/vk_bindless_generation_test.cpp` (+126 -0) </details> ### 📄 Description Claim: BINDLESS-SPARE-SET-DELTA ## What was wrong Every generation of the bindless set 0 (a flush that changes a live hash-table entry: a live key's index replaced, or a key moved by a relocating insert) was a new descriptor pool and set into which every descriptor written so far was written again (`write_shadow`): up to the whole set (~94k descriptors at full size without partially bound) for a one-entry change, on the submitting thread. And the number of retired generations kept alive (each a pool of the whole set's size) was capped at 8 whatever `maxUpdateAfterBindDescriptorsInAllPools` allows, so on a device whose limit holds fewer, a replacing flush could fail to make its pool. ## What changed (two commits) 1. `bindless::retired_generation_cap` (D4): how many retired generations may wait for their submissions, at most 8, and fewer where their pools, the current set's and the new one's would not fit `maxUpdateAfterBindDescriptorsInAllPools` (`BindlessFeatures::pool_limit`, set by `size_bindings`). The device waits for the oldest past that cap, as it did at 8. `BindlessSet::features()` exposes the sizing for it. 2. Spare set and delta log (I8): a retired generation whose submissions are done keeps its pool and set as a spare (one, where `bindless::spare_sets` says the budget has room), and the next generation takes it instead of making one. A numbered log of the descriptor writes applied since (binding, index) brings it up to date: `write_delta` writes each element changed since its last sync, once. The log is pruned to what the spare and the retired generations still need, and dropped when it grows past four times the shadow (those sets then take `write_shadow`, as before). `retired_generation_cap` leaves room for the spare. Note: open draft #113 (bindless zero-allocation pending writes, `vulkan_bindless.h`) edits the same flush / pending-write code; the two will conflict textually, not in what they do. ## Testing RTX 3080 Laptop GPU, i7-11800H, Windows 10 19045, NVIDIA driver, MSVC 2022 RelWithDebInfo, Vulkan SDK 1.4.350. - New `vk_bindless_generation_test` (real GPU, `vkUpdateDescriptorSets` counted, 3000 images, partially bound): descriptors written per new generation: 3788 every round before; 3769 for the first (no spare yet) and 1 (the table binding) for each one after. - `bindless_sizing_test`: the cap with synthetic pool limits, the spare included (8 retired generations within 1048576 on this GPU). - `d3d12_set0_compute` (four dispatches through set 0, every texel matched) and `d3d12_bindless_churn` (96 frames on a direct and a compute queue, 3 new generations, every sampled texel matched): pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#477
No description provided.