gpu: preserve range-set nodes when subtracting partial ranges #2123
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2123
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2123/head"
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?
@tikD1337 on GitHub · 2026-11-05 08:20 UTC · original
tikD1337:codex/rangeset-subtract→main· +62 −5 · 2 files · 1 commits · closed without mergingChange
RangeSet::Subtracterased an overlapping map node and allocated replacements even when only trimming one edge. Keep the left tail in place; rekey the right tail with a C++17 map node handle; when splitting, retain one node and allocate only the second tail. Fully covered nodes are still erased.RangeSetis used by the buffer cache for GPU-modified byte ranges and checked colour metadata. There are no game-specific conditions or changes to locking or synchronization.Draft: no game-level performance or bug-fix result is established. The allocation savings below are a CPU-only candidate for further profiling; I understand the project's contribution rules ask for evidence tied to a concrete game.
Checked locally
Windows, Intel Core i7-1185G7; portable Zig 0.15.2 C++ compiler.
TestRangeSetinMemoryTrackerTests.cpp: 20000 seeded add/subtract operations compared with a 256-byte oracle, plus 20808 exhaustive single-interval subtraction cases with 17 byte-membership queries each.-O3and-O0 -gbuilds with-Wall -Wextra -Werror.git diff --check origin/main: passed.RangeSet::Subtractbody as current main; none implements node reuse. #1469 addsFindtests at the end ofTestRangeSet, so combining those test additions may require a rebase. The automated scan is not claimed as passed.This was not a run of the full
memory_tracker_testsexecutable. The harness includes the actual production header and extracts the actualTestRangeSetfunction; it supplies a minimal generated platform config, the pinned fmt dependency in header-only mode, and an abort-onlyCommon::DbgExitHandler. No emulator, GPU, full build or CTest run was performed.Allocation counts and synthetic timings
Seven alternating executable runs; medians of average ns/call per run. Each run times 204800 Subtract calls in 200 separately initialized sets, with setup and destruction outside timers and final contents checked. An
operator newcounter is enabled only during Subtract.The removed allocations are stronger evidence than these noisy laptop timings. The sample patterns are synthetic; their frequency in real game workloads was not measured. No FPS or frame-time gain is claimed.
Reproduce CPU test and benchmark
Keep the checkout named
kyty-perf. Save the two Python scripts below in its parent directory. Initialize the repository's pinned3rdparty/fmtsubmodule. In that parent directory, createrange-cpu-config/cmake_config.hwith:Run:
prepare-range-cpu.py:range-cpu-repeat.py:Remaining validation
No Linux/macOS run, real game trace or GPU validation has been performed for this patch.
AI assistance
AI-assisted: yes. Codex wrote the patch, tests, harness, benchmark and this description and ran the reported local checks. Human review and the validation above are still needed.
Pull request closed