d3d12: on a card under 6 GB the launcher leaves buffer copies to the runtime and keeps windows out of VRAM #2583
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2583"
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?
Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-28T19:04:09Z.
Claimed in the coordination issue as: item 1 of my VRAM finding (#2570#issuecomment-7244160627). Nobody has taken it; this is the small part only.
What and why
play-nvidia.ps1sets two memory limits that were measured on large cards:LEONIDA_CARD_BUFFERS_MB=1536on every card. It overrides the runtime's own sizing by the VRAM budget (shadow.rsdefault_card_limits_mb: 512 MiB at ≤ 12 GiB).LEONIDA_WINDOWS_BAR_MB=3072on every PC under 48 GB of RAM.On a 4 GB card the two together are more than the whole budget: 5.5 GB in use of 3.2 GB, and the system pages the rest out.
The launcher now reads the card's memory from its driver key (
HardwareInformation.qwMemorySize;AdapterRAMstops at 4 GB). Under 6 GB it leavesLEONIDA_CARD_BUFFERS_MBto the runtime and keeps the windows out of VRAM, and says so in one line.-Moreand-WindowsBarMBstill override. Nothing changes at 6 GB and above.Tested
-DryRunon that card: neither variable is set, the new line is printed, and-More @{LEONIDA_CARD_BUFFERS_MB='1536'}still gives 1536.GPUs tested: GTX 1050 Ti 4 GB (Pascal, profile S), 582.66, Windows 10.
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T19:33:01Z.
Tested the Windows launcher at
5e85a5e3137a. The 6 GiB cutoff works for a single adapter. On a simulated two-GPU system, selecting the 4 GiB card still produced the larger card’s budgets.I ran the unmodified
play-nvidia.ps1 -DryRun -NoDlss -NoSmoothMotionwith an empty placeholder executable, 32 GiB of simulated system RAM, and no saved menu settings. The two outputs below areLEONIDA_CARD_BUFFERS_MBandLEONIDA_WINDOWS_BAR_MB. “Omitted” means the launcher left the variable out of its settings.-WindowsBarMB 0-More-Adapter '1050 Ti'The parent (
8b318bd4037e) gave 1536/3072 in the single 4 GiB case. On the PR, the launcher forwards1050 Tiin both selection cases, but budgets from the largest registry entry. The runtime resolves that selector against DXGI adapters. The registry can also contain an extra card in practice. On the physical test PC, Windows reported an RTX 4090 and Radeon graphics through CIM, while the display-class scan also returned an 8 GiB RTX 2070 SUPER entry.Could the launcher take the budget from the adapter the runtime selects, or defer to the runtime when it cannot identify that adapter? A 4 GiB selection with an 8 GiB secondary entry would make a good regression case. These are launcher settings only. No game or GPU workload ran.
AI-assisted verification with OpenAI Codex (GPT-6).
Follow-up on the binary registry-value review. I repeated the dry run on Windows PowerShell 5.1 and PowerShell 7.6 with eight-byte little-endian values from
BitConverter.GetBytes(Int64). Both versions stopped querying adapters at the first binary value and retained any earlier integer reading. With the same simulated 4 GiB integer and 8 GiB binary entries, integer first omitted both budgets, while binary first produced 1536/3072 and never queried the 4 GiB entry. With a third, 24 GiB integer entry after the binary one, the launcher never queried that entry either. All-integer controls read every entry. This adds an order-dependent case for the fix. Registry formats were simulated, and no GPU workload ran.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T20:10:27Z.
Review: COMMENTED
Reviewed
5e85a5e31(d3d12/scripts/play-nvidia.ps1).Local checks:
Parser::ParseFile): 0 syntax errors.python -I scripts/check_no_game_data.py: passed.Int6412820938752(~11.94 GiB), so the script leaves the>= 6 GBpath intact there.Holding off on approval because I second @ecox982745's finding on adapter-agnostic VRAM detection:
HardwareInformation.qwMemorySizeacross all{4d36e968-e325-11ce-bfc1-08002be10318}subkeys breaks on multi-GPU systems (or systems with stale secondary adapter keys) when-Adapterselects a< 6 GBcard alongside a larger adapter, because the larger card's VRAM suppresses the< 6 GBfallback.HardwareInformation.qwMemorySizeis stored asREG_BINARY(byte[]) rather thanREG_QWORD, where[uint64]$qfails and silently falls back to$vram = 0(>= 6 GBbehavior). Matching the selected adapter (e.g. via DXGIDedicatedVideoMemoryor matchingDriverDescagainst-Adapter) and handlingbyte[]viaBitConverter::ToUInt64would make this reliable across setups.AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:17:05Z.
Native Windows 11 + RTX 3090 Verification (
5e85a5e313)Diff-audited
d3d12/scripts/play-nvidia.ps1(+20/-1) and executed-DryRun+ live Windows registry adapter probes merged ontoorigin/main(adfb3821a2) on Windows 11 (10.0.26200, Windows PowerShell5.1, NVIDIA GeForce RTX 309024 GiB,128 GiBRAM).Live Hardware & Registry Results
{4d36e968-e325-11ce-bfc1-08002be10318}):0000:DriverDesc = 'NVIDIA GeForce RTX 3090',HardwareInformation.qwMemorySize=System.Int6425769803776(24 GiB).0001:DriverDesc = 'Microsoft Remote Display Adapter',HardwareInformation.qwMemorySize = $null.-DryRunon RTX 3090 (powershell -NoProfile -ExecutionPolicy Bypass -File d3d12/scripts/play-nvidia.ps1 -Exe <stub> -DryRun):0, ignores$nullon virtual display subkey0001, evaluates$smallCard = $false(24 GiB >= 6 GiB), and matchesorigin/mainidentically (LEONIDA_CARD_BUFFERS_MB=1536,LEONIDA_CARD_BUFFERS_MIN_KB=64,LEONIDA_CARD_BUFFERS_MIN_MB=1).REG_BINARY(System.Byte[])qwMemorySizeaborts theForEach-Objectpipeline: Reproducing a[byte[]]value (8-byte little-endianREG_BINARY, used by several older/virtual/iGPU display INF entries) on subkey0000ahead of a4 GiB[uint64]card on subkey0001throwsCannot convert the "System.Byte[]" value of type "System.Byte[]" to type "System.UInt64", escapingForEach-Objectinto the outercatch {}and leaving$vram = 0($smallCard = $false). Wrapping the per-subkey parse insideForEach-Objectand decoding[byte[]](if ($q -is [byte[]] -and $q.Length -ge 8) { $q = [BitConverter]::ToUInt64($q, 0) }) keeps subsequent subkeys reachable.-Adapteroverride: As noted earlier in the thread, when-Adapterselects a< 6 GiBsecondary GPU alongside a>= 6 GiBadapter in the registry, taking the unconditional max across subkeys keeps the large-card budgets (1536/3072).scripts/check_no_game_data.pyandtests/test_text_write_line_endings.py(3/3) pass (rc=0).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:47:20Z.
RUN of #2583 (native Windows, no game files). No cargo test covers this change (it only touches the launcher script), so the red/green is a -DryRun comparison, not a cargo run.
Heads: PR
5e85a5e313, PR base (merge-base)8b318bd40, main1bc055e6c. git merge-tree --write-tree main pr-2583 merges cleanly.Machine: NVIDIA GeForce RTX 3090 24 GB, driver 621.40, Windows 11 Pro 10.0.26300, 64 GB RAM.
Method: play-nvidia.ps1 -Exe -DryRun (it builds and starts nothing), once with the script at the PR base (RED side) and once at the PR head (GREEN side). A small wrapper script defines stand-ins for Get-ChildItem / Get-ItemProperty (the display-driver key) and Get-CimInstance (RAM) for that one process, so card and RAM sizes can be chosen without touching the registry or the machine.
Results (LEONIDA_CARD_BUFFERS_MB / LEONIDA_WINDOWS_BAR_MB in the printed settings):
So the change is visible only under 6 GB, as described.
Not checked: any real card under 6 GB (the PR's own GTX 1050 Ti measurements of speed are not reproducible here), and the game itself.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:06:28Z.
Merged after enlight3d (Thib)'s red/green run (RUN, RTX 3090, driver 621.40, Windows 11: green with this PR, red without it, and
gta6rt.exestill links) and a re-check here: no conflict withmainfd4289870, same head as run,no-game-datagreen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known onmainor Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ).AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.