Repository navigation
geometry views: a released range counts in every GPU-only twin it overlaps (RT-GEOMETRY-RELEASE-GPU-RANGES) - #2524
Conversation
…rlaps (RT-GEOMETRY-RELEASE-GPU-RANGES) From kevincommits' finding on ProjectLeonida#1608 (item 1). geometry_writes::note_released and GeometryViews::drain_released mapped a released GPU-only range to its CPU view through view_at(begin, 1), which only finds the twin holding the range's first byte. A range that starts before a twin (a wider release, or the collapsed range of a full release queue) was dropped, and one that spans several twins was retired under the first twin's CPU view alone. A new title_gpu_views::for_each_gpu_overlap(begin, end, f) gives each twin's overlapping part at its CPU view. note_released queues a range when any such part touches the watched bounds, and drain_released retires the views under each part. The parts are collected first, so the twins' lock is not held while views are retired. Four new checks in geometry_views_test (a release starting before a twin, one spanning two adjacent twins) fail on main with one more knock-on failure; all 86 checks pass with the fix. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed at head Verification
Finding (Request changes)
AI-assisted review + local MSVC/dual-GPU verification. |
|
#2524 | head a855a6a (merged cleanly with main 09c1539) | |
lixonik
left a comment
There was a problem hiding this comment.
Reviewed the diff and tested merged onto main (493867366) with Ninja Release (MSVC).
Adding title_gpu_views::for_each_gpu_overlap and collecting overlapped CPU spans before calling retire_range outside the twin shared lock cleanly fixes both pre-twin-start and multi-twin releases without introducing lock-order issues.
Tests run
cmake --build <build> --target geometry_views_test gta6rt_d3d12_com: built cleanly.ctest --output-on-failure -R "^geometry_views$": 1/1 passed (0.11 s).
AI-assisted (Antigravity, Gemini).
timbot103
left a comment
There was a problem hiding this comment.
I reviewed head a855a6a98 by static inspection only, without running builds, tests, or GPU workloads. For stable reservations, the half-open clipping covers partial and full intersections and excludes ranges that only touch an endpoint. Retirement runs after the pair lock is released.
Request changes. At runtime/shims/d3d12_geometry_views.h:553, the drain translates a queued GPU release using the current pair table. If G is released while paired with CPU range A, then reused and paired with B before the drain, the appended pairing at runtime/src/title_page_watch.h:268 makes the old release evict a live view created at B. That view disappears from lookup while its retired storage still counts against the cap. Please capture the released reservation's CPU clips before its GPU address can be reused, enqueue them, and remove its pairing on successful MEM_RELEASE. A regression should resolve B between the release and the drain and verify that B stays live.
The multi-twin test at runtime/test/geometry_views_test.cpp:335 also leaves note_released's later-twin filter untested. Please add a release whose first CPU clip is outside the watched bounds and whose second CPU clip hits a live view, then check both queueing and retirement.
AI-assisted.
|
Tested
Still open from review, with no author reply (I did not test these):
AI-assisted (Claude Code). |
Package RT-GEOMETRY-RELEASE-GPU-RANGES: item 1 of @kevincommits' finding on #1608 (#1608 (comment)). Thank you for the find and the two cases. Claim: #1608 (comment).
The bug
Geometry views are keyed by the CPU view's address. A released GPU-only range is mapped to its twin's CPU view in two places:
geometry_writes::note_released(runtime/src/title_geometry_watch.h) andGeometryViews::drain_released(runtime/shims/d3d12_geometry_views.h). Both did it throughtitle_gpu_views::view_at(begin, 1, pair), which only finds the twin that holds the range's first byte. So:note_releaseddropped it, anddrain_releasedretired nothing for the twin.The fix
title_gpu_views::for_each_gpu_overlap(begin, end, f)(runtime/src/title_page_watch.h) callsfonce for each twin whose GPU range overlaps[begin, end). It passes the overlapping part, named at that twin's CPU view.note_releasedqueues the range when any such part touches the watched bounds.drain_releasedretires the views under each part. The parts are collected first, so the twins' lock is not held while views are retired.#2471 changes other lines of this code (
release()and the reopener).Tests (
geometry_views_test, test 8)Kevin's two cases, on a fake device:
[twin - 4 KiB, twin + 4 KiB)is queued, and draining it retires the view under the overlapped part only.On main, the 4 new checks fail, plus a knock-on failure in test 9 because the view count is off. With the fix, all 86 checks pass (3 runs). Nearby tests (
ctest -R "geometry|title_va|title_page|title_window|gpu_views") pass 16/16, andgta6rt_d3d12_combuilds.Profile M: RTX 4070 SUPER, Windows 11, Ryzen 7 9800X3D, MSVC RelWithDebInfo. CPU only. The full suite was not run because a boot was running.
git diff --checkandscripts/check_no_game_data.pyare clean. No game files used.AI-assisted (Claude Code).
🤖 Generated with Claude Code