Repository navigation
Conversation
…ER-START)
Two CPU tests start a reader thread and race it at once, then require that
it read at least once:
- xmem_test's test_split_under_reader runs 2,046 single-page unmaps;
- xs_proxy_mock's kernel_writes tear check runs 200,000 8-byte stores.
On a loaded host (ctest -j, a busy CI runner) the racing loop can finish
before the reader is first scheduled. reads stays 0 and the check fails
with nothing wrong in the runtime ("the reader of the views' last pages
never faults or misreads"; "xs_proxy_mock line 4487: g_tear.torn == 0 &&
g_tear.reads > 0"). When the reader gets a single read in first, the test
passes having checked almost nothing. The remap race test in xmem_test
already waits for its writers for the same reason; wait for the reader's
first read the same way. xmem_test also prints its read count, as the
remap race test does.
Tested (Windows 11, MSVC 14.44, CPU tests without Vulkan headers):
- xmem_test, LEONIDA_WRITE_WATCH=0, 32 busy processes on 8 cores, 8 runs
each: before, 1 failure (0 reads) and 5 passes with 1 read; after, 8
passes with 467 to 7,137 reads, 0 misread.
- ctest -j 8 (162 tests): before, xs_proxy_mock failed in 3 of 3 runs;
after, 3 of 3 runs pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: RT-TESTS-READER-START (claim comment to follow)
What and why
Two CPU tests start a reader thread and race it at once, then require that it read at least once:
runtime/test/xmem_test.cpptest_split_under_reader: 2,046 single-page unmaps, each splitting the view the reader reads from;runtime/test/xs_proxy_mock_test.cpp, thekernel_writestear check: 200,000 8-byte stores against a reader that looks for a torn value.On a loaded host (
ctest -j, a busy CI runner) the racing loop can finish before the reader is first scheduled.readsstays 0 and the check fails with nothing wrong in the runtime:FAIL the reader of the views' last pages never faults or misreadsxs_proxy_mock line 4487: g_tear.torn == 0 && g_tear.reads > 0When the reader gets a single read in first, the test passes having checked almost nothing. The remap race test above
test_split_under_readeralready waits for its four writers for this reason ("The remaps can finish before a writer is scheduled on a fast host"). Both tests now wait for the reader's first read the same way;xmem_testalso prints its read count, as the remap race test prints its write count. Test-only change.Tested
Windows 11, MSVC 14.44 (Build Tools), Ninja, RelWithDebInfo; the CPU tests (configured without Vulkan headers, with #2083's CMake fix applied locally so the configure succeeds):
xmem_testwithLEONIDA_WRITE_WATCH=0under 32 busy processes on 8 cores, 8 runs each:main: 1 failure (0 reads), 5 passes with exactly 1 read, 2 with more;ctest -j 8(162 tests): onmainxs_proxy_mockfailed in 3 of 3 runs (the tear check); with this branch 3 of 3 runs pass 162/162. (A fourth run failed onlyxmem_test's system-wide commit check, which tests: xmem commit-on-touch checks read the test's own view, not system commit (TEST-XMEM-COMMIT-CHECK) #1316 addresses.)scripts/check_no_game_data.pyon both files.GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code