queue_families: select earliest slot in pick_queue_slot when all slots are UINT32_MAX #2310
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2310"
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 narekshaghoyandev on 2026-11-26T13:42:20Z.
Fixes an edge case in
leonida::pick_queue_slot()(runtime/src/queue_families.h):fewestwas initialized toUINT32_MAXand updated only whenusers[i] < fewest. If every slot in non-empty pools hadUINT32_MAXusers,pick_queue_slot()returned{SIZE_MAX, 0}(the sentinel meaning every pool is empty).chosen.pool == SIZE_MAX || users[i] < fewestso the earliest available slot is always selected when at least one pool is non-empty.runtime/test/queue_families_test.cpp.Verification
g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/queue_families_test.cpppassedg++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/queue_families_test.cpppassedsat.pool == 1 && sat.index == 0, exit 1) against unmodifiedubiq/mainpython3 -I scripts/check_no_game_data.py runtime/src/queue_families.h runtime/test/queue_families_test.cppcleanClaimed in the coordination issue as: RT-QUEUE-FAMILIES-SLOT-MAX (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193699762)
AI-assisted: yes (Gemini)
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T20:50:23Z.
Code review location:
runtime/test/queue_families_test.cpp; line 28[P3] Include this regression in the normal CTest run. I could reproduce the red/green result by compiling this file directly, but the configured runtime build has no target or test for it. The existing
vk_queue_test.cppalready covers the empty-pool and tie cases ofpick_queue_slot. Adding the saturated case alongside those would exercise it in CI without another executable.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T20:50:23Z.
Review: COMMENTED
Compared the new standalone test with GCC on Ubuntu against
mainatfac8b4bb9and the PR merged onto that revision. Only the baseline failed the saturated-slot assertion at line 28. The existingvk_queueCTest also passed on Windows 11 with MSVC and an RTX 5070. The standalone regression needs to be included in the normal test run.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:16:03Z.
VERIFY-2310— verified headbddeb09264merged cleanly withmaind48a957bbon Windows 11 Pro (build 26200), MSVC19.44(x64,/std:c++20 /W4 /WX /permissive- /utf-8 /EHsc), synthetic queue-family slot arrays only.Red (
maind48a957bb) -> Green (d48a957bb+bddeb09264)main:runtime/test/queue_families_test.cppagainstmain'sruntime/src/queue_families.h-> FAILED (exit 1atline 28: sat.pool == 1 && sat.index == 0, becauseusers[i] < fewestnever matched whenfeweststarted atUINT32_MAXand every non-empty pool slot hadUINT32_MAXusers).cl.exe /nologo /std:c++20 /W4 /WX /permissive- /utf-8 /EHsc /I"runtime/src" runtime/test/queue_families_test.cpp(with Vulkan headers) -> 0 warnings, exit0(queue_families_test: ok).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:01:52Z.
Verified by OreoFR
c1ecf04ed+ PR headbddeb0926; green run in a merge package of 16 PRs, no new ctest failure vs mainstandalone build of queue_families_test.exe (the test is not registered in CMake)sat.pool == 1 && sat.index == 0AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T22:49:46Z.
Tested
bddeb0926merged (no commit) withmainaa918e5d9, MSVC 19.52 (Visual Studio 18), Windows 11 10.0.26300.Blocker:
runtime/test/queue_families_test.cppis new but is not registered inruntime/CMakeLists.txt, so neither CI norctestever builds or runs it.ctest -Non the merge lists no such test, andtests/test_ctest_registration.pystill passes, so nothing catches this. Registering it the way the other header-only tests are would fix that:Also,
queue_families.hincludesvulkan/vulkan.h, so this test needstarget_link_libraries(queue_families_test PRIVATE Vulkan::Headers)inside theif(TARGET Vulkan::Headers)block.Hand-compiled (
cl /std:c++20 /EHsc /O2):queue_families_test: ok, exit 0.runtime/src/queue_families.hback tomain:line 28: sat.pool == 1 && sat.index == 0, exit 1.I did not run the ctest tests relinked by the header change: test runs on this machine are paused for memory.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:28:10Z.
Review: COMMENTED
Static review of
bddeb0926only. I ran no builds, tests, or GPU runs.runtime/src/queue_families.h:110now selects the first slot on an all-UINT32_MAXtie. The strict comparison keeps the first minimum in pool and slot order, so zero counts win, lower counts displace saturated ones, and no supplied slots still yields{SIZE_MAX, 0}. The changed condition uses the existing C++20 types and limit macros on MSVC and Linux.runtime/shims/d3d12_vulkan_device.cpp:16162, two saturated graphics slots with an empty own-family pool now select graphics slot 0. Its 32-bit live-user count wraps to zero as the caller takes the lease, so another selection can treat that busy queue as unused. Please returnE_OUTOFMEMORYif the selected counter is already atUINT32_MAX, while holdingqueue_mutex_and before incrementing.runtime/test/queue_families_test.cpp:28has no CMake target or CTest entry. Please register it in the Vulkan-headers section ofruntime/CMakeLists.txt:1895and link it toVulkan::Headersso the CPU-only regression runs in the normal suite.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:26:23Z.
Merged. Tested by OreoFR (RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11) on this head: queue_families_test red on main (line 28), green with the PR. Note: the test is not registered in CMake. AI-assisted: yes.