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

Manually merged
github merged 1 commit from gh-pr/2406/head into gh-pr/2406/base 2026-11-27 00:35:20 +00:00
Owner

@⁠aslan2142 on GitHub · 2026-11-26 21:34 UTC · original
aslan2142:bindless-dimension-limits → main · +629 −44 · 8 files · 1 commits · merged 2026-11-26 21:41 UTC

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)

**@⁠aslan2142** on GitHub · 2026-11-26 21:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2406) `aslan2142:bindless-dimension-limits` → `main` · +629 −44 · 8 files · 1 commits · merged 2026-11-26 21:41 UTC 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://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ## 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)
World runs fill one bindless image array a few minutes in: `a bindless image array is full; dimension 3: 4096
indices, 4092 T#s of 4090 textures`. Dimension 3 is 1D (ImageDimension: 2D, 2D array, 3D, 1D). From then on every
new 1D T# reads the fallback's zeros, and the console heaps count it as "no view for the T#'s format or range",
which went from 2-28 a window to over 4000.

Nothing leaks: the 4096 indices are the fallback, 4092 entries of image_entries and 3 replaced views, every one
held by a texture the runtime still has registered, and a texture's indices go back when it goes (forget_image,
the deferred bindless_slot release, remove_image). The cause is the size: size_bindings grew 2D images to 65536
but 3D and 1D only to 4096 and 2D arrays to 16384, constants that guessed how many textures of each dimension a
title keeps, whatever the device holds (RADV allows 8388606 sampled images, llvmpipe 1015808).

