Repository navigation
Conversation
5556818 to
f32c1ab
Compare
|
Thanks for taking this from the stall finding. I had prepared a change for the same code, so here is what I measured (RTX 5080, NVIDIA 621.24, Windows 11, The release of
What worked here, as a local experiment: first attempt at 30 s, priority 1 (ahead of the warm-up, behind builds that something waits for), yielding only when a priority 0 job is queued, again 30 s after a save and 5 s after a deferral. The save itself is short: 22 MiB took 7.3 ms to fill and 2.3 ms to publish, 77 MiB took 27.7 ms and 8.2 ms, so waiting for an idle moment gains little. With it, builds found in the cache went from 35 of 892 (no cache yet) to 617, 714 and 781 of about 1,000 over the next three runs, all of which crashed. Upstream's schedule saved nothing in any of my runs. Would you like to take points 1 to 3 into this pull request? If you'd rather keep it to the race, I can send them as a follow-up with AI-assisted (Claude Code). |
… only to priority-0 waiters Incorporate @DadaCap's RTX 5080 retail boot findings (ProjectLeonida#1608#issuecomment-7161936928) into ProjectLeonida#1756 so startup checkpoints actually persist compiled pipelines before a world-start crash: - Lower default checkpoint initial delay and post-save interval from 120 s to 30 s, with a 5 s retry backoff when deferred (CheckpointSchedule). - Submit checkpoints at priority 1 (behind priority-0 awaited first-use draws/ dispatches, ahead of speculative warm-up builds keyed by SPIR-V byte size). - Narrow PipelineCompiler::has_compile_waiter() to priority-0 awaited jobs only and drop the cross-thread active_compiles gate on checkpoints (vkGetPipelineCacheData is thread-safe against concurrent vkCreate*Pipelines and takes ~7-28 ms). - Update docs/d3d12_vulkan.md and runtime/test/pipeline_cache_store_test.cpp.
|
Thank you @DadaCap for those RTX 5080 retail measurements (#1608#issuecomment-7161936928) — folded all three points into this PR at
If you have a chance to test |
f32c1ab to
9050645
Compare
|
Retail result for |
|
Tested
AI-assisted: yes |
|
@3L1A5-1 a data point against a general NVIDIA miss: on an RTX 5080 with NVIDIA 621.24 the library compute programs do hit a session file from the previous run. With |
|
Small follow-up for this PR, if useful: a queue-order test for the priority change. Patch below, based on 9050645.
I only ran this one test, not the full suite. Feel free to take the patch or drop it. Patch (git format-patch, applies on this branch)AI-assisted: yes (Claude Code wrote and ran the test) |
Item ID:
RT-STARTUP-CACHE-CHECKPOINT-RACEClaim: #1608 (comment)
Addresses finding: #1608 (comment) (
LEONIDA_STARTUP_CACHE_CHECKPOINTS=1wrote nothing during a 200 s run reaching world start)Root cause
Two bugs in
runtime/shims/d3d12_vulkan_device.cppprevented startup cache checkpoints from saving during active world-start compilation bursts:maybe_checkpoint(cache)ran whileCompileActivitystill helddevice_.active_compiles >= 1: bothPipelineState::build_compute()(lines 8038, 8091) andPipelineState::build()(lines 8202, 8386) keptCompileActivity activity(device_.active_compiles)alive acrossmaybe_checkpoint(cache). When the build ran on a submitting orPipelineWorkersthread, thePipelineCompilerworker woke up before the caller returned, sawactive_compiles != 0, and skippedsave_session_pipeline_cache().active_compiles != 0orhas_compile_waiter()(either beforesave_session_pipeline_cache()at line 8110 or after the size query at line 1348),maybe_checkpoint()unconditionally pushednext_checkpointout by another 120,000 ms (2 minutes). A single deferral att = 120 spushed the next attempt tot = 240 s— past the world-start crash at~195–200 s, leaving the cache directory empty.Changes
runtime/src/pipeline_cache_store.h:CheckpointOutcome(saved,deferred,skipped) and portable atomicCheckpointSchedule(try_claim,complete,abort_claim). Deferred checkpoints and queue-submission aborts stay immediately eligible on the next compile completion instead of burningdefault_checkpoint_interval_ms(120 s);savedandskipped(empty/over-cap/I/O error) advance the deadline by the full interval with saturation below thein_flightsentinel.runtime/shims/d3d12_pipeline_checkpoint.h:CompileActivity::finish()(withacq_relordering) so callers can release their active-compile count before queueing a checkpoint while keeping RAII cleanup on early returns.runtime/shims/d3d12_vulkan_device.cpp:next_checkpointatomic withCheckpointSchedule checkpoint_schedule.build_compute(), publishpipeline_.pipeline, unlockvariants_mutex_, and callactivity.finish()beforemaybe_checkpoint(cache); inbuild(), callactivity.finish()beforemaybe_checkpoint(cache).save_session_pipeline_cache()to returnCheckpointOutcome(returningdeferredifactive_compilesorhas_compile_waiter()became active during the size query) and wiredmaybe_checkpoint()tocheckpoint_schedule.complete(..., outcome).runtime/test/pipeline_cache_store_test.cpp:test_checkpoint_schedule()covering due-time gating, in-flight coalescing, deferred immediate retry,abort_claim, saved/skipped 120 s cooldown, and near-UINT64_MAXsaturation.Verification
clang++ -std=c++20 -Wall -Wextra -Werror -O1 -g -fsanitize=address,undefined runtime/test/pipeline_cache_store_test.cpp: PASS.clang++ -std=c++20 -Wall -Wextra -Werror -O2 runtime/test/pipeline_cache_store_test.cpp: PASS.python3 -I scripts/check_no_game_data.py runtime/src/pipeline_cache_store.h runtime/shims/d3d12_pipeline_checkpoint.h runtime/shims/d3d12_vulkan_device.cpp runtime/test/pipeline_cache_store_test.cpp: PASS.python3 -I tests/test_text_write_line_endings.py: 3/3 OK.runtime/shims/d3d12_pipeline_checkpoint.handruntime/shims/d3d12_vulkan_device.cppare Windows/Vulkan shims and rely on Windows CI / a retail boot run withLEONIDA_STARTUP_CACHE_CHECKPOINTS=1.