runtime/test: a clean refresh of a half-reserved write-watched range queries no page (RT-EXISTING-HEAP-WW-RESERVED-QUERY) #3512

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u  "rt/existing-heap-ww-reserved-query:jirehcwe-rt/existing-heap-ww-reserved-query"
git switch "jirehcwe-rt/existing-heap-ww-reserved-query"
Open
leonida/mandy
jirehcwe wants to merge 1 commit from jirehcwe/mandy:rt/existing-heap-ww-reserved-query into main

This branch is out-of-date with the base branch

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'rt/existing-heap-ww-reserved-query:jirehcwe-rt/existing-heap-ww-reserved-query'
git switch 'jirehcwe-rt/existing-heap-ww-reserved-query'
First-time contributor

Claimed in the coordination issue as: RT-EXISTING-HEAP-WW-RESERVED-QUERY (claim)

What and why

d3d12_existing_heap and d3d12_existing_heap_write_watch fail on every native Windows run with a Vulkan device, at
runtime/test/d3d12_existing_heap_test.cpp:3062, EXPECT(clean_queries == 1); // the reserved half.

be1084b7a deliberately made ShadowPages::unchanged() pass over uncommitted (kZero) pages. A commit over them
reaches the shadow through title_memory_map::changed, which sets kRequery. Two tests were updated to match:
be1084b7a moved check_commit_changes from 1 query to 0 ("normal walk skips both"), and fc48934c5 did the same for
check_shadow_adopts_geometry_guard. check_write_watched was missed: in step 1, a submission with nothing written
still expected one query for its reserved half. It now queries none.

That commit was checked on the Linux portable CTest, where these Windows GPU tests don't run.

The change is test-only: the expectation, its comment, and the step-1 description in the function's header comment. No
runtime change.

Tested

  • Before the change, on main f4b0404e9: both tests fail, only at line 3062 (clean_queries=0 asks=1 written=0,
    measured with a temporary print).
  • After the change, rebuilt d3d12_existing_heap_test. All 5 ctest entries that run this program pass:
    d3d12_existing_heap, d3d12_host_prefix, d3d12_mapped_plane_async, d3d12_existing_heap_no_write_watch and
    d3d12_existing_heap_write_watch.
  • python -I scripts/check_no_game_data.py: clean, on the whole tree and on the changed file.
  • An independent read-only reviewer agent traced the runtime side and approved:
    • The behaviour change is intended, not a regression: the title's VirtualAlloc, VirtualFree and VirtualProtect shims
      and the xmem paths all journal through title_memory_map::changed.
    • 0 holds for the read-write and write-combined variants.
    • The no_write_watch entry doesn't run this check.
    • Under LEONIDA_SHADOW_FULL_WALK=1, which no ctest entry sets, this check would fail. It did before this change too,
      and only check_commit_changes handles that mode.

GPUs tested: NVIDIA GeForce RTX 3060 Ti, driver 610.88, Windows 11 Pro (build 26200)

AI-assisted: yes. Claude Code with Claude Opus 5.5 wrote the change. A separate read-only reviewer agent on Claude Opus
5.5 reviewed it.

Follow-ups (not in this pull request)

  • runtime/shims/d3d12_vulkan_device.cpp:755-761 still says zero pages are passed over only "between the refreshes
    that copy aliased pages". Since be1084b7a, they are passed over on every refresh that isn't a full walk.
  • No test commits a page in the reserved half of a write-watched range and checks that it arrives through the journal.
    check_commit_changes covers this for an unwatched range only.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

