mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #79] [CLOSED] Keep query recording state consistent after allocation failure #131
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#131
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/79
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:old-pr/9806📝 Commits (1)
d1a1e24Keep query recording state consistent after allocation failure📊 Changes
3 files changed (+105 additions, -1 deletions)
View changed files
📝
runtime/CMakeLists.txt(+2 -0)📝
runtime/src/command_list.h(+8 -1)➕
runtime/test/command_list_query_oom_test.cpp(+95 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115417536
Problem and fix
CommandList::begin_queryadds an active query before recording its command. If command-vector allocation throws, the active entry remains without a recorded begin, and a retry is refused.end_queryremoves the active entry before recording the end; an allocation failure then leaves an unmatched begin and refuses a retry.Roll back the active entry when begin-command append throws. For EndQuery, append the command before removing the active entry. This keeps the command stream and active state consistent after allocation failure without changing successful recording or timestamp behavior.
The COM
BeginQueryandEndQuerymethods do not currently catchstd::bad_alloc; this patch protects the portableCommandListhelper and any caller that can catch and retry. It does not add COM-level recovery.Tests
2d53a8055at the first stale-state assertion, then passes with this fix. It covers first command allocation, later growth, failed EndQuery, retries, normal pairs, and repeated timestamps.#6077headb91f90f8ea84d643488de2403182804d387f3543composed in a disposable copy.#6077is closed unmerged, so there is no current dependency.test_exec_computed,test_image_atomics_guard). No translator code changed.make_game.py --help, changed-file no-game-data scan, andgit diff --checkpassed.Tested on macOS 27.2 arm64 / Apple M5 Ultra. The allocation-failure regression is CPU-only. The full portable CTest run included Vulkan-capable tests on this host; no dedicated real-GPU allocation-failure test or native MSVC Debug test was performed. The allocation filter targets command-vector storage by size to avoid smaller MSVC Debug iterator-proxy allocations.
AI-assisted: yes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.