d3d12_compile_pool_test: the graphics-only worker wakes the general one for a PSO's held-back job (TEST-COMPILE-POOL-GRAPHICS-WAKE) #2505

Merged
qhukz13 merged 1 commit from upstream-pr/2505 into main 2026-11-29 01:05:41 +00:00
qhukz13 commented 2026-11-27 21:21:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-27T21:21:24Z.


Claimed in the coordination issue as TEST-COMPILE-POOL-GRAPHICS-WAKE: https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7228366321

Follow-up to #2233, a test for the case named in its review: with LEONIDA_COMPILE_THREADS=1, a PSO's job that is not graphics waits while a graphics build of that PSO runs on the graphics-only worker, and must go when that build returns.

What

test_the_graphics_worker_wakes_the_general_one_for_its_psos_job in runtime/test/d3d12_compile_pool_test.cpp:

  1. a non-graphics job of another PSO occupies the general worker;
  2. a graphics job of PSO A runs on the graphics-only worker;
  3. a non-graphics job of PSO A is queued; it may not start while A's build runs;
  4. the general worker is freed, finds nothing it may take, and goes back to sleep;
  5. A's graphics build returns; the queued job must start within 3 s. The graphics-only worker that finished cannot take it, so only its wake gets it to the general worker.

Test only; no runtime change.

Tested

GPUs tested: NVIDIA GeForce GTX 1050 Ti 4 GB desktop (profile S), driver 582.66, Windows 10 19045. Every number below is MEASURED on that machine (n=1 per run unless given); no game files were used.

GTX 1050 Ti 4 GB, NVIDIA 582.66, Windows 10 19045, MSVC RelWithDebInfo:

  • ctest -R compile_pool: passes; the test executable 20 runs in a row: 0 failures.
  • Mutants in runtime/shims/d3d12_pipeline_compile.h, PipelineCompiler::run:
    • the wake after a job removed (wake_.notify_all()): fails at the new test and at test_a_finished_job_wakes_the_idle_workers;
    • only the graphics-only worker skips that wake (if (!graphics_only) wake_.notify_all();): fails at the new test only; every other test in the file passes.
  • check_no_game_data.py on the file, git diff --check: clean.

AI-assisted: yes (Claude Code, Claude Opus 5.5).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5533245493 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2505). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-27T21:21:24Z. --- Claimed in the coordination issue as TEST-COMPILE-POOL-GRAPHICS-WAKE: https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7228366321 Follow-up to #2233, a test for the case named in its review: with `LEONIDA_COMPILE_THREADS=1`, a PSO's job that is not graphics waits while a graphics build of that PSO runs on the graphics-only worker, and must go when that build returns. ### What `test_the_graphics_worker_wakes_the_general_one_for_its_psos_job` in `runtime/test/d3d12_compile_pool_test.cpp`: 1. a non-graphics job of another PSO occupies the general worker; 2. a graphics job of PSO A runs on the graphics-only worker; 3. a non-graphics job of PSO A is queued; it may not start while A's build runs; 4. the general worker is freed, finds nothing it may take, and goes back to sleep; 5. A's graphics build returns; the queued job must start within 3 s. The graphics-only worker that finished cannot take it, so only its wake gets it to the general worker. Test only; no runtime change. ### Tested GPUs tested: NVIDIA GeForce GTX 1050 Ti 4 GB desktop (profile S), driver 582.66, Windows 10 19045. Every number below is MEASURED on that machine (n=1 per run unless given); no game files were used. GTX 1050 Ti 4 GB, NVIDIA 582.66, Windows 10 19045, MSVC RelWithDebInfo: - `ctest -R compile_pool`: passes; the test executable 20 runs in a row: 0 failures. - Mutants in `runtime/shims/d3d12_pipeline_compile.h`, `PipelineCompiler::run`: - the wake after a job removed (`wake_.notify_all()`): fails at the new test and at `test_a_finished_job_wakes_the_idle_workers`; - only the graphics-only worker skips that wake (`if (!graphics_only) wake_.notify_all();`): fails at the new test only; every other test in the file passes. - `check_no_game_data.py` on the file, `git diff --check`: clean. AI-assisted: yes (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Tyrannys commented 2026-11-27 21:39:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T21:39:41Z.

