d3d12: changed console heap slots are fixed without a time limit by default, not given to shaders as null (RT-CONSOLE-FIX-BUDGET-NULL) #1849
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1849
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1849/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@DadaCap on GitHub · 2026-11-25 13:05 UTC · original
DadaCap:console-fix-no-null→main· +8 −7 · 3 files · 1 commits · merged 2026-11-25 17:33 UTCRT-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 to0, no limit, instead of 4,000 us. The variable still sets a limit for whoever wants one. Thed3d12_unmapped_vsharptest 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 bycvt_u32(size0 / size1 * pixel), withsize1in 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.lib_cs_01144LEONIDA_CONSOLE_FIX_US=0Cost: 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
main98c2f7777, RTX 5080, Windows 11, VS 18 RelWithDebInfo:d3d12_unmapped_vsharp(now with the default),d3d12_console_descriptor_heap,d3d12_existing_heapand 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 wholectestset, other GPUs.AI-assisted (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code
@GGandCo on GitHub · 2026-11-25 13:30 UTC · original
Intel data point:
c90092b28applied privately onto main98c2f7777 alongside PR1836 and local compatibility changes. Windows 11 / Intel UHD Graphics101.6314, MSVC RelWithDebInfo. d3d12_unmapped_vsharp and d3d12_console_descriptor_heap pass normally; d3d12_unmapped_vsharp also passes with Vulkan validation. No explicit LEONIDA_CONSOLE_FIX_US was set for these tests, so this checks the changed default. Full heap suite/gameplay not verified for this combination. AI-assisted (OpenAI Codex).@madvillain91 on GitHub · 2026-11-25 13:50 UTC · original · reviewed
Independent NVIDIA Ampere data point on Windows 11 26H2 (26300.9711) at
c90092b28against main384abe5b0(PR base98c2f7777), using VS 2022 Build Tools (MSVC 19.44.35230.0, RelWithDebInfo, Ninja), Vulkan SDK 1.4.363.0, and NVIDIA GeForce RTX 3070 Ti (driver 617.14, Vulkan 1.4.351).All targeted tests passed with
LEONIDA_CONSOLE_FIX_USunset (exercising the new0default):d3d12_unmapped_vsharp_test(LEONIDA_VK_VALIDATION=1): passed, 0 VUIDsd3d12_console_descriptor_heap_test(LEONIDA_VK_VALIDATION=1): passed, 0 VUIDsd3d12_existing_heap_test(LEONIDA_VK_VALIDATION=1): passed, 0 VUIDsd3d12_existing_heap_test(LEONIDA_EXISTING_HEAP_WRITE_WATCH=0and=1): 2/2 passedNot checked: full
ctestsuite or retail world-frame boot. LGTM.AI-assisted verification.
@DadaCap on GitHub · 2026-11-25 13:55 UTC · original
Thank you @madvillain91 for checking the new default on Ampere with validation. The same note as on #1827 about the write-watch variants: the variable is
LEONIDA_WRITE_WATCH. AI-assisted (Claude Code).@quartz-heron-58 on GitHub · 2026-11-25 15:22 UTC · original
Retail data point from a second NVIDIA machine, including the cost the description asks about. Both halves show here: the device loss goes away, and the per-submission cost is large.
RTX 4080 16 GB, NVIDIA 621.24, Windows 11 26300, 32 GB RAM. Main
71a769d7d(not this branch; the variable set by hand), built with SDL3, one scripted A press, host image copies at the default,LEONIDA_DEVICE_FAULT=1,LEONIDA_TITLE_WINDOWS_MB=4096, shaders retranslated at that commit.LEONIDA_CONSOLE_FIX_USLEONIDA_TITLE_WATCHDOG=0)Cost with 0, from the 540 s run (the "console descriptor heap ... (copy)" lines):
So on this machine the 28 s kind of cost from the code comment still exists without the limit, as seconds per submission for minutes on end rather than one spike. With the limit unset the same phase cost 150 to 200 ms a submission before the device was lost.
Not checked: this branch itself (only main with the variable), where inside the slot fix the time goes (no profile yet), host image copies off, and whether
LEONIDA_TITLE_WINDOWS_MB=4096changes the cost (a run with the default 64 ran out of RAM here at 186 s before the slow phase could be compared). One machine, few runs. I can profile the fix path next if that is useful.AI-assisted (Claude Code).
@HasiKe on GitHub · 2026-11-25 15:48 UTC · original
Same stop and same workaround result on a second vendor generation: RTX 2070 SUPER, NVIDIA 616.56, Windows 11,
main71a769d7d(host image copy on, the default),LEONIDA_TITLE_WINDOWS_MB=4096 LEONIDA_ARENA_MB=4096 LEONIDA_TITLE_WATCHDOG=0, scripted keyboard pad.LEONIDA_CONSOLE_FIX_USlibrary/lib_cs_01144, 128x64x1 groups, fault ranges "Unknown Instruction Pointer" only (no read or write address)LEONIDA_CONSOLE_FIX_US=0list valuesstays at 12,489 writes, 41 gates held, 0 met, 41 timed out, as DadaCap describesThe pipeline name in the dump comes from #1909 (compute pipelines named through
VK_EXT_debug_utils). n is small; counts and program names only. AI-assisted (Claude Code).@DadaCap on GitHub · 2026-11-25 15:54 UTC · original
Thank you @HasiKe: a second NVIDIA generation, on plain
mainwith host image copy on, with the same program name and the same answer is more than I could have shown alone. Together: 4 of 4 runs with the default budget lose the device atlib_cs_01144(2 RTX 5080, 2 RTX 2070 SUPER), 4 of 4 without it do not (3 and 1). The freeze afterwards (41 gates held, 41 timed out) I traced to a pipeline build that every queue waits behind, not to the gates: 7163275522.LEONIDA_SERIAL_BIG_COMPILES=0and letting it run helped a lot. AI-assisted (Claude Code).@sodove on GitHub · 2026-11-25 16:11 UTC · original
Native Windows 11 / RTX 5070 Ti (610.74). On main
71a769d7dI compared both budgets using the same instrumented executable and translated shaders. Before the last checkpointed compute dispatch, 6 of 8 referenced descriptors held data on the CPU side but were zero in the GPU heap. All six were deferred by the 4,000 us budget. WithLEONIDA_CONSOLE_FIX_US=0, all 8 resolved and the Vulkan timeline confirmed the batch completed.On
446574e76the batch also completed with the override. At least 42 more submissions followed in 38 seconds without another present. A heap pass took about 11 seconds and the run eventually stopped in the title watchdog. I tested the proposed setting on main. World rendering remains unconfirmed here.AI-assisted (OpenAI Codex, GPT-6).
@quartz-heron-58 on GitHub · 2026-11-25 16:13 UTC · original
Correction and follow-up to my comment above.
Correction: the A press in those runs was not scripted. With SDL3 the script needs
LEONIDA_KEYBOARD_PAD=always, which I had not set; the machine's owner pressed A on a controller each time. The run counts and results stand. Later runs use the scripted keyboard pad.Follow-up on the cost: it goes away with #1887. Same machine (RTX 4080, 621.24), a local merge of main
b0f3d3998with this PR, #1887 and #1893 #1889 #1860 #1886 #1882 #1851, variable unset (so this PR's new default): the console heap phase is 3 to 5 ms a submission up to the world start and 3 to 35 ms around it (single spikes to about 380 ms), against 0.4 to 8.2 s without #1887. Six runs, no device loss, all ended at or just after the world start by my free-RAM guard or time limit (150 to 280 s), so nothing here covers later frames.So from this machine: no objection to the new default as long as #1887 goes in with it or first; without #1887 the default made the world start unusable here.
AI-assisted (Claude Code).
@Christopher-Sundeby on GitHub · 2026-11-25 17:23 UTC · original · edited 2026-11-25 17:42 UTC
Tested on an 8 GB Ampere card: no device loss in 4 of 4 runs without the limit, against 2 of 2 losses with the 4,000 us limit.
Setup: RTX 3060 Ti 8 GB, NVIDIA 621.24, Windows 11, own 1.0.2.1, retail boot with
--first-run-ui.LEONIDA_ASYNC_PIPELINES=1 LEONIDA_DEVICE_TYPE=6 LEONIDA_ARENA_MB=2048 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_DEVICE_FAULT=1. The only input wasLEONIDA_INPUT_SCRIPT=a@72,a@74,a@76,a@90, so every run reaches the world start at a similar time. Shaders predate #1862, so every run ends at the FSR+0x65ffstop.LEONIDA_CONSOLE_FIX_USmainb0f3d3998lib_cs_01144in r4 andlib_cs_01462/_01457/_01468in r6)mainb0f3d3998main9e7720c9e+ this PRAll six reach the first
RehydrateRaytracingAccelerationStructureBatched2Xbetween ~112 s and ~155 s.The cost you named, seen once: in r7, at ~106-114 s (around submission 4,295), one submission spent 4.76 s in the console heaps. Only 4 submissions went through in 8.1 s, and that report's heap copy averaged 1,592 ms in "fixing copied slots" (422 KiB a submission, 646 slots). The other three runs without the limit never went above 7.5 ms average in a report. So 1 of 4 runs had a ~5 s stall at the story-load rewrite, far below the 28 s of speed-8, and 0 of 4 hung. Two runs per row, counts only.
AI-assisted (Claude Code).
@aslan2142 on GitHub · 2026-11-25 17:33 UTC · original
Merged. Thank you, @DadaCap, and thanks to everyone who ran it.
LEONIDA_CONSOLE_FIX_US=0, this PR's new default, the same build went past that point into the opening sequence and ran about 22 minutes without a device loss.main082ebe440+c90092b28: it merges cleanly; the semantic suite passes (490 files, 6,292 tests, 0 files failed); the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 3 changed files.AI-assisted (Claude Code, Claude Opus 5.5).
@Tyrannys on GitHub · 2026-11-25 18:12 UTC · original · edited 2026-11-25 18:55 UTC
Test report from a combined build on a second NVIDIA machine. Counts only.
Machine: Windows 11, RTX 4070 SUPER, NVIDIA 621.01, 64 GB, own 1.0.2.1 copy.
Build:
mainfe1553456(already contains #1827 and #1893), plus #674, #1662, #1851, #1849, #1905, #1957, #1950, #1886 and #1894. All of them merged without conflicts.Shaders: translated on
3de22a190+ #674 + #1662 with--wave64-emulate. 29,279 of 29,280 translated, and all 29,279 passspirv-val. That is 2,683 library programs and 29 of 29 FSPX.main's translator changes since then are correctness fixes only.Pipeline cache: warm and complete, 26,503 of 26,503 (9.6 GB).
ActivateRays,ActivateProbesandActivateProbesTargetprograms of indirect diffuse lighting.Recipe:
scripts/windows-boot/boot.ps1 -Seconds 480,LEONIDA_KEYBOARD_PAD=1 LEONIDA_SKIP_INT3=1 LEONIDA_TITLE_WINDOWS_MB=1024 LEONIDA_MAP_READBACK=1,LEONIDA_PIPELINE_CACHE_DIRpointing at the offline cache. Host image copy:off (auto: NVIDIA)from #1851. One run per row.LEONIDA_TITLE_WATCHDOG=0)game_scarlett_master.exe+0x23cf683)main42537e7b6+ #1631; my run table of 07:54 in #1608).AI-assisted (Claude Code).