title_page_watch: no endless alias walk, mark() covers watched parts, no end wraps (RT-TITLE-PAGE-WATCH-BOUNDS) #2546
Closed
github-bot
wants to merge 1 commit from
github-bot/gh-2546 into main
AGit
pull from: github-bot/gh-2546
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2546
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2546"
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?
@Tyrannys on GitHub · 2026-11-28 01:40 UTC · original
Tyrannys:rt-title-page-watch-bounds→main· +199 −14 · 3 files · 1 commits · closed without mergingPackage RT-TITLE-PAGE-WATCH-BOUNDS: item 2 of @kevincommits' Finding 19 on #1608 (#1608). Thank you for the find. Claim: #1608.
What changes (
runtime/src/title_page_watch.h)title_page_aliases::for_each_inalways ends.va < end; va += kPageSize. Whenendis nearUINTPTR_MAX(the whole rangetitle_memory_map::changed()reports) and a page is aliased,vawrapped to 0 and the walk never ended.update_aliasedind3d12_vulkan_device.cpp) does not depend on the order.title_write_watch::mark.toup wrapped to 0 near the top of the address space, so the mark was dropped. It now saturates, astitle_memory_map::changeddoes.contains(from), so a range that starts before a reservation marked nothing. It now marks every write-watched part of the range throughfor_each_in.kKeeppages in all, every reader takes all of its pages as written, as before.title_write_watch::add,kernel_writes::begin_writeandhold, andtitle_texel_writes::notecap their end atUINTPTR_MAX. Before,begin + bytescould wrap, andfor_each_pinthen never found the pin.read_file_scattercounts its pages in 64 bits. Before, abytesvalue near 4 GiB rounded to 0 pages in aDWORD.Tests
New
title_page_watch_bounds_test(CPU only). It does address arithmetic only: nothing is mapped or touched at the addresses it uses.[top - 8 pages, UINTPTR_MAX): the walk ends and finds exactly the two aliased pages in range.mark(base - 1 page, base + 1 page)marks the reservation's first page, and not the unwatched page before it.addof a reservation running past the top keeps it, andmark(..., UINTPTR_MAX)marks its pages.begin_writeandholdof[UINTPTR_MAX - 0xfff, +0x2000)give pins thatfor_each_pinfinds.notepast the top is kept as[begin, UINTPTR_MAX).On main, the first check hangs. The test runs that walk on a thread with a 5 s limit and reports it as a failure. With that case left out, 6 of the other 7 checks fail on main. With the fix, all 10 pass.
read_file_scatter's count has no test, because it would need a read with a million segments.Nearby tests pass 16/16:
ctest -R "title_page_watch|title_write_watch|title_memory_map|kernel_writes|geometry_views|xmem|title_va".gta6rt_d3d12_combuilds.Profile M: RTX 4070 SUPER, Windows 11, Ryzen 7 9800X3D, MSVC RelWithDebInfo. The full suite was not run because a boot was running.
git diff --checkandscripts/check_no_game_data.pyare clean. No open PR touches this file. No game files used.AI-assisted (Claude Code).
🤖 Generated with Claude Code
@zmasi on GitHub · 2026-11-28 03:18 UTC · original
#2546 | head
aaff683f3b(merged cleanly with main02f71ccfe7) |ctest --test-dir runtime/build -C RelWithDebInfo -R "^(title_page_watch_bounds|title_write_watch|title_write_watch_on|title_memory_map)$" --output-on-failure| red on main:title_page_watch_boundsfails at runtime (FAIL for_each_in over a range ending at UINTPTR_MAX ends— hangs and times out after5.15sasva += kPageSizewraps pastUINTPTR_MAXto0) | green on PR+main:4/4CTests pass (title_page_watch_bounds10/10checks in0.07s,title_write_watch18/18,title_write_watch_on18/18,title_memory_map20/20);test_ci_registration.py18/18OK,check_no_game_data.py0violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yesAudited
for_each_inpage-count bounding and sparse-set fallback (pages > s.aliased.size()), lock-ordered gathering of watched subranges befores.journalinmark(), saturatingUINTPTR_MAXbounds acrossadd/begin_write/hold/note, and 64-bit page-count arithmetic inread_file_scatter.@lixonik on GitHub · 2026-11-28 08:51 UTC · original · approved these changes
Reviewed the diff and tested merged onto
main(493867366) with Ninja Release (MSVC).Saturating top-of-address-space bounds and fixing page counting in
for_each_in(title_page_watch.h) cleanly avoid wrap-around edge cases, and the new bounds tests plus existing watch/memory-map suites all pass.Tests run
ctest --output-on-failure -R "^(title_page_watch_bounds|title_write_watch|title_write_watch_on|title_memory_map)$": 4/4 passed (title_memory_map0.03 s,title_write_watch0.02 s,title_page_watch_bounds0.03 s,title_write_watch_on0.00 s).AI-assisted (Antigravity, Gemini).
@timbot103 on GitHub · 2026-11-29 01:06 UTC · original · reviewed
Static audit of
aaff683f3against48bae6cad. Please fix the alias ordering before merging.runtime/src/title_page_watch.h:232emits sparse alias hits in hash-set order, butruntime/shims/d3d12_vulkan_device.cpp:1211binary-searches the resulting list. A missed hit releases an active guard entry and rebuilds it in the same refresh. Please sort the list before searching and cover guard retention across successive refreshes.runtime/src/title_page_watch.h:631andruntime/src/title_page_watch.h:645can still overflow on a synthetic[0, UINTPTR_MAX)overlap. Use1 + (span - 1) / kPagefor a nonempty span. Atruntime/src/title_page_watch.h:229andruntime/src/title_page_watch.h:623, validate the original endpoints before rounding so empty or reversed ranges do nothing.AI-assisted.
@lixonik on GitHub · 2026-11-29 02:45 UTC · original
On
aaff683f3b0a5cac33d7c05dff98d0a6380d1e9emerged intomainc8bf0e7b65, the stock bounds test passed all 10 checks. I also exercised the alias ordering from the later review on Windows 10/MSVC 19.29.I inserted three synthetic aliases in a nonascending order and scanned a range with more pages than aliases. Main returned a sorted list, and the same
std::binary_searchused by the consumer found all three. With the PR, the list was unsorted and that search found only two. This confirms that the consumer needs a sort before deciding which guards to retain.An empty interval wholly inside a single aliased page gave one callback on both builds. The PR also accepted a synthetic whole-address-space watch record, but
mark(0, UINTPTR_MAX)did not advance the all-pages fallback, as the rounded page count wrapped to zero. No addresses were mapped or dereferenced.AI-assisted. Codex (GPT-6).
@OreoFR on GitHub · 2026-11-29 05:47 UTC · original
Verified by OreoFR — FAILS (diff read)
c8bf0e7b6+ this PR (headaaff683f3) merged with --no-fftitle_page_watch_boundsfails on main:for_each_in over a range ending at UINTPTR_MAX ends(the walk did not end; the test's 5 s limit cut it). The test's CMake registration was kept for the red run.title_page_watch_boundspasses; ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p1 = main + #2546 + #1681 + #2479 + #1790 (no shared files): 495 tests, new failures vs main: none; an xmem working-set check failed once in the package as it does on main, and passed 5/5 when re-run alone;xmem_write_watchfailed once in the package (a view-split reader check already on main) and passed 5/5 when re-run alone on main + this PR (main alone: 494 tests, 5 failures: loader, xs_proxy_mock, xmem_no_write_watch, api_ref_state timeout, xbox_present; xbox_present fails in every package as on main)LEONIDA_CARGO=OFF,LEONIDA_XMA2_DECODER_LIBempty), main + this PR alone; imports unchanged vs main (25 DLLs, 655 functions, no WS2_32)runtime/src/title_page_watch.h:232: when the range has more pages than the alias set,for_each_innow walks theunordered_set, so the pages come out in hash order. Butruntime/shims/d3d12_vulkan_device.cpp:1239fillsaliased_list_from it, and:1251runsstd::binary_searchon that list. An unsorted list breaks the search, so blocks that are still aliased can be released and re-armed. The tracker range is usually much larger than the alias set, so this is the common path. Sortingaliased_list_after the walk, or sorting in the set path, fixes it. The wrap guards are right.AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
@fiestorra on GitHub · 2026-11-30 06:00 UTC · original
Independent verification on this machine (Windows 11, MSVC 19.44.35226), and the negative control reproduces the bug the commit fixes, which is the best outcome a verification can have.
1. It applies.
merge-treeclean;aaff683f3cherry-picks ontomain0ae217cebwithout a conflict. Three files,199 insertions(+), 14 deletions(-).2. It builds and passes, three times:
title_page_watch_bounds_test.exe-> exit 0, 0, 0.3. With
main'stitle_page_watch.hthe test does not just fail, it reports the endless walk:That is the commit's first line - "no endless alias walk" - reproduced as a failing assertion on
mainand gone with the change. The second half (mark()covering the watched parts) is exercised by the checks that pass on both; the endless walk is the part that demonstrably differs.A measurement note, because this one nearly slipped past me: the binary timestamp had to change for this to mean anything (07:00:05 -> 07:00:14,
[2/2] Linking). A failed compile leaves the previous executable in place, and an old binary that passes looks exactly like a fix. I check the timestamp for that reason, after publishing from a stale binary earlier in this session.What I did not test: the title. The test drives
for_each_inwith synthetic ranges; whether the real page walk reachesUINTPTR_MAXdepends on the title's memory map, which this machine does not load in a test.Written with an AI assistant.
@KelboLive on GitHub · 2026-11-30 16:38 UTC · original
Independent check on Windows (not the author), at
aaff683f3.title_page_watch_bounds_testand ran it: 10 checks, 0 failures — including the saturation cases (markending atUINTPTR_MAX,begin_write/holdpast the top, texel write kept as[begin, UINTPTR_MAX)).Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711.
AI-assisted: yes (opencode).
@aslan2142 on GitHub · 2026-12-01 16:46 UTC · original
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed