vulkan_memory_budget: saturate multi-heap uint64_t sums in sum_vram_budget #2333

Closed
narekshaghoyandev wants to merge 1 commit from upstream-pr/2333 into main
narekshaghoyandev commented 2026-11-26 14:00:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by narekshaghoyandev on 2026-11-26T14:00:29Z.


Prevents uint64_t wraparound when summing multiple Vulkan memory heaps in leonida::sum_vram_budget() (runtime/src/vulkan_memory_budget.h):

  • Previously, out.local_usage += ..., out.local_budget += ..., and out.shared_usage += ... could wrap around modulo 2^{64} when summing large heap figures, even wrapping local_budget to 0 and falsely marking out.available = false ("VRAM n/a").
  • Use saturating addition (UINT64_MAX cap) for local_usage, local_budget, and shared_usage.
  • Added standalone unit test runtime/test/vulkan_memory_budget_test.cpp.

Verification

  • g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic -Wno-missing-field-initializers -Iruntime/src runtime/test/vulkan_memory_budget_test.cpp passed
  • g++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Wno-missing-field-initializers -Iruntime/src runtime/test/vulkan_memory_budget_test.cpp passed
  • Negative control: new test failed on line 44 (saturated.available, exit 1) against unmodified ubiq/main
  • python3 -I scripts/check_no_game_data.py runtime/src/vulkan_memory_budget.h runtime/test/vulkan_memory_budget_test.cpp clean

