[PR #1849] [MERGED] d3d12: changed console heap slots are fixed without a time limit by default, not given to shaders as null (RT-CONSOLE-FIX-BUDGET-NULL) #1861

Closed
opened 2026-11-26 21:19:13 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: console-fix-no-null


📝 Commits (1)

  • c90092b d3d12: changed console heap slots are fixed without a time limit by default, not given to shaders as null (RT-CONSOLE-FIX-BUDGET-NULL)

📊 Changes

3 files changed (+8 additions, -7 deletions)

View changed files

📝 runtime/CMakeLists.txt (+1 -1)
📝 runtime/README.md (+1 -1)
📝 runtime/shims/d3d12_vulkan_device.cpp (+6 -5)

📄 Description

RT-CONSOLE-FIX-BUDGET-NULL, claimed and found in #1608.

What

LEONIDA_CONSOLE_FIX_US (the time one submission may spend fixing changed console heap slots, #1723) defaults to 0, no limit, instead of 4,000 us. The variable still sets a limit for whoever wants one. The d3d12_unmapped_vsharp test no longer needs to set it.

Why

Past the limit a changed slot is written to the GPU's copy of the heap as a null descriptor until its retry, so a shader reads zero from a buffer the title has filled. At the first world frame that hangs the GPU: lib_cs_01144 (64x32x1 groups) bounds its loops by cvt_u32(size0 / size1 * pixel), with size1 in one of the nulled slots. The compute input probe shows the slot zero in the GPU's copy and valid in the title's memory.

RTX 5080, NVIDIA 621.24, host image copy off with #1827 runs result
default 4,000 us 2 (m41, m43) device lost right after the first world frame, 136 and 150 fault entries of type 4 in one 4.5 KiB range, last checkpoint lib_cs_01144
LEONIDA_CONSOLE_FIX_US=0 3 (m44, m45, m46) no device loss (480, 210 and 240 s, stopped by the time limit)

Cost: nothing I can measure here. Average time in the heap copy per submission, at the same stages: 3.2 to 17.2 ms with the limit, 3.7 to 10.8 ms without, and the longest single one 581 ms against 593 ms (such spikes exist in both). With the limit 7,891 to 30,249 slots an interval were left to retries around the world start.

The comment in the code gives 28 s for one submission as the reason for the limit. I do not see that cost on this machine, but @Moriz82 measured it (speed-8); if it still occurs there, the alternative is to keep a limit for image descriptors whose texture is still missing and never defer buffer descriptors.

It does exist elsewhere: quartz-heron-58 measured, with no limit, 0.4 s rising to 8.2 s a submission in this phase at and after the world start on an RTX 4080 (2.3 ms before it, 150 to 200 ms with the limit), 146 submissions in 435 s; with #1887 on top the phase is 3 to 5 ms up to the world start and 3 to 35 ms around it. aslan2142 measured about 1.25 s a submission on an RX 7900 XTX. #1887 should follow this.

Tests

On main 98c2f7777, RTX 5080, Windows 11, VS 18 RelWithDebInfo: d3d12_unmapped_vsharp (now with the default), d3d12_console_descriptor_heap, d3d12_existing_heap and its two write-watch variants pass. No new test: exceeding a time limit on purpose is not deterministic, and the limit stays off by default. Not run: the whole ctest set, other GPUs.

AI-assisted (Claude Code, Claude Opus 5.5).

🤖 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/1849 **Author:** [@DadaCap](https://github.com/DadaCap) **Created:** 11/25/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `console-fix-no-null` --- ### 📝 Commits (1) - [`c90092b`](https://github.com/ubiquitarianism/leonida/commit/c90092b284ec264e93503c770d2c5b2d6137d78b) d3d12: changed console heap slots are fixed without a time limit by default, not given to shaders as null (RT-CONSOLE-FIX-BUDGET-NULL) ### 📊 Changes **3 files changed** (+8 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+1 -1) 📝 `runtime/README.md` (+1 -1) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+6 -5) </details> ### 📄 Description RT-CONSOLE-FIX-BUDGET-NULL, claimed and found in [#1608](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162983619). ## What `LEONIDA_CONSOLE_FIX_US` (the time one submission may spend fixing changed console heap slots, #1723) defaults to `0`, no limit, instead of 4,000 us. The variable still sets a limit for whoever wants one. The `d3d12_unmapped_vsharp` test no longer needs to set it. ## Why Past the limit a changed slot is written to the GPU's copy of the heap as a null descriptor until its retry, so a shader reads zero from a buffer the title has filled. At the first world frame that hangs the GPU: `lib_cs_01144` (64x32x1 groups) bounds its loops by `cvt_u32(size0 / size1 * pixel)`, with `size1` in one of the nulled slots. The compute input probe shows the slot zero in the GPU's copy and valid in the title's memory. | RTX 5080, NVIDIA 621.24, host image copy off with #1827 | runs | result | |---|---|---| | default 4,000 us | 2 (m41, m43) | device lost right after the first world frame, 136 and 150 fault entries of type 4 in one 4.5 KiB range, last checkpoint `lib_cs_01144` | | `LEONIDA_CONSOLE_FIX_US=0` | 3 (m44, m45, m46) | no device loss (480, 210 and 240 s, stopped by the time limit) | **Cost:** nothing I can measure here. Average time in the heap copy per submission, at the same stages: 3.2 to 17.2 ms with the limit, 3.7 to 10.8 ms without, and the longest single one 581 ms against 593 ms (such spikes exist in both). With the limit 7,891 to 30,249 slots an interval were left to retries around the world start. The comment in the code gives 28 s for one submission as the reason for the limit. I do not see that cost on this machine, but @Moriz82 measured it (speed-8); if it still occurs there, the alternative is to keep a limit for image descriptors whose texture is still missing and never defer buffer descriptors. It does exist elsewhere: quartz-heron-58 measured, with no limit, 0.4 s rising to 8.2 s a submission in this phase at and after the world start on an RTX 4080 (2.3 ms before it, 150 to 200 ms with the limit), 146 submissions in 435 s; with #1887 on top the phase is 3 to 5 ms up to the world start and 3 to 35 ms around it. aslan2142 measured about 1.25 s a submission on an RX 7900 XTX. #1887 should follow this. ## Tests On `main` 98c2f7777, RTX 5080, Windows 11, VS 18 RelWithDebInfo: `d3d12_unmapped_vsharp` (now with the default), `d3d12_console_descriptor_heap`, `d3d12_existing_heap` and its two write-watch variants pass. No new test: exceeding a time limit on purpose is not deterministic, and the limit stays off by default. Not run: the whole `ctest` set, other GPUs. AI-assisted (Claude Code, Claude Opus 5.5). 🤖 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 21:19:13 +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#1861
No description provided.