Repository navigation
Conversation
BindlessSet::update_image marked an index's storage views used even when the index was past the storage arrays (an image added without storage views gets one from the upper, sampled-only range), where write_image writes no storage descriptor. image_kind_at then gave the index a storage bit, and a tagged module would index the shorter storage array out of bounds. The same held for a 2D mirror's storage views. update_image now marks storage only below the storage capacity, and image_kind_at checks the same bound. add_image and image_kind_at also set the sampled bit for a 1D-array image, whose dimension has no sampled array; they no longer do. Test: bindless_kind_bits (a fake Vulkan device, no GPU) with the repro from kevincommits's finding in ProjectLeonida#1608. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clquwu
added a commit
to clquwu/leonida-ultimate
that referenced
this pull request
Nov 27, 2026
…imits permit - Add bindless::max_images_2d = 131072 in runtime/src/vulkan_bindless.h while keeping max_images = 65536 for 2D-array, 3D, and 1D so high-limit GPUs (RTX 3080/5070, RADV, llvmpipe, Intel Xe-LP) prevent live 2D T# overflow (64,221 live 2D T#s of 56,006 textures observed at 65,536 on RTX 3080) without bloating the other dimensions. - In bindless::size_bindings(), grow all four single-sample dimensions to max_images (65,536) first, then grow dim_2d up to max_images_2d (131,072) only after 2D-array/3D/1D have reached max_images, preserving fair sizing on mid-limit and pool-limited GPUs (and scaling 2D storage when match_storage_to_sampled is enabled). - Verified full 32-bit bindless slot indices end-to-end across descriptor_table.h, vulkan_bindless.h, d3d12_vulkan_device.cpp, and tools/rdna2spirv.py (no 16-bit packing or truncation). - Audited ProjectLeonida/mandy#2496 (RT-BINDLESS-KIND-BITS) against ultimate HEAD: skipped as N/A because its prerequisite tagged descriptor table (kind_sampled_bit / kind_storage_bit / MirrorViews / image_kind_at from upstream #2098) is not present in ultimate, and BindlessSet already bounds-checks storage writes and skips sampled writes for dim_1d_array. - Expand bindless_sizing_test with 131,072 2D sizing/cap tests and a CPU-only 131,071-slot BindlessSet 32-bit lookup + OOB-storage + 1D-array safety test; fix bindless_queue_test's stale 6-dimension/no-dim_1d_array/held-slot model; update docs/d3d12_vulkan.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: RT-BINDLESS-KIND-BITS (#1608 (comment)), item 1 of @kevincommits' finding (#1608 (comment)). Thanks to kevincommits for finding it and for the repro values.
What and why
The kind word that
BindlessSetgives an image index tells a tagged module (descriptor_table: tagged) which arrays to index (descriptor_table.h's kind bits). In two cases,runtime/src/vulkan_bindless.hset a bit for an array that holds no descriptor for the image.Storage bit past the storage arrays. The storage arrays are shorter than the sampled ones (
storage_capacity<image_capacity, for example 256 and 4096 for 2D).add_imagegives an image without storage views an index from the upper, sampled-only range. Ifupdate_imagelater gives that index storage views,write_imagewrites no storage descriptor there. Butupdate_imagestill marked the slot's storage used, both for the image and for its 2D mirror. Soimage_kind_at(andkind_out) reported a storage bit for an index past the storage arrays. A module trusting it would read the storage array out of bounds.Now:
update_imagemarks storage only below the dimension's storage capacity, and a mirror's only below the 2D one.image_kind_atchecks the same bound when it reads the marks.Sampled bit for a 1D array.
ImageDimension::dim_1d_arrayhas no sampled binding; its images are storage only. Yetadd_imageandimage_kind_atset its sampled bit anyway. Both now set the sampled bit only for a dimension that has a sampled array, throughsampled_kind.The descriptors written are unchanged. Only the kind words change, in these two cases.
Tested
bindless_kind_bits(runtime/test/bindless_kind_bits_test.cpp). It runsBindlessSeton a fake Vulkan device, so no GPU is needed, with the default capacities and kevincommits' repro:update_imagewithas_float, its kind is the sampled bit only (main:0x101).0x303).add_image,image_kind_atandupdate_image(main:0x1010).main's header the test fails with 5 failures. With the fix it passes.bindless_sizing,descriptor_table,d3d12_comandtests/test_ci_registration.pypass.vk_bindless_dimensions,vk_bindless_growandvk_null_descriptor.GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 (profile M), for the three short GPU tests. The new test needs no GPU.
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code