Claimed in the coordination issue as: RT-VULKAN-MEMORY-BUDGET-SATURATE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194106445)
AI-assisted: yes (Gemini)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5511392469 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333). Originally posted by [narekshaghoyandev](https://github.com/narekshaghoyandev) on 2026-11-26T14:00:29Z. --- Prevents `uint64_t` wraparound when summing multiple Vulkan memory heaps in `leonida::sum_vram_budget()` (`runtime/src/vulkan_memory_budget.h`): - Previously, `out.local_usage += ...`, `out.local_budget += ...`, and `out.shared_usage += ...` could wrap around modulo $2^{64}$ when summing large heap figures, even wrapping `local_budget` to `0` and falsely marking `out.available = false` (`"VRAM n/a"`). - Use saturating addition (`UINT64_MAX` cap) for `local_usage`, `local_budget`, and `shared_usage`. - Added standalone unit test `runtime/test/vulkan_memory_budget_test.cpp`. ### Verification - `g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic -Wno-missing-field-initializers -Iruntime/src runtime/test/vulkan_memory_budget_test.cpp` passed - `g++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Wno-missing-field-initializers -Iruntime/src runtime/test/vulkan_memory_budget_test.cpp` passed - Negative control: new test failed on line 44 (`saturated.available`, exit 1) against unmodified `ubiq/main` - `python3 -I scripts/check_no_game_data.py runtime/src/vulkan_memory_budget.h runtime/test/vulkan_memory_budget_test.cpp` clean Claimed in the coordination issue as: RT-VULKAN-MEMORY-BUDGET-SATURATE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194106445) AI-assisted: yes (Gemini)
lixonik commented 2026-11-26 15:40:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T15:40:34Z.

Review: COMMENTED


Ran vulkan_memory_budget_test.cpp directly with GCC 11 and UBSan on Ubuntu/WSL. All cases, including saturated multi-heap totals, passed with no sanitizer report. Could this executable be registered in CTest? I found no current test target for the new source.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6076920276 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#pullrequestreview-6076920276). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T15:40:34Z. **Review:** COMMENTED --- Ran `vulkan_memory_budget_test.cpp` directly with GCC 11 and UBSan on Ubuntu/WSL. All cases, including saturated multi-heap totals, passed with no sanitizer report. Could this executable be registered in CTest? I found no current test target for the new source. AI-assisted.
wavehs commented 2026-11-26 19:40:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T19:40:52Z.

Review: COMMENTED


macOS arm64 check of #2333 (vulkan_memory_budget saturation). A two-file change with no device dependency; I built its new test by hand because the build system does not - see the finding.

Tested head 6376bbc20 merged onto main bdbc7e923 as merge f7ba677a4 (clean, no conflicts).

Environment: Apple M3 Pro arm64, macOS 27.2.1, Apple clang 21.0.0, CMake 4.5.0, CPython 3.15.2, SPIRV-Tools v2026.4, Vulkan headers from /opt/homebrew/include (Vulkan-Headers 1.4.363.0).

The fix and its test

  • runtime/src/vulkan_memory_budget.h:19-37: add_sat clamps each heap's heapUsage/heapBudget contribution at UINT64_MAX instead of wrapping, and available still keys off local_budget != 0, so wide multi-heap devices keep reporting a figure. That is the right shape: the only consumers are the HUD's display (a ratio) and the null-query guard, and a saturated numerator/denominator is a saner answer than a wrapped one.
  • I compiled and ran the new test directly (clang++ -std=c++17 -I runtime -I /opt/homebrew/include runtime/test/vulkan_memory_budget_test.cpp): prints vulkan_memory_budget_test: ok, exit 0.
  • NC (keep the new test, revert only runtime/src/vulkan_memory_budget.h to main): compile OK, run fails at line 44: saturated.available - the wrapped local_budget becomes 0 and the code reports "VRAM n/a". The regression is real and the test detects it.

Finding: the new test is never built or run - it is not in runtime/CMakeLists.txt
runtime/test/vulkan_memory_budget_test.cpp is a new file, but runtime/CMakeLists.txt has no add_executable(vulkan_memory_budget_test ...) or add_test for it (I grepped the source list and the test list; ctest --test-dir build2304 -N shows 112 tests and none mentions memory_budget). Every other test in runtime/test is registered explicitly (title_hud_test at :852-859, list_value_wait_budget_test at :1508-1509), and there is no glob, so this file is dead in every build: ctest, the Windows runtime job and Wine will all skip it, which is exactly the regression coverage the PR is adding. The existing guard tests/test_ctest_registration.py cannot see it - its test_all_test_executables_have_an_add_test compares targets that exist against add_test commands, so a file with no target at all is invisible (it passes on this merge; I ran it).

Two things I would ask for in the same PR:

  1. Register the target. It needs only the Vulkan headers (target_link_libraries(vulkan_memory_budget_test PRIVATE Vulkan::Headers)), so no WIN32/MSVC guard is needed and it runs on macOS, Linux and Windows alike.
  2. Close the hole in tests/test_ctest_registration.py: compare runtime/test/*_test.cpp against the target names in the CMake source, and fail on a file with no add_executable. Otherwise this class of "test that never runs" will keep getting through, and the PR's own body can say "tested" while CI tests nothing.

Not run: the Windows-only title HUD test (title_hud_test links user32/psapi) and the full ctest suite, neither of which is affected by this header. No GPU work here.

python -I scripts/check_no_game_data.py on both changed files: clean.

No game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6079663749 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#pullrequestreview-6079663749). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-26T19:40:52Z. **Review:** COMMENTED --- **macOS arm64 check of #2333** (vulkan_memory_budget saturation). A two-file change with no device dependency; I built its new test by hand because the build system does not - see the finding. Tested head `6376bbc20` merged onto `main` `bdbc7e923` as merge `f7ba677a4` (clean, no conflicts). Environment: Apple M3 Pro arm64, macOS 27.2.1, Apple clang 21.0.0, CMake 4.5.0, CPython 3.15.2, SPIRV-Tools v2026.4, Vulkan headers from `/opt/homebrew/include` (Vulkan-Headers 1.4.363.0). **The fix and its test** - `runtime/src/vulkan_memory_budget.h:19-37`: `add_sat` clamps each heap's `heapUsage`/`heapBudget` contribution at `UINT64_MAX` instead of wrapping, and `available` still keys off `local_budget != 0`, so wide multi-heap devices keep reporting a figure. That is the right shape: the only consumers are the HUD's display (a ratio) and the null-query guard, and a saturated numerator/denominator is a saner answer than a wrapped one. - I compiled and ran the new test directly (`clang++ -std=c++17 -I runtime -I /opt/homebrew/include runtime/test/vulkan_memory_budget_test.cpp`): prints `vulkan_memory_budget_test: ok`, exit 0. - NC (keep the new test, revert only `runtime/src/vulkan_memory_budget.h` to `main`): compile OK, run fails at `line 44: saturated.available` - the wrapped `local_budget` becomes 0 and the code reports "VRAM n/a". The regression is real and the test detects it. **Finding: the new test is never built or run - it is not in `runtime/CMakeLists.txt`** `runtime/test/vulkan_memory_budget_test.cpp` is a new file, but `runtime/CMakeLists.txt` has no `add_executable(vulkan_memory_budget_test ...)` or `add_test` for it (I grepped the source list and the test list; `ctest --test-dir build2304 -N` shows 112 tests and none mentions `memory_budget`). Every other test in `runtime/test` is registered explicitly (`title_hud_test` at `:852-859`, `list_value_wait_budget_test` at `:1508-1509`), and there is no glob, so this file is dead in every build: ctest, the Windows runtime job and Wine will all skip it, which is exactly the regression coverage the PR is adding. The existing guard `tests/test_ctest_registration.py` cannot see it - its `test_all_test_executables_have_an_add_test` compares *targets that exist* against `add_test` commands, so a file with no target at all is invisible (it passes on this merge; I ran it). Two things I would ask for in the same PR: 1. Register the target. It needs only the Vulkan headers (`target_link_libraries(vulkan_memory_budget_test PRIVATE Vulkan::Headers)`), so no `WIN32`/`MSVC` guard is needed and it runs on macOS, Linux and Windows alike. 2. Close the hole in `tests/test_ctest_registration.py`: compare `runtime/test/*_test.cpp` against the target names in the CMake source, and fail on a file with no `add_executable`. Otherwise this class of "test that never runs" will keep getting through, and the PR's own body can say "tested" while CI tests nothing. **Not run**: the Windows-only title HUD test (`title_hud_test` links `user32`/`psapi`) and the full ctest suite, neither of which is affected by this header. No GPU work here. `python -I scripts/check_no_game_data.py` on both changed files: clean. No game files. AI-assisted.
zmasi commented 2026-11-28 20:40:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T20:40:00Z.


#2333 | head 6376bbc20f (merged cleanly with main 1bc055e6c2) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^(vulkan_memory_budget|d3d12_compute)$" --output-on-failure (LEONIDA_VK_VALIDATION=1, /W4 /WX /permissive- /EHsc /utf-8 on vulkan_memory_budget_test) | red on main: vulkan_memory_budget fails at line 44: saturated.available (rc=8, multi-heap uint64_t budget sum wraps to 0) | green on PR+main: 2/2 CTests pass (vulkan_memory_budget vulkan_memory_budget_test: ok under /W4 /WX + d3d12_compute on RTX 3090 with 0 Khronos validation errors); check_no_game_data.py 0 violations. Non-blocking note: runtime/test/vulkan_memory_budget_test.cpp is not yet registered via add_executable / add_test in runtime/CMakeLists.txt, so CTest will not build or run it automatically until wired up | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245451720 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#issuecomment-7245451720). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T20:40:00Z. --- #2333 | head 6376bbc20f655879e0256ebd40eae19acc440a93 (merged cleanly with main 1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^(vulkan_memory_budget|d3d12_compute)$" --output-on-failure` (`LEONIDA_VK_VALIDATION=1`, `/W4 /WX /permissive- /EHsc /utf-8` on `vulkan_memory_budget_test`) | red on main: `vulkan_memory_budget` fails at `line 44: saturated.available` (`rc=8`, multi-heap `uint64_t` budget sum wraps to `0`) | green on PR+main: 2/2 CTests pass (`vulkan_memory_budget` `vulkan_memory_budget_test: ok` under `/W4 /WX` + `d3d12_compute` on RTX 3090 with `0` Khronos validation errors); `check_no_game_data.py` `0` violations. Non-blocking note: `runtime/test/vulkan_memory_budget_test.cpp` is not yet registered via `add_executable` / `add_test` in `runtime/CMakeLists.txt`, so CTest will not build or run it automatically until wired up | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes
timbot103 commented 2026-11-29 04:28:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:28:45Z.

Review: COMMENTED


Static audit of 6376bbc20 only. No builds, tests, or GPU runs.

runtime/src/vulkan_memory_budget.h:22 correctly caps local heapBudget, local heapUsage, and shared heapUsage. The loop stops at VK_MAX_MEMORY_HEAPS even if memoryHeapCount is larger, and heap size does not enter these totals. The arithmetic uses <cstdint> and standard unsigned operations on MSVC and Linux. The HUD and overlay format each total independently by dividing by a fixed GiB constant in runtime/src/memory_figures.h:42.

  • runtime/test/vulkan_memory_budget_test.cpp:43 covers overflow in all three totals, but runtime/CMakeLists.txt has no executable or CTest entry for it. Please register it where Vulkan::Headers is available so runtime CI exercises the regression.
  • runtime/test/d3d12_vram_budget_test.cpp:90 adds the two usage totals to check whether either is nonzero. If local usage saturates and shared usage is 1, the sum wraps to zero and the assertion fails. Please compare the fields independently with EXPECT(after.local_usage != 0 || after.shared_usage != 0).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6101400304 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#pullrequestreview-6101400304). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-29T04:28:45Z. **Review:** COMMENTED --- Static audit of `6376bbc20` only. No builds, tests, or GPU runs. `runtime/src/vulkan_memory_budget.h:22` correctly caps local `heapBudget`, local `heapUsage`, and shared `heapUsage`. The loop stops at `VK_MAX_MEMORY_HEAPS` even if `memoryHeapCount` is larger, and heap `size` does not enter these totals. The arithmetic uses `<cstdint>` and standard unsigned operations on MSVC and Linux. The HUD and overlay format each total independently by dividing by a fixed GiB constant in `runtime/src/memory_figures.h:42`. - `runtime/test/vulkan_memory_budget_test.cpp:43` covers overflow in all three totals, but `runtime/CMakeLists.txt` has no executable or CTest entry for it. Please register it where `Vulkan::Headers` is available so runtime CI exercises the regression. - `runtime/test/d3d12_vram_budget_test.cpp:90` adds the two usage totals to check whether either is nonzero. If local usage saturates and shared usage is `1`, the sum wraps to zero and the assertion fails. Please compare the fields independently with `EXPECT(after.local_usage != 0 || after.shared_usage != 0)`. AI-assisted.
OreoFR commented 2026-11-29 14:57:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T14:57:44Z.


TAKEN by OreoFR (Windows, RTX 4070 8 GB)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257710743 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#issuecomment-7257710743). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T14:57:44Z. --- TAKEN by OreoFR (Windows, RTX 4070 8 GB)
OreoFR commented 2026-11-29 21:33:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T21:33:02Z.


Verified by OreoFR — READY

  • Base: main c22a0a732 + this PR (head 6376bbc20) merged with --no-ff
  • Red (main + only this PR's test): runtime/test/vulkan_memory_budget_test.cpp is not registered in runtime/CMakeLists.txt, so it was compiled by hand (cl /std:c++20, Vulkan SDK headers) against main's vulkan_memory_budget.h: it fails at line 44 (saturated.available): the two device-local budgets wrap to 0 and the sum reports no budget.
  • Green (merge): the same test against this PR's header prints vulkan_memory_budget_test: ok. ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p1 = main + #2198 + #2333 + #2308 + #2268 (no shared files): 506 tests, new failures vs main: none. d3d12_queue_wait_timeout, d3d12_pipeline_workers and dxgi_waitable_latency failed in the parallel run and pass when re-run alone (main alone: 505 tests, 6 failures: big_compile_gate and api_ref_state and d3d12_queue_wait_timeout timeouts, xs_proxy_mock, vk_compile_gate_calibration, xbox_present; xbox_present fails in every package as on main)
  • gta6rt.exe links without the XMA decoder (LEONIDA_CARGO=OFF, LEONIDA_XMA2_DECODER_LIB empty) in package p1; imports unchanged vs main (25 DLLs, 755 functions, no WS2_32)
  • Diff read: no issue. The saturating add caps all three sums. Follow-up: the new test is never built by CMake, so neither ctest nor CI runs it; an add_executable + add_test next to vulkan_device_markers would keep it running.
  • Other runs: Consistent with zmasi's run and lixonik's, wavehs's and timbot103's reviews.
  • Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44

Ready to merge per the maintainers' plan.

AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262963730 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#issuecomment-7262963730). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T21:33:02Z. --- **Verified by OreoFR** — READY - Base: main c22a0a732 + this PR (head 6376bbc20) merged with --no-ff - Red (main + only this PR's test): `runtime/test/vulkan_memory_budget_test.cpp` is not registered in `runtime/CMakeLists.txt`, so it was compiled by hand (cl /std:c++20, Vulkan SDK headers) against main's `vulkan_memory_budget.h`: it fails at line 44 (`saturated.available`): the two device-local budgets wrap to 0 and the sum reports no budget. - Green (merge): the same test against this PR's header prints `vulkan_memory_budget_test: ok`. ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p1 = main + #2198 + #2333 + #2308 + #2268 (no shared files): 506 tests, new failures vs main: none. `d3d12_queue_wait_timeout`, `d3d12_pipeline_workers` and `dxgi_waitable_latency` failed in the parallel run and pass when re-run alone (main alone: 505 tests, 6 failures: big_compile_gate and api_ref_state and d3d12_queue_wait_timeout timeouts, xs_proxy_mock, vk_compile_gate_calibration, xbox_present; xbox_present fails in every package as on main) - gta6rt.exe links without the XMA decoder (`LEONIDA_CARGO=OFF`, `LEONIDA_XMA2_DECODER_LIB` empty) in package p1; imports unchanged vs main (25 DLLs, 755 functions, no WS2_32) - Diff read: no issue. The saturating add caps all three sums. Follow-up: the new test is never built by CMake, so neither ctest nor CI runs it; an `add_executable` + `add_test` next to `vulkan_device_markers` would keep it running. - Other runs: Consistent with zmasi's run and lixonik's, wavehs's and timbot103's reviews. - Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44 Ready to merge per the maintainers' plan. AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
fiestorra commented 2026-11-30 06:29:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T06:29:13Z.


Verified on this machine (Windows 11, MSVC 19.44.35226), and the finding is about the wiring, not the code: this pull request's own test is never built or run by anyone.

1. It applies. merge-tree clean; d2a4f7e5e cherry-picks onto main 0ae217ceb without a conflict. Two files: runtime/src/vulkan_memory_budget.h (new) and runtime/test/vulkan_memory_budget_test.cpp (new).

2. The test is not registered anywhere. runtime/CMakeLists.txt is not in the diff, and:

grep vulkan_memory_budget runtime/CMakeLists.txt   -> 0 occurrences, on main and on this branch

Every other vulkan_*_test is added one by one (add_executable(vulkan_device_filter_test …), add_executable(vulkan_device_markers_test …)), and the only foreach loops in that file cover specific sets that this name is not in. So ctest never builds it, BUILD_TESTING never enumerates it, and the pull request ships a test that nobody runs.

3. It compiles and passes once registered, which I checked by adding the two lines locally (in my worktree only, nothing pushed):

add_executable(vulkan_memory_budget_test test/vulkan_memory_budget_test.cpp)
target_link_libraries(vulkan_memory_budget_test PRIVATE Vulkan::Headers)
cmake --build … --target vulkan_memory_budget_test   -> linked
vulkan_memory_budget_test.exe                        -> exit 0, 0, 0

So the code is fine and the omission is the whole problem - three lines in runtime/CMakeLists.txt, next to the other vulkan_*_test entries.

Why this one matters beyond itself: this is exactly what #2668's test_all_test_sources_on_disk_are_wired exists to catch - a *_test.cpp on disk with no add_executable. After #2668 lands, this pull request would fail that check instead of passing silently. Until then, nothing in CI notices.

What I did not test: the behaviour. The test feeds made-up heaps to the two Vulkan structures; whether the HUD shows the right budget under VK_EXT_memory_budget needs the title with LEONIDA_TITLE_HUD=1, which is a run-level check.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7270698915 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#issuecomment-7270698915). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T06:29:13Z. --- Verified on this machine (Windows 11, MSVC 19.44.35226), and **the finding is about the wiring, not the code: this pull request's own test is never built or run by anyone.** **1. It applies.** `merge-tree` clean; `d2a4f7e5e` cherry-picks onto `main` `0ae217ceb` without a conflict. Two files: `runtime/src/vulkan_memory_budget.h` (**new**) and `runtime/test/vulkan_memory_budget_test.cpp` (**new**). **2. The test is not registered anywhere.** `runtime/CMakeLists.txt` is **not in the diff**, and: ``` grep vulkan_memory_budget runtime/CMakeLists.txt -> 0 occurrences, on main and on this branch ``` Every other `vulkan_*_test` is added one by one (`add_executable(vulkan_device_filter_test …)`, `add_executable(vulkan_device_markers_test …)`), and the only `foreach` loops in that file cover specific sets that this name is not in. **So `ctest` never builds it, `BUILD_TESTING` never enumerates it, and the pull request ships a test that nobody runs.** **3. It compiles and passes once registered, which I checked by adding the two lines locally (in my worktree only, nothing pushed):** ```cmake add_executable(vulkan_memory_budget_test test/vulkan_memory_budget_test.cpp) target_link_libraries(vulkan_memory_budget_test PRIVATE Vulkan::Headers) ``` ``` cmake --build … --target vulkan_memory_budget_test -> linked vulkan_memory_budget_test.exe -> exit 0, 0, 0 ``` So the code is fine and the omission is the whole problem - three lines in `runtime/CMakeLists.txt`, next to the other `vulkan_*_test` entries. **Why this one matters beyond itself:** this is exactly what **#2668**'s `test_all_test_sources_on_disk_are_wired` exists to catch - a `*_test.cpp` on disk with no `add_executable`. After #2668 lands, this pull request would fail that check instead of passing silently. Until then, nothing in CI notices. **What I did not test:** the behaviour. The test feeds made-up heaps to the two Vulkan structures; whether the HUD shows the right budget under `VK_EXT_memory_budget` needs the title with `LEONIDA_TITLE_HUD=1`, which is a run-level check. Written with an AI assistant.
KelboLive commented 2026-11-30 17:34:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T17:34:48Z.


Review finding on 6376bbc20: the new test is not wired into CMake, so CI will never build or run it.

  • The PR adds runtime/test/vulkan_memory_budget_test.cpp but touches no runtime/CMakeLists.txt entry.
  • Select-String for vulkan_memory_budget_test / memory_budget in runtime/CMakeLists.txt finds only the unrelated d3d12_vram_budget_test target (different file, device path).
  • So the saturation cases in the new file are unbuilt and untested. Suggested:
add_executable(vulkan_memory_budget_test test/vulkan_memory_budget_test.cpp)
target_include_directories(vulkan_memory_budget_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
add_test(NAME vulkan_memory_budget COMMAND vulkan_memory_budget_test)

(or register it inside the existing Vulkan block if it needs the device). I could not run it for this reason; the header change itself is untouched by this note.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7286528888 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#issuecomment-7286528888). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T17:34:48Z. --- Review finding on `6376bbc20`: the new test is not wired into CMake, so CI will never build or run it. - The PR adds `runtime/test/vulkan_memory_budget_test.cpp` but touches no `runtime/CMakeLists.txt` entry. - `Select-String` for `vulkan_memory_budget_test` / `memory_budget` in `runtime/CMakeLists.txt` finds only the unrelated `d3d12_vram_budget_test` target (different file, device path). - So the saturation cases in the new file are unbuilt and untested. Suggested: ```cmake add_executable(vulkan_memory_budget_test test/vulkan_memory_budget_test.cpp) target_include_directories(vulkan_memory_budget_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) add_test(NAME vulkan_memory_budget COMMAND vulkan_memory_budget_test) ``` (or register it inside the existing Vulkan block if it needs the device). I could not run it for this reason; the header change itself is untouched by this note. AI-assisted: yes (opencode).
KelboLive commented 2026-11-30 17:45:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T17:45:03Z.


Follow-up: the test itself is good — only the CMake wiring is missing.

Compiled it directly with MSVC (/std:c++20 /EHsc /W4, runtime\src + Vulkan SDK include) and ran it:

vulkan_memory_budget: ok

exit 0. So adding the add_executable/add_test block from the previous comment is enough; the saturation cases pass as written.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7286788317 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#issuecomment-7286788317). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T17:45:03Z. --- Follow-up: the test itself is good — only the CMake wiring is missing. Compiled it directly with MSVC (`/std:c++20 /EHsc /W4`, `runtime\src` + Vulkan SDK include) and ran it: ``` vulkan_memory_budget: ok ``` exit 0. So adding the `add_executable`/`add_test` block from the previous comment is enough; the saturation cases pass as written. AI-assisted: yes (opencode).
aslan2142 commented 2026-12-01 16:44:03 +00:00 (Migrated from github.com)

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


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:7318125146 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2333#issuecomment-7318125146). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:44:03Z. --- 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!2333
No description provided.