[PR #1316] tests: xmem commit-on-touch checks read the test's own view, not system commit (TEST-XMEM-COMMIT-CHECK) #1347

Open
opened 2026-11-26 20:20:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1316
Author: @GuilhermeG5
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: pr/xmem-commit-check


📝 Commits (1)

  • e668886 tests: xmem commit-on-touch checks read the test's own view, not system commit

📊 Changes

1 file changed (+22 additions, -6 deletions)

View changed files

📝 runtime/test/xmem_test.cpp (+22 -6)

📄 Description

Requested by Guilherme Correa · project thread

Claimed in the coordination issue as: TEST-XMEM-COMMIT-CHECK

What and why

xmem_test failed intermittently in full CTest runs (about once in a dozen on our machine). The two checks in
test_physical_pages_commit_on_touch that decide whether mapping or touching physical pages charges commit compared
GetPerformanceInfo().CommitTotal before and after. CommitTotal is system-wide: any other process that commits or
frees memory in between moves it. With ctest -R ^xmem$ --repeat until-fail:500 while a build ran, the check failed
on run 20, and with the values printed, on run 55 with -120 MiB where +32 MiB (512 x 64 KiB) was expected. It was
never the shim: when the machine was quiet the growth was 32.6-39.7 MiB.

The checks now count the committed (MEM_COMMIT) 64 KiB pages of the test's own view with VirtualQuery, which is
the state commit_mapped_page itself reads: 0 after mapping, exactly the 512 touched pages after writing. The
system-wide growth is still printed, as information only. "Allocating those pages does not charge them" keeps
CommitTotal: there is no view to query yet, and its bound (1/8 of the allocation) was not hit.

Overlaps: #417 changes the same check differently (it re-measures CommitTotal on two more page windows when the first
measurement misses). This PR stops depending on the system-wide counter instead. Whichever lands first, I will rebase
the other side's leftovers; I am also happy to fold this into #417 if its author prefers.

Tested

  • ctest -R ^xmem$ --repeat until-fail:500 under a concurrent full build: 500/500 (before: failures at runs 20 and
    55); the printed system-wide growth ranged from -236 MiB to +313 MiB meanwhile.
  • On this branch (main abc0bd884 + this commit): xmem passes; --repeat until-fail:100: 100/100.
  • Full CTest on main 6293c1c4f with this and other local changes: 315 registered, 302 passed, 11 skipped, 1 disabled,
    1 failed (d3d12_execute_indirect_validation, which fails the same way on unmodified main on this machine).

GPUs tested: NVIDIA GeForce RTX 2060 SUPER, driver 621.01, Windows 11 10.0.26300 (the test is CPU-only)

AI-assisted: yes

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)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1316 **Author:** [@GuilhermeG5](https://github.com/GuilhermeG5) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/xmem-commit-check` --- ### 📝 Commits (1) - [`e668886`](https://github.com/ubiquitarianism/leonida/commit/e6688869a4cfec0c83748aae72dfabdbc3ecde18) tests: xmem commit-on-touch checks read the test's own view, not system commit ### 📊 Changes **1 file changed** (+22 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `runtime/test/xmem_test.cpp` (+22 -6) </details> ### 📄 Description <!-- claude-projects-attribution: {"github_login":"GuilhermeG5"} --> _Requested by **Guilherme Correa** · [project thread](https://claude.ai/code/project/chan_013Mx1uQ9UtTn7cwcX32t6xG?thread=cmsg_013Mx1uQ9UtTn7cwcX32t6xGWaMHTZvbN9nhuPiAga22tf)_ Claimed in the coordination issue as: TEST-XMEM-COMMIT-CHECK ### What and why `xmem_test` failed intermittently in full CTest runs (about once in a dozen on our machine). The two checks in `test_physical_pages_commit_on_touch` that decide whether mapping or touching physical pages charges commit compared `GetPerformanceInfo().CommitTotal` before and after. CommitTotal is system-wide: any other process that commits or frees memory in between moves it. With `ctest -R ^xmem$ --repeat until-fail:500` while a build ran, the check failed on run 20, and with the values printed, on run 55 with -120 MiB where +32 MiB (512 x 64 KiB) was expected. It was never the shim: when the machine was quiet the growth was 32.6-39.7 MiB. The checks now count the committed (`MEM_COMMIT`) 64 KiB pages of the test's own view with `VirtualQuery`, which is the state `commit_mapped_page` itself reads: 0 after mapping, exactly the 512 touched pages after writing. The system-wide growth is still printed, as information only. "Allocating those pages does not charge them" keeps CommitTotal: there is no view to query yet, and its bound (1/8 of the allocation) was not hit. Overlaps: #417 changes the same check differently (it re-measures CommitTotal on two more page windows when the first measurement misses). This PR stops depending on the system-wide counter instead. Whichever lands first, I will rebase the other side's leftovers; I am also happy to fold this into #417 if its author prefers. ### Tested - `ctest -R ^xmem$ --repeat until-fail:500` under a concurrent full build: 500/500 (before: failures at runs 20 and 55); the printed system-wide growth ranged from -236 MiB to +313 MiB meanwhile. - On this branch (main abc0bd884 + this commit): `xmem` passes; `--repeat until-fail:100`: 100/100. - Full CTest on main 6293c1c4f with this and other local changes: 315 registered, 302 passed, 11 skipped, 1 disabled, 1 failed (`d3d12_execute_indirect_validation`, which fails the same way on unmodified main on this machine). GPUs tested: NVIDIA GeForce RTX 2060 SUPER, driver 621.01, Windows 11 10.0.26300 (the test is CPU-only) AI-assisted: yes ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#1347
No description provided.