Skip to content

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

Open
qhukz13 wants to merge 1 commit into
ProjectLeonida:mainfrom
qhukz13:cont/compile-pool-graphics-wake
Open

qhukz13 wants to merge 1 commit into
ProjectLeonida:mainfrom
qhukz13:cont/compile-pool-graphics-wake

Conversation

@qhukz13

@qhukz13 qhukz13 commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as TEST-COMPILE-POOL-GRAPHICS-WAKE: #1608 (comment)

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

…ne for a PSO's held-back job

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. The general worker has gone back to sleep by then, so only the graphics-only worker's
wake on return lets it go. Follow-up to ProjectLeonida#2233 (a test for the case its review named).

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

@Tyrannys Tyrannys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

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

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

#2505 | head a345275 (merged cleanly with main 33db04a) | 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants