play-nvidia: an eight-byte qwMemorySize is decoded, not cast (D3D12-VRAM-BYTES) #3279
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!3279
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/play-nvidia-vram-bytes"
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?
Pull request successfully merged and closed
Item: D3D12-VRAM-BYTES (claimed in #2570). Comes from @merzleckeier's review on #3272.
What changes
play-nvidia.ps1's$vramis the largestHardwareInformation.qwMemorySizeof the display class. The script cast that value straight to[uint64]. Some drivers write it as eight little-endian bytes (REG_BINARY): the cast then threw inside the walk's singletry, and the walk stopped at that adapter.Under the Series X 20 GB rule for frame generation with ray tracing, this gave the wrong answer twice. The launcher's
card_factsdecodes the bytes, so it said the opposite each time:The fix:
[BitConverter]::ToUInt64($q, 0).try, so an odd value skips that adapter only, not the rest of the walk.Tested
Windows 11, Windows PowerShell 5.1. Script only, no game run.
test_nvidia_frame_generation_with_ray_tracing: the registry stub now takes several adapters, each an integer or a byte array. Four new cases:python -m unittest discover -s tests -p test_win_launchers.py: 11 tests OK.tests/test_text_write_line_endings.pyOK;scripts/check_no_game_data.pyon both files OK.AI-assisted (oreofr-agent, Claude Code).
🤖 Generated with Claude Code
I reran the eleven synthetic VRAM budget cases from #2600 on main at d15e048a and this PR at beb14940. Both Windows PowerShell 5.1 and PowerShell 7 went from 6/11 to 9/11. Binary 4 GiB now correctly omits both memory budgets, and a short byte array no longer prevents a later valid adapter from being counted.
Two cases still stop the scan before the sole usable 4 GiB reading. A terminating property-read error occurs outside the per-adapter try, and Get-ChildItem with ErrorAction Stop terminates on a nonterminating enumeration error. Both cases leave VRAM unknown and emit the 1,536 MiB card-buffer and 3,072 MiB window budgets.
In a disposable copy of this head, I moved Get-ItemProperty into the per-adapter try with ErrorAction Stop and used ErrorAction SilentlyContinue for the class enumeration. The existing decode and size policy stayed intact. All 11 cases passed in each shell. These were launcher dry runs with simulated registry entries and no game or GPU workload. AI-assisted with OpenAI Codex.
Thanks @merzleckeier and @ecox982745. Both are addressed in 7809f10bf.
card_memorynow read only an integer (REG_QWORD/REG_DWORD) or exactly eight little-endian bytes. A shorter or longer array, or a string, is no size on both sides.Get-ItemPropertynow runs with-ErrorAction Stopinside the per-adaptertry, so a terminating read error skips that adapter;-ErrorAction SilentlyContinue, then walked with aforeach, so a listing error no longer ends the walk.Seven new dry-run cases:
card_memory's test also gains the 5-byte and 9-byte arrays.Results:
tests/test_win_launchers.py: 11 OK in Windows PowerShell 5.1.tests/test_leonida_launcher.py: OK.(oreofr-agent, AI-assisted)
Rechecked
7809f10bwith #3272 at6d9a22f5ond15e048a. Settings and PowerShell agreed in all eleven cases, including the five previously divergent ones. The launcher suites had 110 passes and seven skips with PowerShell 7.7.0 on Linux, including the new synthetic registry-error cases.Merge-order note: the two PRs now conflict only in
tests/test_leonida_launcher.py. Keeping #3272’s tests and adding #3279’s two short/long-array assertions resolves the conflict. The results above are from that locally resolved tree. AI-assisted with OpenAI Codex.VERIFY-3279 — Windows nativo: la decodificación muerde, y es el caso que pedí
Corrí las dos suites que toca, en el head (
7809f10bf):Control (sintético): quité la decodificación — la línea
if ($q -is [byte[]]) { $q = … [BitConverter]::ToUInt64($q, 0) … }sustituida por un comentario — y volví a correr:Muerde, y muerde en la tabla de casos — el test compara un diccionario de perfiles contra lo que el dry run dice de cada uno, así que el control no rompe una aserción sino la tabla entera, que es lo que se quiere de un caso de representación.
Y es exactamente lo que merzleckeier describió en
#3272— "decoding the eight-byte value with[BitConverter]::ToUInt64($q, 0)before the cast made both cases agree" — con la diferencia de que aquí está en el script y probado, en vez de en una copia desechable. Las dos formas que él enumeró (sólo ocho bytes, y entero seguido de ocho bytes) están en la tabla, y el caso del adaptador que lanza al leer el registro ($global:listError,Write-Error 'Requested registry access is not allowed.') también, que es el que evita que un adaptador raro se lleve el recorrido entero.Lo que no probé: el registro de verdad — el test sustituye
Get-CimInstancey el registro por funciones de prueba, así que lo verificado es que el script decodifica lo que le dan y que la tabla de perfiles cuadra, no que un driver concreto escriba esos ocho bytes en esta máquina.Written with an AI assistant.
Merging (OreoFR's OK): head
7809f10bfon maind15e048a7, CI green on all six checks, the review findings of merzleckeier and ecox982745 addressed in 7809f10bf. Sent to the merge queue. (oreofr-agent, AI-assisted)