mem-probe: the breakdown line says how much of each part is in host memory (RT-MEM-PROBE-HOST-SHARE) #2767
Closed
leonida/mandy
kawaii-shakal wants to merge 0 commits from
mem-probe-host-share into main
pull from: mem-probe-host-share
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2767
Loading…
Reference in a new issue
No description provided.
Delete branch "mem-probe-host-share"
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 closed
This pull request cannot be reopened because the branch was deleted.
Item: RT-MEM-PROBE-HOST-SHARE (claimed in #2570). Part of step 1 (accounting) of #1702.
The
[rt] mem-probe breakdownline splits the runtime'svkAllocateMemorybytes by consumer, but where they landed is only on themem-probe t=line, summed over all consumers per memory type. A sampled texture that did not fit in the card's memory, the page mirror's homes once the budget is near, or the arena on a type without DEVICE_LOCAL (#1732) all look like memory on the card in the breakdown. Now each part adds its share in memory types outside the device-local heaps, which the GPU reads over the bus, and the total follows the parts:Tally::addtakeshost(default false, so other callers are unchanged);mem_probe::samplepasses it from the memory type's flags. Imported memory stays apart, as before.allocated N MiB = arena ...) is unchanged.runtime/README.md: theLEONIDA_MEM_PROBErow says so.Tests (Linux, CPU only, no GPU or game files):
runtime/test/memory_breakdown_test.cpp: newhost_sharecase (per-consumer host bytes and counts, imported memory left out, an out-of-range consumer counted as other, the text) and the total intext(). Passes natively (g++ 13,-Wall -Wextra, no warnings) and as a clang-cl 21 + xwin build with/W4 /permissive-under Wine (3/3); fails with the host part no longer counted inTally::add.src/mem_probe.htype-checks with clang-cl/Zs(0 errors, 0 warnings, as on main). Not built with MSVC here, and not run withLEONIDA_MEM_PROBEon a GPU.check_no_game_data.pyon the four files andgit diff --checkare clean. Merges cleanly into main f44904d2.Heads-up: #2547 and #2549 (Tyrannys) also change
memory_breakdown.hand its test, in other hunks (DeviceShare/format additions); both need a rebase on main already, and whichever lands second has a small textual merge.AI-assisted (Claude Code): the change and the tests were written with it; I reviewed them and ran the tests.
🤖 Generated with Claude Code
Verified by OreoFR on macOS 27.2.1, Apple M5, Apple clang (
-std=c++20 -Wall -Wextra -fsanitize=address,undefined),mainad25611b5, head092834570.main+ this PR, merged;runtime/test/memory_breakdown_test.cppbuilt alone againstruntime/src):memory_breakdown: ok, exit 0, no sanitizer report, no warning. The breakdown line now prints each part's host-memory share, e.g.arena 4095 (1; 4095 in host memory)andin host memory 4997 MiB (4).main's headers + this PR's test): does not build (no member named 'host_total' in 'leonida::memory_breakdown::Tally'; the calls with a 4th argument). So no red failure can be shown: the test needs the new API.mem_probe.hcall sites on Windows (CI), and the line in a real run.AI-assisted: Claude Code
Independent verification on this machine (Windows 11, RTX 4090, MSVC 19.44.35226), with a control - and with the first version of that control, which lied to me.
1. It applies and builds.
merge-treeclean ontomainbe7690805; the change isruntime/src/memory_breakdown.h(+30/-5),runtime/src/mem_probe.h(+3/-1), its test (+33/-2), and one line ofruntime/README.md.2. With the branch:
ctest -R '^memory_breakdown'-> 100% tests passed, 0 failed out of 1.3. The control is at the compiler, not at the assertion. Revert only the two headers, keep the test, build:
So the new test cannot exist without the change: it calls
Tally::host_total(),add(..., host)and asserts the rendered line contains900 in host memory, none of whichmainhas. That is a compile-level control, and it is the honest classification - the behavioural half ("the line says how much of each part is in host memory") is asserted by the test, but I did not run the new binary against the old headers, because it cannot be built there.The mistake worth recording, because it produced a false result in my own hands: the first time I ran that control, I piped the build to
Out-Nullwithout checking$LASTEXITCODE, then ranctest— and it reported100% tests passed. The build had failed andctestran the previous binary, the one built with the branch's headers. For a minute I had a "control that does not bite" in front of me, and it was my script, not the pull request.What that costs and what it teaches:
ctestafter a failed build is a measurement of the last successful build, and it will pass happily. Every control I have published today says "revert, rebuild, run"; this one is the first where the rebuild failing is the answer, and checking the exit status is what distinguishes "the test is insensitive" from "the test could not be built".What I did not test: the runtime path that feeds
Tallywith the host-memory flag (a texture that did not fit in VRAM, the arena on a non-DEVICE_LOCALtype). The test drives the type directly; whethermem_probepasseshostcorrectly on a real card is not covered by this control.AI-assisted: yes - DeepSeek v4.1 (flash) as the coding agent. Measured on Windows 11, MSVC 19.44.35226, RelWithDebInfo, no GPU needed for this test.
Written with an AI assistant.
Independent check on Windows (not the author), at
092834570.memory_breakdown_testand ran it:memory_breakdown: ok(exit 0).arena 4095 (1; 4095 in host memory)andin host memory 4997 MiB (4), alongside the existing device-side breakdown.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711.
AI-assisted: yes (opencode).
Thanks, all addressed in 5211e5c5:
mem_probe::sample: it ismemory_breakdown::in_host_memory(type, type_count, flags)(a reported type without DEVICE_LOCAL), whichsample()calls. The newhost_typescase pins it without a GPU: a discrete GPU's VRAM, system memory and BAR window (device-local, so not host), an integrated GPU (all device-local), and a type index the device does not report (not counted). It fails with the type bound dropped. The one line insample()that passes the allocation's type to it is still only type-checked (clang-cl/Zs), not run.LEONIDA_MEM_PROBErow inruntime/README.mdnow say that a number in parentheses is an allocation count (in host memory 4997 MiB (4)is 4 allocations), as it already was for every other part of the line.item[256]: the longest items (the arena's bracket, the closing note) stay near 200 characters even with ten-digit figures, so nothing is cut today; the comment says so.Linux (g++) and clang-cl + Wine (3/3) pass; merges cleanly into main aefb2508.
AI-assisted (Claude Code); I ran the tests and checked the results.
Generated by Claude Code
done: verified
5211e5c5on today'smain- it applies cleanly, builds, and the test passes.maincd73ddab7, the branch's commits cherry-picked (merge-base8f41d7d01, no conflict):So the rule moved to
memory_breakdown::in_host_memorydoes the same job in the same place:7077 MiBsplits into4095 (1; 4095 in host memory)and the rest, which is what the line was for. And theitem[256]case does not wrap even with ten-digit figures, judged by the two rows above.What I checked and what I did not: the build and the test binary on Windows/MSVC, so the
g++andclang-cl + Winearms kawaii-shakal ran are not repeated here - the point of that matrix is that somebody ran them on other toolchains, and they did. What I add is that it still merges into themainof this hour, which is not theaefb2508they merged into.Nothing else to change from me: the two commits are the feature and the fix, and the review's four points are all visible in the diff.
AI-assisted: yes - DeepSeek v4.1 (flash), a build and a run on the merged tree.
Written with an AI assistant.
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.