Review: APPROVED


Independent verification of head a3452751d on profile M: RTX 4070 SUPER 12 GB, NVIDIA 621.01, Windows 11, Ryzen 7 9800X3D. Built on main 39f52f39c with this PR and #2507 merged; the two PRs touch different files. MSVC RelWithDebInfo.

  • build\RelWithDebInfo\d3d12_compile_pool_test.exe, 5 runs in a row: 5/5 PASS d3d12_compile_pool.
  • Under load: 16 copies at once, 3 rounds (48 runs). One run failed, at d3d12_compile_pool_test.cpp:407 !pool.has_compile_waiter(). That is in test_a_checkpoint_sees_a_demand_that_started_during_it, an existing test this PR does not change. The same check (:379) also failed once on main's copy of the test under the same load (1 of 64 runs). So it is an older flake, not this PR. The new test never failed.
  • Mutant, as claimed: PipelineCompiler::run with if (!graphics_only) wake_.notify_all(); fails only the new test, at :259 log.wait_finished(3, 3s), in 3 of 3 runs. Every other test in the file passes. With the source restored, all tests pass again.

Clean. Approving. No game files used.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6093554345 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2505#pullrequestreview-6093554345). Originally posted by [Tyrannys](https://github.com/Tyrannys) on 2026-11-27T21:39:41Z. **Review:** APPROVED --- Independent verification of head `a3452751d` on profile M: RTX 4070 SUPER 12 GB, NVIDIA 621.01, Windows 11, Ryzen 7 9800X3D. Built on `main` `39f52f39c` with this PR and #2507 merged; the two PRs touch different files. MSVC RelWithDebInfo. - `build\RelWithDebInfo\d3d12_compile_pool_test.exe`, 5 runs in a row: 5/5 `PASS d3d12_compile_pool`. - Under load: 16 copies at once, 3 rounds (48 runs). One run failed, at `d3d12_compile_pool_test.cpp:407` `!pool.has_compile_waiter()`. That is in `test_a_checkpoint_sees_a_demand_that_started_during_it`, an existing test this PR does not change. The same check (`:379`) also failed once on `main`'s copy of the test under the same load (1 of 64 runs). So it is an older flake, not this PR. The new test never failed. - Mutant, as claimed: `PipelineCompiler::run` with `if (!graphics_only) wake_.notify_all();` fails only the new test, at `:259` `log.wait_finished(3, 3s)`, in 3 of 3 runs. Every other test in the file passes. With the source restored, all tests pass again. Clean. Approving. No game files used. AI-assisted (Claude Code).
timbot103 commented 2026-11-28 02:02:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:02:47Z.


Reviewed at head a3452751d on Windows 11 (MSVC 2022 19.44).

Verification

  • Built d3d12_compile_pool_test.
  • d3d12_compile_pool_test (5 consecutive runs): 5/5 passed.

Notes (non-blocking)

  • Pinning the busy job on the general worker, running the same owner's graphics job on the graphics-only worker, queuing a non-graphics job for that owner, and verifying completion once the graphics gate releases (d3d12_compile_pool_test.cpp:117-123, 236-261, 545-556) directly exercises the wake_.notify_all() liveness path in d3d12_pipeline_compile.h:651. (Disjoint from #2510's checkpoint fix.)
  • Minor timing note (d3d12_compile_pool_test.cpp:74-93, 253-260): Log::finish runs inside the busy callback before the general worker re-enters the pool loop, so if the general worker is delayed >100 ms before parking in wake_.wait, a mutant without notify_all() could still pass when the predicate sees the unlocked job immediately; also the 3 s wait timeout has tighter margin under heavy load than the file's usual 10 s. Non-blocking.

Approve.

