mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #1788] runtime: preserve in-flight GPU label targets when expanding a non-heap region (RT-GPU-LABEL-MEMORY-EXPAND) #1803
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#1803
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/1788
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/rt-gpu-label-memory-expand📝 Commits (1)
0267290runtime: preserve in-flight GPU label targets when expanding a non-heap region📊 Changes
3 files changed (+207 additions, -2 deletions)
View changed files
📝
runtime/CMakeLists.txt(+5 -0)📝
runtime/src/gpu_label_memory.h(+8 -2)➕
runtime/test/gpu_label_memory_test.cpp(+194 -0)📄 Description
Summary
Fixes
leonida::label::Memory::track()inruntime/src/gpu_label_memory.hso growing a tracked non-heap region at the samebaseandallocation_baseupdatesRegion::endin place instead of overwritingregions_[base]and dropping in-flight GPU completion value writes.RT-GPU-LABEL-MEMORY-EXPANDRoot cause
In
Memory::track(base, bytes, allocation_base, heap):basewith the sameallocation_basealready existed and a newtrack()call covered a larger range (end > r.end), the early-return checkend <= r.endfailed and line 41 executedregions_[base] = std::make_shared<Region>(...).regions_[base]destroyed the previousRegionshared_ptr(and causedit->second != regioninpublish()), silently dropping any in-flightlabel::TargetGPU completion writes captured from[base, old_end)before the expansion.Changes
runtime/src/gpu_label_memory.h:!heapand an existing non-heap region at the samebaseandallocation_baseis expanded (base == r.begin && end > r.end), updater.end = endin place undermutex_.Regionidentity andgeneration(so stale pre-decommit targets remain rejected, live post-decommit targets survive further expansion, adjacent pages stay isolated from each other's partial decommits, and heap regions or distinctallocation_basereservations still allocate a freshRegion).runtime/test/gpu_label_memory_test.cpp&runtime/CMakeLists.txt:gpu_label_memoryCTest covering in-place expansion, post-partial-release generation retention, subrange and adjacent-page isolation, heap and new-reservation invalidation, base-0 GPU arena tracking, alignment/overflow bounds, and concurrent expand/capture/publish under TSan.Verification
gpu_label_store/xbox_gpu_labeltests rely on Windows CI).clang++ -std=c++20 -Wall -Wextra -Werror -fsanitize=address,undefined -O1 runtime/test/gpu_label_memory_test.cpp— passclang++ -std=c++20 -Wall -Wextra -Werror -fsanitize=thread -O1 runtime/test/gpu_label_memory_test.cpp— pass (zero data races)clang++ -std=c++20 -Wall -Wextra -Werror -O2 runtime/test/gpu_label_memory_test.cpp— passgpu_label_memory_test.cppagainst unpatchedmain:runtime/src/gpu_label_memory.h— fails ontest_expand_preserves_inflight_targets, confirming regression coveragepython3 -I scripts/check_no_game_data.py runtime/src/gpu_label_memory.h runtime/test/gpu_label_memory_test.cpp runtime/CMakeLists.txt— passpython3 -I tests/test_text_write_line_endings.py— 3/3 pass🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.