Claimed in the coordination issue as: RT-EXISTING-HEAP-WW-RESERVED-QUERY ([claim](https://clearfieldswimming.com/leonida/mandy/issues/3312#issuecomment-26772)) ### What and why `d3d12_existing_heap` and `d3d12_existing_heap_write_watch` fail on every native Windows run with a Vulkan device, at `runtime/test/d3d12_existing_heap_test.cpp:3062`, `EXPECT(clean_queries == 1); // the reserved half`. `be1084b7a` deliberately made `ShadowPages::unchanged()` pass over uncommitted (`kZero`) pages. A commit over them reaches the shadow through `title_memory_map::changed`, which sets `kRequery`. Two tests were updated to match: `be1084b7a` moved `check_commit_changes` from 1 query to 0 ("normal walk skips both"), and `fc48934c5` did the same for `check_shadow_adopts_geometry_guard`. `check_write_watched` was missed: in step 1, a submission with nothing written still expected one query for its reserved half. It now queries none. That commit was checked on the Linux portable CTest, where these Windows GPU tests don't run. The change is test-only: the expectation, its comment, and the step-1 description in the function's header comment. No runtime change. ### Tested - **Before the change**, on `main` `f4b0404e9`: both tests fail, only at line 3062 (`clean_queries=0 asks=1 written=0`, measured with a temporary print). - **After the change**, rebuilt `d3d12_existing_heap_test`. All 5 ctest entries that run this program pass: `d3d12_existing_heap`, `d3d12_host_prefix`, `d3d12_mapped_plane_async`, `d3d12_existing_heap_no_write_watch` and `d3d12_existing_heap_write_watch`. - `python -I scripts/check_no_game_data.py`: clean, on the whole tree and on the changed file. - An independent read-only reviewer agent traced the runtime side and approved: - The behaviour change is intended, not a regression: the title's VirtualAlloc, VirtualFree and VirtualProtect shims and the xmem paths all journal through `title_memory_map::changed`. - 0 holds for the read-write and write-combined variants. - The `no_write_watch` entry doesn't run this check. - Under `LEONIDA_SHADOW_FULL_WALK=1`, which no ctest entry sets, this check would fail. It did before this change too, and only `check_commit_changes` handles that mode. GPUs tested: NVIDIA GeForce RTX 3060 Ti, driver 610.88, Windows 11 Pro (build 26200) AI-assisted: yes. Claude Code with Claude Opus 5.5 wrote the change. A separate read-only reviewer agent on Claude Opus 5.5 reviewed it. ### Follow-ups (not in this pull request) - `runtime/shims/d3d12_vulkan_device.cpp:755-761` still says zero pages are passed over only "between the refreshes that copy aliased pages". Since `be1084b7a`, they are passed over on every refresh that isn't a full walk. - No test commits a page in the reserved half of a write-watched range and checks that it arrives through the journal. `check_commit_changes` covers this for an unwatched range only. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
be1084b7a made ShadowPages::unchanged() pass over uncommitted (kZero) pages, since a
commit over them reaches the shadow through title_memory_map::changed (kRequery). It moved
check_commit_changes' expectation from 1 query to 0, and fc48934c5 did the same for
check_shadow_adopts_geometry_guard, but check_write_watched still expected one query for
its reserved half. So d3d12_existing_heap and d3d12_existing_heap_write_watch failed at
that line on every native Windows run with a Vulkan device (RTX 3060 Ti: 0 queries,
asks=1, written=0). The change is test-only: the expectation and the step-1 comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First-time contributor

finding (no device here, so this is a history and code read, not a test run): the PR's reasoning checks out on every point I can verify without a GPU.

  • be1084b7a did change the sibling expectation: git show be1084b7a -- runtime/test/d3d12_existing_heap_test.cpp shows EXPECT(... == (full_walk ? 2 : 1)) replaced by (full_walk ? 2 : 0).
  • fc48934c5 changed three more EXPECT(... == 1) to == 0 in the same file.
  • The runtime side matches the PR's account: ShadowPages::unchanged() (d3d12_vulkan_device.cpp:1195 on f4b0404e) returns true for base == kZero, so an uncommitted page is passed over on a refresh that is not a full walk. A commit reaches the shadow through title_memory_map::changed, which sets kRequery.
  • check_write_watched still carried == 1, and it only runs when write watch is on: d3d12_existing_heap_test.cpp:3930-3932 gates the call on leonida::title_write_watch::enabled(), so the d3d12_existing_heap_no_write_watch entry never reaches it. That also matches the "five ctest entries" note.
  • git diff --check f4b0404e refs/pr/3512 -> clean; the diff is the one expectation, its comment and the step-1 description (3 insertions, 2 deletions, one file). No runtime code is touched, and python -I scripts/check_no_game_data.py on the PR's version of d3d12_existing_heap_test.cpp -> clean.

What this does not establish: the change is correct because the test now agrees with the code, and I cannot run d3d12_existing_heap_test here (it needs a D3D12 device over a Vulkan device), so I did not see the failure on main or the pass on the PR. The LEONIDA_SHADOW_FULL_WALK=1 caveat also stands as written: under a full walk the check would still expect 0 while the walk queries both halves, and no ctest entry sets that variable.

GPUs tested: none. Driver: n/a. No game data, assets or extracted shaders were used or attached.

AI-assisted: yes, Hy4 flash. Finding only, no approval implied.

finding (no device here, so this is a history and code read, not a test run): the PR's reasoning checks out on every point I can verify without a GPU. - `be1084b7a` did change the sibling expectation: `git show be1084b7a -- runtime/test/d3d12_existing_heap_test.cpp` shows `EXPECT(... == (full_walk ? 2 : 1))` replaced by `(full_walk ? 2 : 0)`. - `fc48934c5` changed three more `EXPECT(... == 1)` to `== 0` in the same file. - The runtime side matches the PR's account: `ShadowPages::unchanged()` (`d3d12_vulkan_device.cpp:1195` on `f4b0404e`) returns true for `base == kZero`, so an uncommitted page is passed over on a refresh that is not a full walk. A commit reaches the shadow through `title_memory_map::changed`, which sets `kRequery`. - `check_write_watched` still carried `== 1`, and it only runs when write watch is on: `d3d12_existing_heap_test.cpp:3930-3932` gates the call on `leonida::title_write_watch::enabled()`, so the `d3d12_existing_heap_no_write_watch` entry never reaches it. That also matches the "five ctest entries" note. - `git diff --check f4b0404e refs/pr/3512` -> clean; the diff is the one expectation, its comment and the step-1 description (3 insertions, 2 deletions, one file). No runtime code is touched, and `python -I scripts/check_no_game_data.py` on the PR's version of `d3d12_existing_heap_test.cpp` -> clean. What this does not establish: the change is correct because the test now agrees with the code, and I cannot run `d3d12_existing_heap_test` here (it needs a D3D12 device over a Vulkan device), so I did not see the failure on `main` or the pass on the PR. The `LEONIDA_SHADOW_FULL_WALK=1` caveat also stands as written: under a full walk the check would still expect 0 while the walk queries both halves, and no ctest entry sets that variable. GPUs tested: none. Driver: n/a. No game data, assets or extracted shaders were used or attached. AI-assisted: yes, Hy4 flash. Finding only, no approval implied.
Sign in to join this conversation.
No description provided.