- vulkan_bindless.h: one maximum (max_images, 65536) for the sampled array of every single-sample dimension, in
  place of max_2d_images, max_2d_array_images, max_3d_images and max_1d_images. The 2D-array, 3D and 1D arrays
  grow together after 2D and the storage arrays, so on a device whose limits stop growth earlier none of them is
  favoured. The bound is memory (each generation's pool holds every element): 325729 descriptors on an RTX 5070,
  10-20 MiB at 32-64 bytes a descriptor. The shaders declare runtime arrays, so no shader changes; the set layout
  changes, so compute pipelines get new journal names (hash_bindless_layout) and the pipeline cache is rebuilt.
- BindlessSet::image_refusal says why add_image returned 0: no array for the dimension, the array is full, or only
  its shorter storage range is.
- d3d12_vulkan_device.cpp: bind_image_locked and bind_image_views_locked report that reason; bind_title_image
  counts it ("the bindless array of the T#'s dimension is full", or "the bindless storage arrays of the T#'s
  dimension are full") instead of "no view for the T#'s format or range". The once-per-dimension line names the
  dimension, the storage range and how many of the textures holding indices are still registered at their address.
- docs/d3d12_vulkan.md: the sizes, and the new reason.

Tests: bindless_sizing_test checks RADV's and llvmpipe's limits (every sampled dimension at 65536; on main 1D and 3D
stop at 4096) and that the three dimensions share a short budget alike. vk_bindless_dimensions_test (new, GLSL
shader) sizes a set from the device, gives 5000 live 1D, 2D-array and 3D images an index each and reads every one
through its index, then fills the rest of the array: the next is refused as full, and 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".
vk_bindless_test's index-space case filled 1D expecting the first index to be 1, which held only while the 1D
array was as short as its storage arrays; it now checks every index once and that indices above the storage arrays
go first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:35:19 +00:00
github manually merged commit 7d5d820779 into gh-pr/2406/base 2026-11-27 00:35:20 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 21:41 UTC · original

Merging. This is a self-merge.

  • Why now: every tester who looked has this defect. The 1D image array fills at 4,096 a few minutes into the world, and every 1D T# after that reads zeros; three independent runs (RADV, RTX 5070, RTX 5080) show the same "array is full" line followed by a jump in textures without a view.
  • Tested on main 2d43417d4 + this PR (7d5d82077), Mesa 26.3.1:
    • vk_bindless_dimensions_test (5,000 live 1D, 2D-array and 3D images, each read through its index) passes on llvmpipe, the integrated RDNA2 GPU and the RX 7900 XTX with the validation layer, and fails on main with "1D: 4096 indices".
    • Linux runtime ctest: 114/114. Windows suite under Wine: the new test is the only change against main.
    • Registration, docs, line-ending and game-data checks pass.
  • World run: see the description. It shows the new sizes and no regression up to a hang that plain main has as well; it ended before the old fill point.
  • For everyone after this merge: pipeline caches and the compute journal are rebuilt once, because the set layout's counts are part of each pipeline's key. No shader re-translation is needed.

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

**@⁠aslan2142** on GitHub · 2026-11-26 21:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2406#issuecomment-7203965897) Merging. This is a self-merge. - **Why now:** every tester who looked has this defect. The 1D image array fills at 4,096 a few minutes into the world, and every 1D T# after that reads zeros; three independent runs (RADV, RTX 5070, RTX 5080) show the same "array is full" line followed by a jump in textures without a view. - **Tested on `main` `2d43417d4` + this PR** (`7d5d82077`), Mesa 26.3.1: - `vk_bindless_dimensions_test` (5,000 live 1D, 2D-array and 3D images, each read through its index) passes on llvmpipe, the integrated RDNA2 GPU and the RX 7900 XTX with the validation layer, and fails on `main` with "1D: 4096 indices". - Linux runtime `ctest`: 114/114. Windows suite under Wine: the new test is the only change against `main`. - Registration, docs, line-ending and game-data checks pass. - **World run:** see the description. It shows the new sizes and no regression up to a hang that plain `main` has as well; it ended before the old fill point. - **For everyone after this merge:** pipeline caches and the compute journal are rebuilt once, because the set layout's counts are part of each pipeline's key. No shader re-translation is needed. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-26 21:49 UTC · original

I verified the merged change on a physical RTX 4090 (Windows 11, NVIDIA 616.64, Vulkan validation enabled) at 55e2bd9e9e.

  • The stock vk_bindless_dimensions test read the expected texel from 5,000 live images in each of 1D, 2D array, and 3D. Each dimension reported 65,536 slots, refused an additional allocation when full, and reused released slots.
  • In a separate synthetic compute test, all 4,120 sampled-only allocations per dimension succeeded for 1D and 3D. All 8,240 GPU reads returned the expected dimensions and texels.
  • Requesting storage views as well accepted 4,095 entries per dimension. All 25 remaining requests in each dimension reported storage_full. A sampled-only allocation immediately succeeded at index 4,096 in each dimension. The 50 refused handles read the expected fallback, and the probe reported zero mismatches and zero validation errors.

This also checks the storage-exhaustion diagnostic on NVIDIA while sampled slots are still available.

**@⁠ecox982745** on GitHub · 2026-11-26 21:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2406#issuecomment-7204091078) I verified the merged change on a physical RTX 4090 (Windows 11, NVIDIA 616.64, Vulkan validation enabled) at `55e2bd9e9e`. - The stock `vk_bindless_dimensions` test read the expected texel from 5,000 live images in each of 1D, 2D array, and 3D. Each dimension reported 65,536 slots, refused an additional allocation when full, and reused released slots. - In a separate synthetic compute test, all 4,120 sampled-only allocations per dimension succeeded for 1D and 3D. All 8,240 GPU reads returned the expected dimensions and texels. - Requesting storage views as well accepted 4,095 entries per dimension. All 25 remaining requests in each dimension reported `storage_full`. A sampled-only allocation immediately succeeded at index 4,096 in each dimension. The 50 refused handles read the expected fallback, and the probe reported zero mismatches and zero validation errors. This also checks the storage-exhaustion diagnostic on NVIDIA while sampled slots are still available.
Author
Owner

@⁠Tauwni on GitHub · 2026-11-27 13:18 UTC · original

AGENT-MSG | 2026-11-27 UTC | Tauwni | AI-assisted: Claude Code (Claude Opus 5.5)
BASE:     2859d0c9b + none + test-only fix on Tauwni/leonida:fix/bindless-dimensions-skip-small-set
MACHINE:  Apple M3 (10-core GPU), integrated | MoltenVK 1.4.2, KosmicKrisp and llvmpipe (Mesa 26.3.1) | macOS 26.5.1 | 16 GB
RECIPE:   test suite only (vk_bindless_dimensions_test), no game files
ASK:      none; for whoever runs #2406 in game on a small-limit driver: MoltenVK is one
RETURNED: bindless set sizes after size_bindings, and the test per driver:
          MoltenVK    1D 256 / 2D-array 1024 / 3D 256  -> fails on main (line 291: capacity > live_images)
          KosmicKrisp 1D 65536 / 2D-array 65536 / 3D 65536 -> passes
          llvmpipe    1D 65536 / 2D-array 65536 / 3D 65536 -> passes
          Cause: MoltenVK reports 1,000,000 update-after-bind sampled images, so the test's skip check
          passes, but its vkGetDescriptorSetLayoutSupport refuses any set above maxPerSetDescriptors
          (1212, KhronosGroup/MoltenVK#2573), so the set keeps the default counts.
          The fix only makes the test skip (77) with the counts on such a device; it changes nothing in the
          runtime. Branch: https://github.com/Tauwni/leonida/tree/fix/bindless-dimensions-skip-small-set
RUNS:     1 per driver
EVIDENCE: set sizes and results MEASURED (1 run each); cause READ IN CODE (vk_bindless_dimensions_test.cpp:291
          and the skip in main(); MoltenVK getDescriptorSetLayoutSupport); game effect ASSUMED, not run:
          a world run on a Mac would fill 256 1D indices sooner than the 4096 this PR grew elsewhere
**@⁠Tauwni** on GitHub · 2026-11-27 13:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2406#issuecomment-7219315290) ``` AGENT-MSG | 2026-11-27 UTC | Tauwni | AI-assisted: Claude Code (Claude Opus 5.5) BASE: 2859d0c9b + none + test-only fix on Tauwni/leonida:fix/bindless-dimensions-skip-small-set MACHINE: Apple M3 (10-core GPU), integrated | MoltenVK 1.4.2, KosmicKrisp and llvmpipe (Mesa 26.3.1) | macOS 26.5.1 | 16 GB RECIPE: test suite only (vk_bindless_dimensions_test), no game files ASK: none; for whoever runs #2406 in game on a small-limit driver: MoltenVK is one RETURNED: bindless set sizes after size_bindings, and the test per driver: MoltenVK 1D 256 / 2D-array 1024 / 3D 256 -> fails on main (line 291: capacity > live_images) KosmicKrisp 1D 65536 / 2D-array 65536 / 3D 65536 -> passes llvmpipe 1D 65536 / 2D-array 65536 / 3D 65536 -> passes Cause: MoltenVK reports 1,000,000 update-after-bind sampled images, so the test's skip check passes, but its vkGetDescriptorSetLayoutSupport refuses any set above maxPerSetDescriptors (1212, KhronosGroup/MoltenVK#2573), so the set keeps the default counts. The fix only makes the test skip (77) with the counts on such a device; it changes nothing in the runtime. Branch: https://github.com/Tauwni/leonida/tree/fix/bindless-dimensions-skip-small-set RUNS: 1 per driver EVIDENCE: set sizes and results MEASURED (1 run each); cause READ IN CODE (vk_bindless_dimensions_test.cpp:291 and the skip in main(); MoltenVK getDescriptorSetLayoutSupport); game effect ASSUMED, not run: a world run on a Mac would fill 256 1D indices sooner than the 4096 this PR grew elsewhere ```
This discussion has been locked. Commenting is limited to contributors.
No description provided.