AI-assisted review + local MSVC verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232091736 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2505#issuecomment-7232091736). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T02:02:47Z. --- Reviewed at head `a3452751d` on Windows 11 (MSVC 2022 `19.44`). ### Verification - Built `d3d12_compile_pool_test`. - `d3d12_compile_pool_test` (5 consecutive runs): **5/5 passed**. ### Notes (non-blocking) - Pinning the busy job on the general worker, running the same owner's graphics job on the graphics-only worker, queuing a non-graphics job for that owner, and verifying completion once the graphics gate releases (`d3d12_compile_pool_test.cpp:117-123`, `236-261`, `545-556`) directly exercises the `wake_.notify_all()` liveness path in `d3d12_pipeline_compile.h:651`. (Disjoint from `#2510`'s checkpoint fix.) - **Minor timing note (`d3d12_compile_pool_test.cpp:74-93`, `253-260`):** `Log::finish` runs inside the busy callback before the general worker re-enters the pool loop, so if the general worker is delayed >100 ms before parking in `wake_.wait`, a mutant without `notify_all()` could still pass when the predicate sees the unlocked job immediately; also the 3 s wait timeout has tighter margin under heavy load than the file's usual 10 s. Non-blocking. Approve. AI-assisted review + local MSVC verification.
zmasi commented 2026-11-28 10:22:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:22:42Z.


#2505 | head a3452751de (merged cleanly with main 33db04a701) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^(d3d12_compile_pool|d3d12_pipeline_workers)$" --output-on-failure (LEONIDA_VK_VALIDATION=1) | red check: mutating d3d12_pipeline_compile.h so the graphics-only worker omits wake_.notify_all() fails d3d12_compile_pool_test (d3d12_compile_pool_test.cpp:259: log.wait_finished(3, 3s)), confirming the regression test is non-tautological | green on PR+main: 2/2 CTests pass (d3d12_compile_pool in 1.86s + 10/10 consecutive stress runs, and d3d12_pipeline_workers on RTX 3090 in 4.56s with LEONIDA_VK_VALIDATION=1 and 0 Khronos validation errors); check_no_game_data.py 0 violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237857004 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2505#issuecomment-7237857004). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T10:22:42Z. --- #2505 | head a3452751decf075af73d7f43bf8e3437c3d64ad6 (merged cleanly with main 33db04a7010e81c40a7a6a15624525aa0c4a3a58) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^(d3d12_compile_pool|d3d12_pipeline_workers)$" --output-on-failure` (`LEONIDA_VK_VALIDATION=1`) | red check: mutating `d3d12_pipeline_compile.h` so the graphics-only worker omits `wake_.notify_all()` fails `d3d12_compile_pool_test` (`d3d12_compile_pool_test.cpp:259: log.wait_finished(3, 3s)`), confirming the regression test is non-tautological | green on PR+main: `2/2` CTests pass (`d3d12_compile_pool` in `1.86s` + `10/10` consecutive stress runs, and `d3d12_pipeline_workers` on RTX 3090 in `4.56s` with `LEONIDA_VK_VALIDATION=1` and `0` Khronos validation errors); `check_no_game_data.py` `0` violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yes
OreoFR commented 2026-11-28 22:03:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:03:26Z.


Verified by OreoFR

  • Base: main c1ecf04ed + PR head a3452751d; green run in a merge package of 2 PRs, no new ctest failure vs main
  • Test: ctest -R "^d3d12_compile_pool$"
  • Red on main: OK
  • Green with the PR: OK
  • Verdict: NO RED (test-only PR: covers behaviour already on main)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246465019 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2505#issuecomment-7246465019). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T22:03:26Z. --- **Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `a3452751d`; green run in a merge package of 2 PRs, no new ctest failure vs main - Test: `ctest -R "^d3d12_compile_pool$"` - Red on main: OK - Green with the PR: OK - Verdict: NO RED (test-only PR: covers behaviour already on main) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
enlight3d commented 2026-11-29 00:46:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:46:28Z.


Run of #2505 (d3d12_compile_pool): green at the PR head, and a behavioural red with a mutant of the runtime (the PR is test-only, so there is no non-test change to revert).

  • PR head: a3452751de (base 39f52f39c). Current main: 1bc055e6c2. git merge-tree --write-tree main <head> merges cleanly. runtime/shims/d3d12_pipeline_compile.h is identical on main and at the PR head, so the new test runs against main's runtime logic unchanged.
  • GPU/driver: NVIDIA GeForce RTX 3090 24 GB, driver 621.40 (not used by this CPU-only test). OS: Windows 11 Pro 10.0.26300. MSVC 19.44, Ninja, RelWithDebInfo.
  • Only the test target was built, not the whole runtime.

