[PR #2406] [MERGED] bindless: size every sampled dimension alike and name a full array as its own refusal (RT-BINDLESS-DIMENSION-LIMITS) #2406

Closed
opened 2026-11-26 22:36:07 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2406
Author: @aslan2142
Created: 11/26/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142

Base: main ← Head: bindless-dimension-limits


📝 Commits (1)

  • 7d5d820 bindless: size every sampled dimension alike and name a full array as its own refusal (RT-BINDLESS-DIMENSION-LIMITS)

📊 Changes

8 files changed (+629 additions, -44 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+19 -6)
📝 runtime/CMakeLists.txt (+28 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+32 -15)
📝 runtime/src/vulkan_bindless.h (+45 -14)
📝 runtime/test/bindless_sizing_test.cpp (+46 -8)
➕ runtime/test/glsl/cs_bindless_dimensions.comp (+30 -0)
➕ runtime/test/vk_bindless_dimensions_test.cpp (+421 -0)
📝 runtime/test/vk_bindless_test.cpp (+8 -1)

📄 Description

The bindless set gave 1D and 3D images 4,096 indices whatever the device holds. World runs fill the 1D array a few minutes in, and from then on every new 1D T# reads zeros. This sizes every sampled dimension alike and reports a full array under its own reason.

Claimed in the coordination issue as: RT-BINDLESS-DIMENSION-LIMITS

What was wrong

  • size_bindings grew 2D images to 65,536 but 2D arrays only to 16,384 and 3D and 1D to 4,096 (max_*_images in runtime/src/vulkan_bindless.h).
  • The device's limits allow far more: 8,388,606 sampled images on RADV, 1,015,808 on llvmpipe.
  • In every world run the 1D array fills: 4,096 indices = the fallback + 4,092 T#s of 4,090 textures + 3 replaced views.
  • That count is also the answer to "do entries leak?": no.
    • Every index is held by a texture the runtime still has registered.
    • A texture's indices are freed when it goes (forget_image, then the deferred bindless_slot release, then remove_image).
    • The array was too small, nothing more.
  • After the fill, the per-window count of unbound T#s under "no view for the T#'s format or range" goes from 2–28 to 1,000–4,400. That reason was wrong: the view existed, the array had no room.

What changes

  • One size for every dimension. The sampled arrays of 2D, 2D array, 3D and 1D all grow to the same maximum (max_images, 65,536).
    • The 2D-array, 3D and 1D arrays grow together, so a device whose limits stop growth earlier favours none of them.
    • The bound is memory: each generation's descriptor pool holds every element, used or not. 325,729 descriptors in all, 10–20 MiB.
  • No shader changes. The translator declares runtime arrays.
  • The set layout changes.
    • Compute pipelines get new journal names (hash_bindless_layout hashes the counts).
    • The pipeline cache (gta6rt --precompile-pipelines / the pipelines stage) has to be rebuilt once.
  • BindlessSet::image_refusal says why add_image returned 0: no array, array full, or storage range full.
  • New refusal reasons. bind_title_image now counts:
    • "the bindless array of the T#'s dimension is full";
    • "the bindless storage arrays of the T#'s dimension are full".
  • Better log line. The once-per-dimension "array is full" line names the dimension (1D, not just 3) and how many of the textures holding indices are still registered at their address.
  • Docs. docs/d3d12_vulkan.md section 5 has the new sizes and reasons.

Tests

  • bindless_sizing_test (CPU): RADV's and llvmpipe's limits give every sampled dimension 65,536; on main 1D and 3D stop at 4,096. A short budget is shared alike by the three dimensions.
  • vk_bindless_dimensions_test (new, GPU, GLSL shader):
    • sizes a set from the device's own limits;
    • gives 5,000 live 1D, 2D-array and 3D images an index each and reads every one through its index;
    • fills the rest of the array: the next image is refused as full;
    • removed indices come back at once, or after an erased key at the next flush.
    • On main it fails at "1D: 4096 indices in the set".
    • Passes with the validation layer on llvmpipe, the Ryzen 9 7950X3D iGPU (RADV RAPHAEL_MENDOCINO) and the RX 7900 XTX (RADV NAVI31), Mesa 26.3.1. No amdgpu timeouts, resets or page faults in the kernel log.
  • Linux runtime ctest on llvmpipe: 114 of 114 passed (3 skipped).
  • Windows suite under Wine (clang-cl cross-build, iGPU, RADV): 488 tests, compared test by test with main 2d43417d4.
    • The only change is the new vk_bindless_dimensions (passes).
    • The first run also caught vk_bindless_ps_tex and vk_bindless_ps_imgatomic: their index-space case assumed the first 1D index is 1, true only while the 1D array was as short as its storage arrays. The case now checks every index once, and that indices above the storage arrays go first. All four vk_bindless* tests pass.
    • The 23 other failures are the same on main (presentation under xvfb, host DXGI and similar).
  • Python checks: tests/test_ci_registration.py, tests/test_ctest_registration.py, tests/test_docs_*.py, tests/test_text_write_line_endings.py and scripts/check_no_game_data.py on the changed files pass.

World run

RX 7900 XTX, RADV (Mesa 26.3.1), Wine, from a local build of main fac8b4bb9 with this change and two others (RT-VSHARP-SLOT-RECORDS and #2230):

  • The startup line reads bindless set: 65536 2D images, 4096 samplers, 65536 2D-array, 65536 3D, 65536 1D, 4096 storage indices in 2D.
  • No a bindless image array is full line, and "no view for the T#'s format or range" stays at a handful per window.
  • The run ended about 100 s into the world in a graphics-ring timeout with every queue idle in the dispatch markers. That hang also ends runs of plain main here (three of nine earlier runs), so it is not shown to come from this change, but the run stopped before the point (about 340 s) where the 1D array used to fill. So the run shows no regression and the new sizes, not yet the picture after the old fill point.
  • The set layout's counts are part of each pipeline's key: pipeline caches and the compute journal are rebuilt once after this change.

Not tested

  • MSVC itself (CI builds it).
  • A device whose limits are below 65,536 per dimension (covered only by the synthetic limits in bindless_sizing_test).

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)


🔄 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/2406 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/26/2026 **Status:** ✅ Merged **Merged:** 11/26/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `bindless-dimension-limits` --- ### 📝 Commits (1) - [`7d5d820`](https://github.com/ubiquitarianism/leonida/commit/7d5d820779cc7a348657ebf191531f9987d61d76) bindless: size every sampled dimension alike and name a full array as its own refusal (RT-BINDLESS-DIMENSION-LIMITS) ### 📊 Changes **8 files changed** (+629 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+19 -6) 📝 `runtime/CMakeLists.txt` (+28 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+32 -15) 📝 `runtime/src/vulkan_bindless.h` (+45 -14) 📝 `runtime/test/bindless_sizing_test.cpp` (+46 -8) ➕ `runtime/test/glsl/cs_bindless_dimensions.comp` (+30 -0) ➕ `runtime/test/vk_bindless_dimensions_test.cpp` (+421 -0) 📝 `runtime/test/vk_bindless_test.cpp` (+8 -1) </details> ### 📄 Description The bindless set gave 1D and 3D images 4,096 indices whatever the device holds. World runs fill the 1D array a few minutes in, and from then on every new 1D T# reads zeros. This sizes every sampled dimension alike and reports a full array under its own reason. Claimed in the coordination issue as: [RT-BINDLESS-DIMENSION-LIMITS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7201355992) ## What was wrong - `size_bindings` grew 2D images to 65,536 but 2D arrays only to 16,384 and 3D and 1D to 4,096 (`max_*_images` in `runtime/src/vulkan_bindless.h`). - The device's limits allow far more: 8,388,606 sampled images on RADV, 1,015,808 on llvmpipe. - In every world run the 1D array fills: 4,096 indices = the fallback + 4,092 T#s of 4,090 textures + 3 replaced views. - That count is also the answer to "do entries leak?": no. - Every index is held by a texture the runtime still has registered. - A texture's indices are freed when it goes (`forget_image`, then the deferred `bindless_slot` release, then `remove_image`). - The array was too small, nothing more. - After the fill, the per-window count of unbound T#s under "no view for the T#'s format or range" goes from 2–28 to 1,000–4,400. That reason was wrong: the view existed, the array had no room. ## What changes - **One size for every dimension.** The sampled arrays of 2D, 2D array, 3D and 1D all grow to the same maximum (`max_images`, 65,536). - The 2D-array, 3D and 1D arrays grow together, so a device whose limits stop growth earlier favours none of them. - The bound is memory: each generation's descriptor pool holds every element, used or not. 325,729 descriptors in all, 10–20 MiB. - **No shader changes.** The translator declares runtime arrays. - **The set layout changes.** - Compute pipelines get new journal names (`hash_bindless_layout` hashes the counts). - The pipeline cache (`gta6rt --precompile-pipelines` / the pipelines stage) has to be rebuilt once. - **`BindlessSet::image_refusal`** says why `add_image` returned 0: no array, array full, or storage range full. - **New refusal reasons.** `bind_title_image` now counts: - "the bindless array of the T#'s dimension is full"; - "the bindless storage arrays of the T#'s dimension are full". - **Better log line.** The once-per-dimension "array is full" line names the dimension (`1D`, not just `3`) and how many of the textures holding indices are still registered at their address. - **Docs.** `docs/d3d12_vulkan.md` section 5 has the new sizes and reasons. ## Tests - **`bindless_sizing_test`** (CPU): RADV's and llvmpipe's limits give every sampled dimension 65,536; on `main` 1D and 3D stop at 4,096. A short budget is shared alike by the three dimensions. - **`vk_bindless_dimensions_test`** (new, GPU, GLSL shader): - sizes a set from the device's own limits; - gives 5,000 live 1D, 2D-array and 3D images an index each and reads every one through its index; - fills the rest of the array: the next image is refused as full; - removed indices come back at once, or after an erased key at the next flush. - On `main` it fails at "1D: 4096 indices in the set". - Passes with the validation layer on llvmpipe, the Ryzen 9 7950X3D iGPU (RADV RAPHAEL_MENDOCINO) and the RX 7900 XTX (RADV NAVI31), Mesa 26.3.1. No amdgpu timeouts, resets or page faults in the kernel log. - **Linux runtime `ctest`** on llvmpipe: 114 of 114 passed (3 skipped). - **Windows suite** under Wine (clang-cl cross-build, iGPU, RADV): 488 tests, compared test by test with `main` 2d43417d4. - The only change is the new `vk_bindless_dimensions` (passes). - The first run also caught `vk_bindless_ps_tex` and `vk_bindless_ps_imgatomic`: their index-space case assumed the first 1D index is 1, true only while the 1D array was as short as its storage arrays. The case now checks every index once, and that indices above the storage arrays go first. All four `vk_bindless*` tests pass. - The 23 other failures are the same on `main` (presentation under xvfb, host DXGI and similar). - **Python checks:** `tests/test_ci_registration.py`, `tests/test_ctest_registration.py`, `tests/test_docs_*.py`, `tests/test_text_write_line_endings.py` and `scripts/check_no_game_data.py` on the changed files pass. ## World run RX 7900 XTX, RADV (Mesa 26.3.1), Wine, from a local build of `main` `fac8b4bb9` with this change and two others (RT-VSHARP-SLOT-RECORDS and #2230): - The startup line reads `bindless set: 65536 2D images, 4096 samplers, 65536 2D-array, 65536 3D, 65536 1D, 4096 storage indices in 2D`. - No `a bindless image array is full` line, and "no view for the T#'s format or range" stays at a handful per window. - The run ended about 100 s into the world in a graphics-ring timeout with every queue idle in the dispatch markers. That hang also ends runs of plain `main` here (three of nine earlier runs), so it is not shown to come from this change, but the run stopped before the point (about 340 s) where the 1D array used to fill. So the run shows no regression and the new sizes, not yet the picture after the old fill point. - The set layout's counts are part of each pipeline's key: pipeline caches and the compute journal are rebuilt once after this change. ## Not tested - MSVC itself (CI builds it). - A device whose limits are below 65,536 per dimension (covered only by the synthetic limits in `bindless_sizing_test`). AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 changed title from [PR #2406] bindless: size every sampled dimension alike and name a full array as its own refusal (RT-BINDLESS-DIMENSION-LIMITS) to [PR #2406] [MERGED] bindless: size every sampled dimension alike and name a full array as its own refusal (RT-BINDLESS-DIMENSION-LIMITS) 2026-11-26 22:46:10 +01:00
4ld0 closed this issue 2026-11-26 22:46:10 +01:00
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#2406
No description provided.