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).
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