Commands (in a vcvars64 shell, build folder inside the worktree):

cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON -DSDL3_DIR=<installed SDL3 3.4.20 static>/cmake
cmake --build runtime/build --target d3d12_compile_pool_test -j 8
ctest -R "^d3d12_compile_pool$" --output-on-failure

Green (PR head): d3d12_compile_pool Passed (1.8 s). The test executable run 20 times in a row: 0 failures.

Red (behavioural, mutants of PipelineCompiler::run in runtime/shims/d3d12_pipeline_compile.h, each reverted afterwards; same ctest):

  • the wake after a job is removed only skipped for the graphics-only worker (if (!graphics_only) wake_.notify_all();): Failed at d3d12_compile_pool_test.cpp:259: log.wait_finished(3, 3s), which is the new test's last wait.
  • no wake at all: Failed at line 259 and at line 454 (log.wait_started(3, 3s), another test).
    This matches what the description says: the first mutant is caught by the new test only. Not a "header missing" red: the file builds in all cases.
    Link check: merged into main 1bc055e6c, gta6rt.exe builds and links (RelWithDebInfo, MSVC 19.44); no new imports vs main.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248341143 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2505#issuecomment-7248341143). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T00:46:28Z. --- Run of #2505 (`d3d12_compile_pool`): green at the PR head, and a behavioural red with a mutant of the runtime (the PR is test-only, so there is no non-test change to revert). - PR head: a3452751decf075af73d7f43bf8e3437c3d64ad6 (base 39f52f39c). Current main: 1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3. `git merge-tree --write-tree main <head>` merges cleanly. `runtime/shims/d3d12_pipeline_compile.h` is identical on main and at the PR head, so the new test runs against main's runtime logic unchanged. - GPU/driver: NVIDIA GeForce RTX 3090 24 GB, driver 621.40 (not used by this CPU-only test). OS: Windows 11 Pro 10.0.26300. MSVC 19.44, Ninja, RelWithDebInfo. - Only the test target was built, not the whole runtime. Commands (in a vcvars64 shell, build folder inside the worktree): ``` cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON -DSDL3_DIR=<installed SDL3 3.4.20 static>/cmake cmake --build runtime/build --target d3d12_compile_pool_test -j 8 ctest -R "^d3d12_compile_pool$" --output-on-failure ``` Green (PR head): `d3d12_compile_pool` Passed (1.8 s). The test executable run 20 times in a row: 0 failures. Red (behavioural, mutants of `PipelineCompiler::run` in `runtime/shims/d3d12_pipeline_compile.h`, each reverted afterwards; same ctest): - the wake after a job is removed only skipped for the graphics-only worker (`if (!graphics_only) wake_.notify_all();`): Failed at `d3d12_compile_pool_test.cpp:259: log.wait_finished(3, 3s)`, which is the new test's last wait. - no wake at all: Failed at line 259 and at line 454 (`log.wait_started(3, 3s)`, another test). This matches what the description says: the first mutant is caught by the new test only. Not a "header missing" red: the file builds in all cases. Link check: merged into main 1bc055e6c, gta6rt.exe builds and links (RelWithDebInfo, MSVC 19.44); no new imports vs main.
MoonEyes commented 2026-11-29 01:05:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:05:44Z.


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.exe still links) and a re-check here: no conflict with main dcbcd4216, same head as run, no-game-data green, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on main or Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ).

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248555668 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2505#issuecomment-7248555668). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T01:05:44Z. --- Merged after **enlight3d** (Thib)'s red/green run ([RUN](https://github.com/ProjectLeonida/mandy/pull/2505#issuecomment-7248341143), RTX 3090, driver 621.40, Windows 11: green with this PR, red without it, and `gta6rt.exe` still links) and a re-check here: no conflict with `main` dcbcd4216, same head as run, `no-game-data` green, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on `main` or Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ). _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2505
No description provided.