mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1967] perf(descriptor_table): bulk memcpy table serialization/readback and bound changed_slots_ growth #1974
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#1974
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/1967
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:perf/rt-descriptor-table-bulk-copy-and-dirty-cap📝 Commits (1)
5f188a1perf(descriptor_table): bulk memcpy GPU table serialization and bound dirty-slot tracking📊 Changes
2 files changed (+75 additions, -20 deletions)
View changed files
📝
runtime/src/descriptor_table.h(+37 -20)📝
runtime/test/descriptor_table_test.cpp(+38 -0)📄 Description
Claim:
RT-DESCRIPTOR-TABLE-BULK-COPY-AND-DIRTY-CAP(claim comment#7168739564on #1608).Optimizations (
runtime/src/descriptor_table.h)std::memcpyforwrite_to_buffer(),build_gpu_buffer(), andread_slots():static_asserts provingDescriptorEntryis trivially copyable and tightly packed (sizeof == 40,key @ 0,index @ 32,pad @ 36).!clear_pad(all runtimeBindlessSetGPU flushes), replaced per-entry loops (including the double-copy through a stackslot[10]array inwrite_to_buffer) with a single contiguousstd::memcpy.clear_pad == true, writes the 36-byte(key, index)prefix and trailing 4-byte zero in a single sequential pass (WC-friendly, no stack double-copy).changed_slots_memory and skip redundant tracking whenall_changed_is already set:all_changed_is true (afterclear()orgrow_locked()),mark()returns immediately instead of pushing every subsequent insert/erase ontochanged_slots_.!all_changed_andchanged_slots_.size() > entries_.size()(repeated updates/erases between flushes), compactschanged_slots_in place withstd::sort+std::uniquewithout flippingall_changed_(preserving the in-place non-relocating flush contract so untouched live slots are never rewritten).hash_descriptor_keyout ofinsert_locked()retry loop: avoids recomputing the hash on retries aftergrow_locked().Verification
CMakeLists.txtchanges).runtime/test/descriptor_table_test.cppto testwrite_to_buffer(nullptr), multi-slotread_slotsacross full and mid-table ranges,all_changed_suppressingchanged_slots_accumulation, and repeated-mutation compaction without spuriously settingchanges.all.descriptor_table_testcleanly under:clang++ -std=c++20 -O1 -g -fsanitize=address,undefined -Wall -Wextra -Werrorclang++ -std=c++20 -O1 -g -fsanitize=thread -Wall -Wextra -Werrorclang++ -std=c++20 -O2 -Wall -Wextra -Werror-O2vsmainon a 65,536-slot (2.62 MB) table with 24,000 live entries (best of 5 runs, Apple Silicon):python3 -I scripts/check_no_game_data.pyon both files andpython3 -I tests/test_text_write_line_endings.py: all passed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.