mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #1734] d3d12: memory probe reports how much of the title memory behind filled images is in RAM (RT-MEM-PROBE-DUPLICATE) #1747
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1747
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1734
Author: @kawaii-shakal
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:mem-probe-duplicates📝 Commits (5)
c870341d3d12: memory probe reports how much of the title memory behind filled images is in RAM (RT-MEM-PROBE-DUPLICATE)355420ed3d12: count overlapping image source memory once5161909Merge upstream main into mem-probe-duplicates12767d1Merge upstream main into mem-probe-duplicates523b09fmem-probe: the census line says "CPU virtual bytes", and that two views of one backing count twice📊 Changes
5 files changed (+183 additions, -5 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+6 -1)📝
runtime/CMakeLists.txt(+11 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+21 -4)➕
runtime/src/working_set.h(+72 -0)➕
runtime/test/working_set_test.cpp(+73 -0)📄 Description
Claim: RT-MEM-PROBE-DUPLICATE, https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159332414 (step 1 of #1702)
What and why
#1702 shows that the GPU-read title data is kept twice: once in the title's own pages (committed, much of it resident) and again as Vulkan copies. On the retail boot the slot-70 and slot-133 images alone came to about 7.4 GB of VRAM. Before anything trims or shares those pages, the probe has to say how big the duplicate is. Today it reports only the GPU side.
runtime/src/working_set.h(new, header-only):leonida::working_set::resident_bytes(base, size, step = 16). It estimates how much of a range is resident in RAM by sampling one 4 KiB page instepwith oneQueryWorkingSetExcall per range. Pages that are not committed or not mapped read as not resident. Off Windows it returns 0.runtime/shims/d3d12_vulkan_device.cpp,log_title_census: withLEONIDA_MEM_PROBE, the existingregistered image backingline now ends withtitle pages behind filled images X MiB, Y MiB of them resident in RAM. Only images filled from memory count (fills, a known layout, notgpu_written). The working set is queried only when the probe is on.docs/d3d12_vulkan.md: the probe paragraph says this.Test
working_set_test(new ctestworking_set, Windows, psapi) checks these ranges:VirtualUnlock, which removes unlocked pages from the working set: under a quarter.d3d12_existing_heap_testwithLEONIDA_MEM_PROBE=1on an RTX 5070 Ti (NVIDIA 617.42, Windows 11 Pro 26300) passes and prints the new fields.gta6rtbuilds (MSVC 19.50).scripts/check_no_game_data.pyis clean.Not done here: a retail boot with this branch, so the size of the duplicate on 1.0.2.1 is not measured yet. That boot is the point of this PR. Title windows and arena shadows (buffers) are not counted; only images are.
AI-assisted: yes (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.