[PR #1092] [CLOSED] vulkan: retain a valid bindless table under pressure (RT-BINDLESS-TABLE-DEGRADE) #1125

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1092
Author: @Moriz82
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: split/rt-bindless-table-degrade


📝 Commits (1)

  • 84de57c vulkan: retain a valid bindless table under pressure (RT-BINDLESS-TABLE-DEGRADE)

📊 Changes

2 files changed (+91 additions, -6 deletions)

View changed files

📝 runtime/src/vulkan_bindless.h (+2 -0)
📝 runtime/test/vk_bindless_grow_test.cpp (+89 -6)

📄 Description

Claimed in the coordination issue as: RT-BINDLESS-TABLE-DEGRADE (claim).

Part of the split of #984 into small pull requests.

Depends on: none
Overlaps: #984 contains the integration. #425 covers descriptor-set
recycling and its pool budget. This child can land independently of it.

What and why

Under device-local memory pressure, a bindless table rebuild could fail
and cause ExecuteCommandLists to refuse the whole submission. The smaller
sampled-image arrays could also fill during streaming.

A replacement table can use coherent host-visible memory. If allocation
fails, the runtime releases completed generations and retries. An idle
table can be rewritten in place if it still fits. When those paths fail,
work can use the last table submitted to the GPU. New keys resolve to the
fallback and removed indices stay reserved until the table catches up.
The first upload must reach the queue before any submission can use this
fallback. Device loss still propagates.

Device limits now permit up to 16,384 sampled 2D-array images and 4,096
each for 3D and 1D. The existing layout and per-stage limits still apply.

Tested

Release cross-build with clang-cl 23.1.5 and an xwin SDK on CachyOS,
kernel 7.3.5. Runtime tests used Proton Experimental (Wine 11), a Ryzen
5 5600X, 16 GB RAM and an RTX 4070 12 GB with NVIDIA 620.73.04. CMake
omitted the optional XMA2 decoder because the Rust Windows target was
unavailable.

build=runtime/build/boot
for target in gta6rt bindless_sizing_test vk_bindless_grow_test \
              d3d12_bindless_churn_test; do
  cmake --build "$build" --target "$target" -j6
done
wine "$build/bindless_sizing_test.exe"
wine "$build/vk_bindless_grow_test.exe"
wine "$build/d3d12_bindless_churn_test.exe"
python3 -I scripts/run_semantic_tests.py tests/semantic -j 2
python3 -I scripts/check_no_game_data.py
git diff --check HEAD^ HEAD

The sizing test passed, with 152,929 descriptors on synthetic RTX
5070-like limits. The GPU pressure test passed 41/41 checks. It observed
one host-memory fallback, one idle rewrite and two degraded flushes, then
recovered to a 256-slot table. It also rejected a first upload under
pressure, a discarded upload and a simulated device loss.

D3D12 churn passed all four runs. Each compared 98,304 texels over 96
frames on direct and compute queues, with zero mismatches. The two
deferred-retirement runs each made three generations and recorded zero
device-idle waits. The two legacy runs each recorded three waits.

The semantic suite passed 6,168 tests across 470 files. The content and
whitespace checks passed.

Review round 1. A review proposed keeping descriptor writes pending
across a degraded flush, so that a key rebound while the old table is
kept does not find the fallback. That is not taken: the device destroys
a removed texture's views right after remove_image, so a removed
image's descriptors must go back to the fallback at the next flush even
when that flush keeps the old table. Otherwise a key the old table still
maps to that index finds a destroyed view. The pressure test now records
what every image descriptor names and checks after each flush that the
current set names no destroyed view. It passes 50/50 checks on this head
(41 before the new checks), natively on Linux and as a Windows program
under Wine 11.22, on an RTX 4070 (NVIDIA 620.73.04). With pending writes
kept, it exits 1 at the removal between the two degraded flushes: the
current set's binding 0, element 256 names a destroyed view. The runs
described above and below were made on the head before this round; only
the test file changed since.

For the control, rebuild the GPU pressure test with only the previous
refusal restored. Change the guard in BindlessSet::flush from
!written && must_replace && !table_on_gpu_ to
!written && must_replace. Link with the same flags and run the same
test. The control passed 17 checks and stopped at check 18 with exit 1:
the busy flush refused the submission. The remaining 23 checks did not
run in this control.

The sizing control omits the three new calls to grow the 2D-array, 3D
and 1D bindings. It passed the first five checks, then exited 1 at the
first check for the larger sampled-image arrays.

Two integration runs on Windows 11 (i9-13900K, RTX 4070 Ti, NVIDIA
630.20) used host memory and continued without refusing a batch. Neither
run exercised a degraded flush. This standalone child was not run on
native Windows, AMD or Intel, with validation layers, or in a game boot.

GPUs tested: NVIDIA GeForce RTX 4070.
AI-assisted: yes

Checklist

  • One topic on current main, verified with a clean merge.
  • No game data. All GPU inputs are synthetic.
  • No translator rule changes.

🤖 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/1092 **Author:** [@Moriz82](https://github.com/Moriz82) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `split/rt-bindless-table-degrade` --- ### 📝 Commits (1) - [`84de57c`](https://github.com/ubiquitarianism/leonida/commit/84de57c0e7f5558eaf67bd51b87bc66579f4ece9) vulkan: retain a valid bindless table under pressure (RT-BINDLESS-TABLE-DEGRADE) ### 📊 Changes **2 files changed** (+91 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/vulkan_bindless.h` (+2 -0) 📝 `runtime/test/vk_bindless_grow_test.cpp` (+89 -6) </details> ### 📄 Description Claimed in the coordination issue as: RT-BINDLESS-TABLE-DEGRADE ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140400896)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #984 contains the integration. #425 covers descriptor-set recycling and its pool budget. This child can land independently of it. ### What and why Under device-local memory pressure, a bindless table rebuild could fail and cause ExecuteCommandLists to refuse the whole submission. The smaller sampled-image arrays could also fill during streaming. A replacement table can use coherent host-visible memory. If allocation fails, the runtime releases completed generations and retries. An idle table can be rewritten in place if it still fits. When those paths fail, work can use the last table submitted to the GPU. New keys resolve to the fallback and removed indices stay reserved until the table catches up. The first upload must reach the queue before any submission can use this fallback. Device loss still propagates. Device limits now permit up to 16,384 sampled 2D-array images and 4,096 each for 3D and 1D. The existing layout and per-stage limits still apply. ### Tested Release cross-build with clang-cl 23.1.5 and an xwin SDK on CachyOS, kernel 7.3.5. Runtime tests used Proton Experimental (Wine 11), a Ryzen 5 5600X, 16 GB RAM and an RTX 4070 12 GB with NVIDIA 620.73.04. CMake omitted the optional XMA2 decoder because the Rust Windows target was unavailable. ```sh build=runtime/build/boot for target in gta6rt bindless_sizing_test vk_bindless_grow_test \ d3d12_bindless_churn_test; do cmake --build "$build" --target "$target" -j6 done wine "$build/bindless_sizing_test.exe" wine "$build/vk_bindless_grow_test.exe" wine "$build/d3d12_bindless_churn_test.exe" python3 -I scripts/run_semantic_tests.py tests/semantic -j 2 python3 -I scripts/check_no_game_data.py git diff --check HEAD^ HEAD ``` The sizing test passed, with 152,929 descriptors on synthetic RTX 5070-like limits. The GPU pressure test passed 41/41 checks. It observed one host-memory fallback, one idle rewrite and two degraded flushes, then recovered to a 256-slot table. It also rejected a first upload under pressure, a discarded upload and a simulated device loss. D3D12 churn passed all four runs. Each compared 98,304 texels over 96 frames on direct and compute queues, with zero mismatches. The two deferred-retirement runs each made three generations and recorded zero device-idle waits. The two legacy runs each recorded three waits. The semantic suite passed 6,168 tests across 470 files. The content and whitespace checks passed. **Review round 1.** A review proposed keeping descriptor writes pending across a degraded flush, so that a key rebound while the old table is kept does not find the fallback. That is not taken: the device destroys a removed texture's views right after `remove_image`, so a removed image's descriptors must go back to the fallback at the next flush even when that flush keeps the old table. Otherwise a key the old table still maps to that index finds a destroyed view. The pressure test now records what every image descriptor names and checks after each flush that the current set names no destroyed view. It passes 50/50 checks on this head (41 before the new checks), natively on Linux and as a Windows program under Wine 11.22, on an RTX 4070 (NVIDIA 620.73.04). With pending writes kept, it exits 1 at the removal between the two degraded flushes: the current set's binding 0, element 256 names a destroyed view. The runs described above and below were made on the head before this round; only the test file changed since. For the control, rebuild the GPU pressure test with only the previous refusal restored. Change the guard in BindlessSet::flush from `!written && must_replace && !table_on_gpu_` to `!written && must_replace`. Link with the same flags and run the same test. The control passed 17 checks and stopped at check 18 with exit 1: the busy flush refused the submission. The remaining 23 checks did not run in this control. The sizing control omits the three new calls to grow the 2D-array, 3D and 1D bindings. It passed the first five checks, then exited 1 at the first check for the larger sampled-image arrays. Two integration runs on Windows 11 (i9-13900K, RTX 4070 Ti, NVIDIA 630.20) used host memory and continued without refusing a batch. Neither run exercised a degraded flush. This standalone child was not run on native Windows, AMD or Intel, with validation layers, or in a game boot. GPUs tested: NVIDIA GeForce RTX 4070. AI-assisted: yes ### Checklist - [x] One topic on current main, verified with a clean merge. - [x] No game data. All GPU inputs are synthetic. - [x] No translator rule changes. 🤖 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>
4ld0 2026-11-26 20:20: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#1125
No description provided.