[PR #2310] queue_families: select earliest slot in pick_queue_slot when all slots are UINT32_MAX #2313

Open
opened 2026-11-26 21:20:47 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2310
Author: @narekshaghoyandev
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: ubiq-queue-families-slot-max


📝 Commits (1)

  • bddeb09 queue_families: select earliest slot in pick_queue_slot when all slots are UINT32_MAX

📊 Changes

2 files changed (+40 additions, -1 deletions)

View changed files

📝 runtime/src/queue_families.h (+1 -1)
➕ runtime/test/queue_families_test.cpp (+39 -0)

📄 Description

Fixes an edge case in leonida::pick_queue_slot() (runtime/src/queue_families.h):

  • Previously, fewest was initialized to UINT32_MAX and updated only when users[i] < fewest. If every slot in non-empty pools had UINT32_MAX users, pick_queue_slot() returned {SIZE_MAX, 0} (the sentinel meaning every pool is empty).
  • Check chosen.pool == SIZE_MAX || users[i] < fewest so the earliest available slot is always selected when at least one pool is non-empty.
  • Added standalone unit test 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.cpp passed
  • g++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/queue_families_test.cpp passed
  • Negative control: new test failed on line 28 (sat.pool == 1 && sat.index == 0, exit 1) against unmodified ubiq/main
  • python3 -I scripts/check_no_game_data.py runtime/src/queue_families.h runtime/test/queue_families_test.cpp clean

Claimed in the coordination issue as: RT-QUEUE-FAMILIES-SLOT-MAX (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193699762)
AI-assisted: yes (Gemini)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2310 **Author:** [@narekshaghoyandev](https://github.com/narekshaghoyandev) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ubiq-queue-families-slot-max` --- ### 📝 Commits (1) - [`bddeb09`](https://github.com/ubiquitarianism/leonida/commit/bddeb092648a6fc8bfb09d8316096fc94477be71) queue_families: select earliest slot in pick_queue_slot when all slots are UINT32_MAX ### 📊 Changes **2 files changed** (+40 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/queue_families.h` (+1 -1) ➕ `runtime/test/queue_families_test.cpp` (+39 -0) </details> ### 📄 Description Fixes an edge case in `leonida::pick_queue_slot()` (`runtime/src/queue_families.h`): - Previously, `fewest` was initialized to `UINT32_MAX` and updated only when `users[i] < fewest`. If every slot in non-empty pools had `UINT32_MAX` users, `pick_queue_slot()` returned `{SIZE_MAX, 0}` (the sentinel meaning every pool is empty). - Check `chosen.pool == SIZE_MAX || users[i] < fewest` so the earliest available slot is always selected when at least one pool is non-empty. - Added standalone unit test `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.cpp` passed - `g++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/queue_families_test.cpp` passed - Negative control: new test failed on line 28 (`sat.pool == 1 && sat.index == 0`, exit 1) against unmodified `ubiq/main` - `python3 -I scripts/check_no_game_data.py runtime/src/queue_families.h runtime/test/queue_families_test.cpp` clean Claimed in the coordination issue as: RT-QUEUE-FAMILIES-SLOT-MAX (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193699762) AI-assisted: yes (Gemini) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#2313
No description provided.