d3d12_device_calls: forget a slot a store or a call may have replaced (carry of #2343) #3093
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3093"
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 MoonEyes on 2026-12-02T10:31:01Z.
Claimed in the coordination issue as: D3D12-DEVICE-CALLS-STALE-SLOT (the original author's item ID, claimed at https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7194420859)
What and why
Carry of #2343 (syfyra), unchanged since 2026-11-26. Branch =
main+ the author's head (commit kept, merged without conflicts) + one commit of mine.tools/d3d12_device_calls.pyfollowed a[reg+disp]slot that held the device and dropped it only on a plain store to the slot's exact address. #2343 also forgets the slot when a call is given its address (an out-pointer) and when any store, SSE/AVX stores and partial stores included, touches its bytes, so a later call through the slot is not reported as a device slot.Review defect fixed in my commit: the reviewers (lixonik, aslan2142) showed that an EVEX 64-byte store such as
vmovups [rsp+20h],zmm0covers the device spill at[rsp+40h], but VEX/EVEX stores were sized 32 bytes, so slot 6 was still reported. The decoder keeps neither VEX.L nor EVEX.L'L, so every VEX/EVEX store now takes 64 bytes (forgetting a slot only loses a site). A ZMM case is added to the existing store table intests/test_d3d12_device_calls.py.The other review remarks (mark Ready for Review, fresh CI) need no code. This carry does not change how the decoder reads EVEX compressed disp8 displacements; the new test uses a disp32 form.
Tested
Windows 11, Python 3.14.0, no GPU, no game files, on main
80910637fplus this branch:python -I tests/test_d3d12_device_calls.py: 21 tests OK.python -I tests/test_gdk_runtime_calls.py: 25 tests OK.python -m compileall -qon both changed files: OK.main'stools/d3d12_device_calls.pyrestored, the same test file gives 6 failures in the two new tests (the call-given-the-slot case, and the movups, vmovdqu, ZMM and 4-byte-store cases). With the PR's original source, the ZMM subtest fails, as the reviewers reported (that run also shows 3 other failures from main's newer CLI tests, which the original source predates).python -I scripts/check_no_game_data.pyon both changed files: clean.Not run: the full suite, CI.
GPUs tested: n/a (unit tests only)
AI-assisted: yes. Models: Claude Opus 5.5 in Claude Code (carry, conflict resolution, fixes, tests); separate read-only reviewer agent: Claude Opus 5.5.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Supersedes #2343 once merged; the original stays open until a maintainer decides.
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T12:18:57Z.
Verified by OreoFR (oreofr-agent, AI-assisted; third-party red/green). Head
9b9e6f3c843bdadc91e40c2181a617f0ec2cd807merged into mainf6dd2242e02b5f579d245f1c19dd5150d42e00a1with no conflicts. Windows 11, Python 3.12, CPU only.tests/test_d3d12_device_calls.pyOK;tests/test_gdk_runtime_calls.pyOK.tools/d3d12_device_calls.pyrestored and this PR's tests kept:test_d3d12_device_calls.pyFAILED (failures=6), as the description says;test_gdk_runtime_calls.pystill OK.Safe to merge: it merges cleanly, CI is green, and it touches only a tool and its test. Not merged by me.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:49:01Z.
Merging. Head
9b9e6f3c8merges cleanly withmain23a51c494and does not force a rebase of #2566. Moon's own pull request, merged on green CI at his instruction. An independent read-only check by a separate agent on head9b9e6f3c8found every CI check green including no-game-data, no conflict with current main, no open review or unanswered question, and for a carry the original author's commits kept as ancestors. Merged by MoonEyes.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T12:55:29Z.
Ran natively on Windows 11, Python 3.13, head
9b9e6f3c8merged into currentmain(23a51c494, no conflicts).py -3.13 -I tests/test_d3d12_device_calls.pyOK; red/green already shown above, so I only probed which other writes to the slot end it.Throwaway probe (not committed) reusing the PR's
spilled_devicehelper: spill the device to[rsp+0x40], run one instruction, reload, call slot 6. "kept" = slot 6 still reported.mainnop(baseline)mov qword [rsp+0x40],0mov word [rsp+0x40],dxmov byte [rsp+0x47],0xchg [rsp+0x40],rdxvmovups [rsp+0x40],zmm0(EVEX, disp8)and qword [rsp+0x40],0(48 83 64 24 40 00)or qword [rsp+0x40],-1xor [rsp+0x40],rdxsetz byte [rsp+0x40]cmpxchg [rsp+0x40],rdxpop qword [rsp+0x40]lea r9,[rsp+0x38]+ call (out struct that covers0x40)Not a regression,
mainkeeps all of them too, but the new docstring line ("any store over a slot's bytes ends it") reads wider than the code. Read-modify-write forms (and/or/xor/add/sub [m],0x80/0x81/0x83with a memory operand,setcc [m],cmpxchg,xadd) never reachoverwrite().and qword ptr [rsp+N],0is the short form MSVC often emits forp = nullptrwith a stack slot, so it is the one most likely to show up in a real image. Either widening the doc wording to "plain and SSE/AVX stores" or sending memory-destination ALU ops throughoverwrite()would do; the latter only loses sites, in line with the PR's own rule. The out-pointer check also matches only a slot at exactly the address passed, not a buffer that covers it (last row); that one is rarer.Not checked: real images, EVEX compressed disp8 (stated as out of scope in the body), Linux.
GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).