d3d12: memory probe reports how much of the title memory behind filled images is in RAM (RT-MEM-PROBE-DUPLICATE) #1734

Closed
kawaii-shakal wants to merge 9 commits from upstream-pr/1734 into main
kawaii-shakal commented 2026-11-25 10:11:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-25T10:11:04Z.


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 in step with one QueryWorkingSetEx call 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: with LEONIDA_MEM_PROBE, the existing registered image backing line now ends with title pages behind filled images X MiB, Y MiB of them resident in RAM. Only images filled from memory count (fills, a known layout, not gpu_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 ctest working_set, Windows, psapi) checks these ranges:
    • 8 MiB written: all resident;
    • 8 MiB committed but never touched: 0;
    • reserved only: 0;
    • half written: half;
    • the written range after VirtualUnlock, which removes unlocked pages from the working set: under a quarter.
  • d3d12_existing_heap_test with LEONIDA_MEM_PROBE=1 on an RTX 5070 Ti (NVIDIA 617.42, Windows 11 Pro 26300) passes and prints the new fields.
  • gta6rt builds (MSVC 19.50). scripts/check_no_game_data.py is 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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5489279801 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1734). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-25T10:11:04Z. --- 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 in `step` with one `QueryWorkingSetEx` call 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`: with `LEONIDA_MEM_PROBE`, the existing `registered image backing` line now ends with `title pages behind filled images X MiB, Y MiB of them resident in RAM`. Only images filled from memory count (`fills`, a known layout, not `gpu_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 ctest `working_set`, Windows, psapi) checks these ranges: - 8 MiB written: all resident; - 8 MiB committed but never touched: 0; - reserved only: 0; - half written: half; - the written range after `VirtualUnlock`, which removes unlocked pages from the working set: under a quarter. - `d3d12_existing_heap_test` with `LEONIDA_MEM_PROBE=1` on an RTX 5070 Ti (NVIDIA 617.42, Windows 11 Pro 26300) passes and prints the new fields. - `gta6rt` builds (MSVC 19.50). `scripts/check_no_game_data.py` is 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](https://claude.com/claude-code)
lixonik commented 2026-11-25 10:29:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T10:29:20Z.

Review: COMMENTED


Independent native Windows verification at c870341f: built working_set_test with MSVC and ran it five times. All passed. A second synthetic check exercised two paired title addresses that resolve to one CPU range. The per-image sum can count that range twice. Details inline.

AI-assisted. CPU only, no title workload or GPU run.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6055863377 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1734#pullrequestreview-6055863377). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T10:29:20Z. **Review:** COMMENTED --- Independent native Windows verification at `c870341f`: built `working_set_test` with MSVC and ran it five times. All passed. A second synthetic check exercised two paired title addresses that resolve to one CPU range. The per-image sum can count that range twice. Details inline. AI-assisted. CPU only, no title workload or GPU run.
lixonik commented 2026-11-25 10:29:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T10:29:20Z.

Code review location: runtime/shims/d3d12_vulkan_device.cpp; line 11213

@@ -11196,22 +11197,32 @@ class Device final
             refused += (refused.empty() ? "" : "; ") + why + " " + std::to_string(n);
         std::size_t owned = 0, slot133 = 0, mapped = 0, filled = 0;
         VkDeviceSize owned_bytes = 0, placed_bytes = 0, host_heap_bytes = 0;
+        // The title pages a filled image was made from, and how much of them is still in RAM: the copy the GPU
+        // image duplicates (#1702). Only with the memory probe on, since it queries the working set per texture.
+        std::uint64_t source_bytes = 0, resident_source_bytes = 0;
+        const bool probe = leonida::mem_probe::interval_seconds() != 0;
         for (const auto& [address, t] : state_.title_textures) {
             (t->owned ? owned : slot133) += 1;
             if (!t->owned && t->unbound_bytes) t->set_resource(t->resource);
             mapped += t->mapped;
             filled += t->fills > 0;
             (t->owned ? owned_bytes : placed_bytes) += t->backing_bytes;
             if (!t->device_local) host_heap_bytes += t->backing_bytes;
+            if (probe && t->fills && !t->gpu_written && t->layout_known && t->cpu && t->layout.layout.size) {
+                source_bytes += t->layout.layout.size;
+                resident_source_bytes += leonida::working_set::resident_bytes(t->cpu, t->layout.layout.size);

These totals sum per texture key, but two keys can refer to the same CPU pages. Registration keys the map by the original address and uses title_gpu_views::to_cpu for the backing. I paired two addresses using the real view mapper and pointed both synthetic entries at one touched 128 KiB range. Summing the helper results here produces 256 KiB resident, while the unique range is 128 KiB. If the diagnostic is meant to show the amount of distinct CPU memory behind the GPU copies, could it merge the CPU intervals before sampling? If the per-image sum is intentional, labeling it as such would make it clear that shared pages can be counted more than once.

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4693551629 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1734#discussion_r4693551629). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T10:29:20Z. **Code review location:** `runtime/shims/d3d12_vulkan_device.cpp`; line 11213 ~~~~diff @@ -11196,22 +11197,32 @@ class Device final refused += (refused.empty() ? "" : "; ") + why + " " + std::to_string(n); std::size_t owned = 0, slot133 = 0, mapped = 0, filled = 0; VkDeviceSize owned_bytes = 0, placed_bytes = 0, host_heap_bytes = 0; + // The title pages a filled image was made from, and how much of them is still in RAM: the copy the GPU + // image duplicates (#1702). Only with the memory probe on, since it queries the working set per texture. + std::uint64_t source_bytes = 0, resident_source_bytes = 0; + const bool probe = leonida::mem_probe::interval_seconds() != 0; for (const auto& [address, t] : state_.title_textures) { (t->owned ? owned : slot133) += 1; if (!t->owned && t->unbound_bytes) t->set_resource(t->resource); mapped += t->mapped; filled += t->fills > 0; (t->owned ? owned_bytes : placed_bytes) += t->backing_bytes; if (!t->device_local) host_heap_bytes += t->backing_bytes; + if (probe && t->fills && !t->gpu_written && t->layout_known && t->cpu && t->layout.layout.size) { + source_bytes += t->layout.layout.size; + resident_source_bytes += leonida::working_set::resident_bytes(t->cpu, t->layout.layout.size); ~~~~ --- These totals sum per texture key, but two keys can refer to the same CPU pages. Registration keys the map by the original address and uses `title_gpu_views::to_cpu` for the backing. I paired two addresses using the real view mapper and pointed both synthetic entries at one touched 128 KiB range. Summing the helper results here produces 256 KiB resident, while the unique range is 128 KiB. If the diagnostic is meant to show the amount of distinct CPU memory behind the GPU copies, could it merge the CPU intervals before sampling? If the per-image sum is intentional, labeling it as such would make it clear that shared pages can be counted more than once.
kawaii-shakal commented 2026-11-25 16:37:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-25T16:37:08Z.

Code review location: runtime/shims/d3d12_vulkan_device.cpp; line 11213

@@ -11196,22 +11197,32 @@ class Device final
             refused += (refused.empty() ? "" : "; ") + why + " " + std::to_string(n);
         std::size_t owned = 0, slot133 = 0, mapped = 0, filled = 0;
         VkDeviceSize owned_bytes = 0, placed_bytes = 0, host_heap_bytes = 0;
+        // The title pages a filled image was made from, and how much of them is still in RAM: the copy the GPU
+        // image duplicates (#1702). Only with the memory probe on, since it queries the working set per texture.
+        std::uint64_t source_bytes = 0, resident_source_bytes = 0;
+        const bool probe = leonida::mem_probe::interval_seconds() != 0;
         for (const auto& [address, t] : state_.title_textures) {
             (t->owned ? owned : slot133) += 1;
             if (!t->owned && t->unbound_bytes) t->set_resource(t->resource);
             mapped += t->mapped;
             filled += t->fills > 0;
             (t->owned ? owned_bytes : placed_bytes) += t->backing_bytes;
             if (!t->device_local) host_heap_bytes += t->backing_bytes;
+            if (probe && t->fills && !t->gpu_written && t->layout_known && t->cpu && t->layout.layout.size) {
+                source_bytes += t->layout.layout.size;
+                resident_source_bytes += leonida::working_set::resident_bytes(t->cpu, t->layout.layout.size);

Thanks, you were right: two paired addresses that resolve to one CPU range were counted twice. Fixed in 355420e81 (in the current head, 516190908). The census now collects the CPU ranges of the filled images, merges overlapping and adjacent ones (working_set::merge_cpu_ranges), and samples residency once per merged range. The log line says "unique title memory behind filled images". working_set_test gained your case (two aliases of one 128 KiB range count as 128 KiB) plus nested, overlapping and adjacent ranges. The fix was made by Codex, who works on this with me; sorry for not saying so here earlier. AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4697825553 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1734#discussion_r4697825553). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-25T16:37:08Z. **Code review location:** `runtime/shims/d3d12_vulkan_device.cpp`; line 11213 ~~~~diff @@ -11196,22 +11197,32 @@ class Device final refused += (refused.empty() ? "" : "; ") + why + " " + std::to_string(n); std::size_t owned = 0, slot133 = 0, mapped = 0, filled = 0; VkDeviceSize owned_bytes = 0, placed_bytes = 0, host_heap_bytes = 0; + // The title pages a filled image was made from, and how much of them is still in RAM: the copy the GPU + // image duplicates (#1702). Only with the memory probe on, since it queries the working set per texture. + std::uint64_t source_bytes = 0, resident_source_bytes = 0; + const bool probe = leonida::mem_probe::interval_seconds() != 0; for (const auto& [address, t] : state_.title_textures) { (t->owned ? owned : slot133) += 1; if (!t->owned && t->unbound_bytes) t->set_resource(t->resource); mapped += t->mapped; filled += t->fills > 0; (t->owned ? owned_bytes : placed_bytes) += t->backing_bytes; if (!t->device_local) host_heap_bytes += t->backing_bytes; + if (probe && t->fills && !t->gpu_written && t->layout_known && t->cpu && t->layout.layout.size) { + source_bytes += t->layout.layout.size; + resident_source_bytes += leonida::working_set::resident_bytes(t->cpu, t->layout.layout.size); ~~~~ --- Thanks, you were right: two paired addresses that resolve to one CPU range were counted twice. Fixed in `355420e81` (in the current head, `516190908`). The census now collects the CPU ranges of the filled images, merges overlapping and adjacent ones (`working_set::merge_cpu_ranges`), and samples residency once per merged range. The log line says "unique title memory behind filled images". `working_set_test` gained your case (two aliases of one 128 KiB range count as 128 KiB) plus nested, overlapping and adjacent ranges. The fix was made by Codex, who works on this with me; sorry for not saying so here earlier. AI-assisted (Claude Code, Claude Opus 5.5).
BadgersMC commented 2026-11-26 16:30:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BadgersMC on 2026-11-26T16:30:48Z.


Native Windows check at 12767d1f. The PR's working_set_test passed three runs with MSVC and the target's compile definitions.

I also tested two distinct CPU addresses mapped to offset zero in the same 4 MiB section. A write through the first view was visible through the second at every page. The current range union and working-set estimate both reported 8 MiB in all three runs, including when sampling every page. This exercises a different case from the resolved review, which merged two references to the same CPU address range. Leonida's page mapping code can create different CPU addresses for the same backing.

Could the log label say CPU virtual bytes behind filled images and document that distinct views of one backing may count twice? The current probe is still useful with that interpretation. The effect in a title run remains unmeasured. Synthetic Windows test and AI-assisted interpretation reviewed with Claude Opus 5.5.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7197742885 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1734#issuecomment-7197742885). Originally posted by [BadgersMC](https://github.com/BadgersMC) on 2026-11-26T16:30:48Z. --- Native Windows check at `12767d1f`. The PR's `working_set_test` passed three runs with MSVC and the target's compile definitions. I also tested two distinct CPU addresses mapped to offset zero in the same 4 MiB section. A write through the first view was visible through the second at every page. The current range union and working-set estimate both reported **8 MiB** in all three runs, including when sampling every page. This exercises a different case from the resolved review, which merged two references to the same CPU address range. Leonida's [page mapping code](https://github.com/ubiquitarianism/leonida/blob/2e2c51c0929cae8195366e52adfef17156a355d2/runtime/shims/xmem.cpp#L1993-L1998) can create different CPU addresses for the same backing. Could the log label say **CPU virtual bytes behind filled images** and document that distinct views of one backing may count twice? The current probe is still useful with that interpretation. The effect in a title run remains unmeasured. Synthetic Windows test and AI-assisted interpretation reviewed with Claude Opus 5.5.
kawaii-shakal commented 2026-11-26 18:26:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-26T18:26:18Z.


@BadgersMC thanks, you are right: merge_cpu_ranges merges by virtual address, so the same frames mapped at two
addresses count once per view, in the total and in the resident part. Claude Code (AI-assisted) changed this in
523b09fd, wording only, no behaviour change:

  • the census line now reads "CPU virtual bytes behind filled images ... (two views of one backing count twice)";
  • working_set.h and docs/d3d12_vulkan.md say why: the union is by virtual address, so distinct views of one
    backing are not merged.

Counting physical frames instead (QueryWorkingSetEx gives a frame number for resident pages) would need a frame
set per sample. I'd leave that for a follow-up if the duplicate views turn out to matter in real runs.

Not built here: the shim is Windows-only. working_set.h compiles on Linux.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7200462855 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1734#issuecomment-7200462855). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-26T18:26:18Z. --- @BadgersMC thanks, you are right: `merge_cpu_ranges` merges by virtual address, so the same frames mapped at two addresses count once per view, in the total and in the resident part. Claude Code (AI-assisted) changed this in 523b09fd, wording only, no behaviour change: - the census line now reads "CPU virtual bytes behind filled images ... (two views of one backing count twice)"; - `working_set.h` and `docs/d3d12_vulkan.md` say why: the union is by virtual address, so distinct views of one backing are not merged. Counting physical frames instead (`QueryWorkingSetEx` gives a frame number for resident pages) would need a frame set per sample. I'd leave that for a follow-up if the duplicate views turn out to matter in real runs. Not built here: the shim is Windows-only. `working_set.h` compiles on Linux. --- _Generated by [Claude Code](https://claude.ai/code)_
zmasi commented 2026-11-28 21:24:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:24:53Z.


#1734 | head 9927f17f8b (merged cleanly with main 1bc055e6c2) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^(working_set|d3d12_existing_heap|d3d12_mapped_plane_async)$" --output-on-failure (LEONIDA_VK_VALIDATION=1, LEONIDA_MEM_PROBE=1, LEONIDA_FSDRAW_PROBE=1) + python tests/test_docs_encoding.py | red on main: working_set_test.cpp fails to compile (error C1083: Cannot open include file: '../src/working_set.h') | green on PR+main: 3/3 CTests pass (working_set written/untouched/reserved/half-written/VirtualUnlock working-set ranges, d3d12_existing_heap, and d3d12_mapped_plane_async with 0 Khronos validation errors, emitting CPU virtual bytes behind filled images ... resident in RAM; note: on current main, log_title_census is gated behind leonida::fsdraw::enabled(), so LEONIDA_FSDRAW_PROBE=1 is needed alongside LEONIDA_MEM_PROBE=1 to print the census line); test_docs_encoding.py and check_no_game_data.py 0 violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246001890 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1734#issuecomment-7246001890). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T21:24:53Z. --- #1734 | head 9927f17f8b5f19f08003b790f085c29b7d4dc84f (merged cleanly with main 1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^(working_set|d3d12_existing_heap|d3d12_mapped_plane_async)$" --output-on-failure` (`LEONIDA_VK_VALIDATION=1`, `LEONIDA_MEM_PROBE=1`, `LEONIDA_FSDRAW_PROBE=1`) + `python tests/test_docs_encoding.py` | red on main: `working_set_test.cpp` fails to compile (`error C1083: Cannot open include file: '../src/working_set.h'`) | green on PR+main: 3/3 CTests pass (`working_set` written/untouched/reserved/half-written/`VirtualUnlock` working-set ranges, `d3d12_existing_heap`, and `d3d12_mapped_plane_async` with `0` Khronos validation errors, emitting `CPU virtual bytes behind filled images ... resident in RAM`; note: on current `main`, `log_title_census` is gated behind `leonida::fsdraw::enabled()`, so `LEONIDA_FSDRAW_PROBE=1` is needed alongside `LEONIDA_MEM_PROBE=1` to print the census line); `test_docs_encoding.py` and `check_no_game_data.py` `0` violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes
enlight3d commented 2026-11-29 08:58:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T08:58:16Z.


Validation run of this pull request.

  • PR head: 9927f17f8b. main: 54b2a81e95. Merged cleanly (git merge --no-edit --no-ff pr-1734, no conflicts); tested at the merge commit.
  • Commands:
    • cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON
    • cmake --build runtime/build --target gta6rt working_set_test d3d12_existing_heap_test d3d12_vulkan_device_test -j 8
    • LEONIDA_MEM_PROBE=1 ctest -R "^(working_set|d3d12_existing_heap|d3d12_mapped_plane_async)$" --output-on-failure -j1
    • ctest -R "^d3d12_vulkan_device$" --output-on-failure -j1 (touched source, run without the probe variable)
  • Green (merged): working_set, d3d12_existing_heap, d3d12_mapped_plane_async and d3d12_vulkan_device all passed. Not checked: the new title pages behind filled images text itself (ctest hides the output of a passing test).
  • Pre-existing: d3d12_vulkan_device with LEONIDA_MEM_PROBE=1 crashes on plain main too (SEGFAULT on main; exit code 0xc0000409 on the merged tree). It passes without that variable on the merged tree, so this is not caused by the PR as far as these runs show.
  • Red, first kind (build): the new header runtime/src/working_set.h, the d3d12_vulkan_device.cpp change and the doc taken back from main, runtime/CMakeLists.txt and the test kept: working_set_test does not build ('../src/working_set.h': no such file). New API, so this is only a build failure.
  • Red, second kind (a mutation made for this run, not a revert): header kept, the residency check removed (valid += e.VirtualAttributes.Valid; replaced by valid += 1;). working_set fails 4 checks: committed pages never touched are not resident, reserved pages are not resident, half written, half resident, pages dropped from the working set are not resident.
  • Link: new import vs main: kernel32.dll!K32QueryWorkingSetEx (715 imports against 714 on main; nothing removed). It comes from QueryWorkingSetEx in the new header.
  • Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7253449937 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1734#issuecomment-7253449937). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T08:58:16Z. --- Validation run of this pull request. - PR head: 9927f17f8b5f19f08003b790f085c29b7d4dc84f. main: 54b2a81e95c470c953ddee6177fd6255cbaf041d. Merged cleanly (`git merge --no-edit --no-ff pr-1734`, no conflicts); tested at the merge commit. - Commands: - `cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON` - `cmake --build runtime/build --target gta6rt working_set_test d3d12_existing_heap_test d3d12_vulkan_device_test -j 8` - `LEONIDA_MEM_PROBE=1 ctest -R "^(working_set|d3d12_existing_heap|d3d12_mapped_plane_async)$" --output-on-failure -j1` - `ctest -R "^d3d12_vulkan_device$" --output-on-failure -j1` (touched source, run without the probe variable) - Green (merged): `working_set`, `d3d12_existing_heap`, `d3d12_mapped_plane_async` and `d3d12_vulkan_device` all passed. Not checked: the new `title pages behind filled images` text itself (ctest hides the output of a passing test). - Pre-existing: `d3d12_vulkan_device` with `LEONIDA_MEM_PROBE=1` crashes on plain main too (SEGFAULT on main; exit code 0xc0000409 on the merged tree). It passes without that variable on the merged tree, so this is not caused by the PR as far as these runs show. - Red, first kind (build): the new header `runtime/src/working_set.h`, the `d3d12_vulkan_device.cpp` change and the doc taken back from main, `runtime/CMakeLists.txt` and the test kept: `working_set_test` does not build (`'../src/working_set.h'`: no such file). New API, so this is only a build failure. - Red, second kind (a mutation made for this run, not a revert): header kept, the residency check removed (`valid += e.VirtualAttributes.Valid;` replaced by `valid += 1;`). `working_set` fails 4 checks: `committed pages never touched are not resident`, `reserved pages are not resident`, `half written, half resident`, `pages dropped from the working set are not resident`. - Link: new import vs main: `kernel32.dll!K32QueryWorkingSetEx` (715 imports against 714 on main; nothing removed). It comes from `QueryWorkingSetEx` in the new header. - Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44.
OreoFR commented 2026-11-29 23:24:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T23:24:09Z.


Verified by OreoFR on the Runtime workflow of his fork (GitHub windows-latest, MSVC), main 452d1d1b6, PR head 242d32db8. MEASURED. This replaces the earlier non-conclusive fork run: the red branch now keeps this PR's working_set_test registration in runtime/CMakeLists.txt, and the Windows job limit was raised to 120 min on the fork branches only.

  • red (main + only runtime/test/working_set_test.cpp and its CMake lines), https://github.com/OreoFR/leonida/actions/runs/46318837878: does not build, working_set_test.cpp: fatal error: ../src/working_set.h: No such file or directory (seen in linux-gpu-tools; windows and macos fail too). So the red shows the test needs this PR's new header, not that it catches a wrong result.
  • green (main + this PR, merge --no-ff), https://github.com/OreoFR/leonida/actions/runs/46318835503: windows ctest 515/515 passed, 2 disabled (gameinput, gameinput_script), out of 517; working_set Passed. linux-gpu-tools passed. macos fails at "GPU tests on MoltenVK", as on upstream main's own latest Runtime runs. Wine jobs not covered.

Not covered: real-page working-set numbers on a GPU or in game.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264432881 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1734#issuecomment-7264432881). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T23:24:09Z. --- Verified by OreoFR on the Runtime workflow of his fork (GitHub `windows-latest`, MSVC), main 452d1d1b6, PR head 242d32db8. MEASURED. This replaces the earlier non-conclusive fork run: the red branch now keeps this PR's `working_set_test` registration in `runtime/CMakeLists.txt`, and the Windows job limit was raised to 120 min on the fork branches only. - **red** (main + only `runtime/test/working_set_test.cpp` and its CMake lines), https://github.com/OreoFR/leonida/actions/runs/46318837878: **does not build**, `working_set_test.cpp: fatal error: ../src/working_set.h: No such file or directory` (seen in `linux-gpu-tools`; `windows` and `macos` fail too). So the red shows the test needs this PR's new header, not that it catches a wrong result. - **green** (main + this PR, `merge --no-ff`), https://github.com/OreoFR/leonida/actions/runs/46318835503: `windows` ctest **515/515 passed**, 2 disabled (`gameinput`, `gameinput_script`), out of 517; `working_set` Passed. `linux-gpu-tools` passed. `macos` fails at "GPU tests on MoltenVK", as on upstream `main`'s own latest Runtime runs. Wine jobs not covered. Not covered: real-page working-set numbers on a GPU or in game. AI-assisted: Claude Code
kawaii-shakal commented 2026-11-30 19:06:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-30T19:06:01Z.


Merged main (8f41d7d0) and fixed one thing found while re-checking: under Wine (9.0, clang-cl 21 build) working_set_test failed at "pages dropped from the working set are not resident" — VirtualUnlock on an unlocked range does not trim Wine's working set, and QueryWorkingSetEx still reports the pages valid. It failed the same way before the merge; on Windows it passes, as your runs showed. Since the CI's Wine job runs the Windows build's tests, that check now runs only outside Wine (wine_get_version, as allocator_proxy_test does) and says it was skipped; every other check still runs there (3/3). 24e935b2.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7288841909 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1734#issuecomment-7288841909). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-30T19:06:01Z. --- Merged main (8f41d7d0) and fixed one thing found while re-checking: under Wine (9.0, clang-cl 21 build) `working_set_test` failed at "pages dropped from the working set are not resident" — `VirtualUnlock` on an unlocked range does not trim Wine's working set, and `QueryWorkingSetEx` still reports the pages valid. It failed the same way before the merge; on Windows it passes, as your runs showed. Since the CI's Wine job runs the Windows build's tests, that check now runs only outside Wine (`wine_get_version`, as `allocator_proxy_test` does) and says it was skipped; every other check still runs there (3/3). 24e935b2. --- _Generated by [Claude Code](https://claude.ai/code)_
aslan2142 commented 2026-12-01 16:37:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:37:40Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317919827 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1734#issuecomment-7317919827). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:37:40Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1734
No description provided.