d3d12_compile_pool_test: submit the demand after the checkpoint's first look (TEST-COMPILE-POOL-LOAD-FLAKE) #2510
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2510"
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?
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T21:43:53Z.
Package TEST-COMPILE-POOL-LOAD-FLAKE. Claim: https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7228654053. This is a test-only change to
runtime/test/d3d12_compile_pool_test.cpp(the test from #2233).The flake
test_a_checkpoint_sees_a_demand_that_started_during_itchecks its first look,EXPECT(!pool.has_compile_waiter())(line 379 on main), inside the checkpoint job, right afterlog.start("checkpoint"). The test thread waits on that samelog.start(log.wait_started(1)) and then submits the demanded build. On a loaded machine the checkpoint's worker can be preempted betweenlog.startand the look. The demanded build is then already queued or running when the look happens, and the check fails. This was found while verifying #2505: with 16 copies running at once, the check failed in 1 of 64 runs of main's test, and the same check failed in 1 of 48 runs with #2505.The fix
The job stores its first look in an atomic and opens a gate. The test waits for that gate with
Gate::wait_for(10s)(new; no fixed sleep), checks the stored look, and only then submits the demanded build. The rest of the test is unchanged.Tested
Profile M: RTX 4070 SUPER, Windows 11, Ryzen 7 9800X3D, MSVC RelWithDebInfo. CPU only.
d3d12_compile_pool_test.exeat once, 13 rounds:sleep_for(200ms)afterlog.start("checkpoint")stands in for a preempted worker. It is not committed.git diff --checkandscripts/check_no_game_data.pyare clean. No game files used.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:02:45Z.
Reviewed at head
db477857fon Windows 11 (MSVC 202219.44).Verification
d3d12_compile_pool_test.d3d12_compile_pool_test(5 consecutive runs): 5/5 passed.Notes
lookedgate after storing the firsthas_compile_waiter()result and waiting on it before submitting demand (d3d12_compile_pool_test.cpp:26-58,372-399) cleanly eliminates the test scheduling race where demand could arrive before the checkpoint took its first look, while preserving the intended two-look production test semantics. (Also confirmed disjoint from#2505's hunks in the same file.)Approve.
AI-assisted review + local MSVC verification.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T09:52:20Z.
#2510 | head
db477857ff(merged cleanly with main3ca0707dde) |ctest --test-dir runtime/build -C RelWithDebInfo -R "^d3d12_compile_pool$" --output-on-failure(LEONIDA_VK_VALIDATION=1) | red on main: under worker preemption betweenlog.start("checkpoint", false)and!pool.has_compile_waiter()(reproduced deterministically with a20 msdelay), the demanded build arrives before the checkpoint's first look and failsd3d12_compile_pool_test.cpp(!pool.has_compile_waiter()) | green on PR+main:1/1CTest passes (1.74s) plus20/20consecutive stress runs on RTX 3090 withLEONIDA_VK_VALIDATION=1(0Khronos validation errors);check_no_game_data.py0violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yesImported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:03:31Z.
Verified by OreoFR
c1ecf04ed+ PR headdb477857f; green run in a merge package of 11 PRs, no new ctest failure vs mainctest -R "^d3d12_compile_pool$"AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:46:35Z.
Run of #2510 (
d3d12_compile_pool): green at the PR head; the flake is only reproduced by a forced race (a temporary sleep), not by the plain test.db477857ff(base39f52f39c). Current main:1bc055e6c2.git merge-tree --write-tree main <head>merges cleanly. The test file andruntime/shims/d3d12_pipeline_compile.hare identical on main and at the PR base, so "main's test" below is the base version.Commands (in a vcvars64 shell, build folder inside the worktree):
Green (PR head):
d3d12_compile_poolPassed (1.7 s); the executable run 20 times in a row: 0 failures. Main's test (base version) without any change: Passed, 20 runs: 0 failures (the race is rare; I did not try to catch it under load).Red (forced race, as in the description): a temporary
std::this_thread::sleep_for(200ms);right afterlog.start("checkpoint", false);in the test, never committed:d3d12_compile_pool_test.cpp:380: !pool.has_compile_waiter()(the first-look check); 3 of 3 executable runs fail.The red is therefore a simulated one (the sleep stands in for a preempted worker), on the test and not on the runtime.
Link check: merged into main
1bc055e6c, gta6rt.exe builds and links (RelWithDebInfo, MSVC 19.44); no new imports vs main.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:05:59Z.
Merged after enlight3d (Thib)'s red/green run (RUN, RTX 3090, driver 621.40, Windows 11: green with this PR, red without it, and
gta6rt.exestill links) and a re-check here: no conflict withmain7e06a026d, same head as run,no-game-datagreen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known onmainor Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ).AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.