Frame clock: drain pending signals and origins when events end #2020
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2020
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2020"
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?
@eizispark on GitHub · 2026-11-25 00:55 UTC · original
eizispark:fix/frame-clock-drain-stale-events→main· +119 −17 · 1 files · 1 commits · openStopping the console frame clock (
SetFrameIntervalXwith length0), changing its frame interval, or unscheduling a secondary event (ScheduleFrameEventX(..., UNSCHEDULE)) previously cleared onlyKind::scheduled. Up toORIGIN_SEMAPHORE_MAX(4) unconsumed counts remained in the origin semaphore together with their timestamps inORIGINS, secondary auto-reset events (types 1 and 2) stayed signalled, and duplicated ancillary handles remained stored inClock::kinds. After restarting or rescheduling, up to fourWaitFrameEventX(0)calls returned in0 msand stamped newly issued frame tokens with pre-stop QPC origins, while rescheduled secondary events woke immediately before their new offset. In addition,clock_threadcheckedClock::generationbefore signalling internal handles outside the lock, letting an in-flight tick from an ended schedule post a stale signal right after unscheduling.What is in it
crates/xcl/src/hle/d3d12x/frame.rs: addunschedule_kindto clear duplicated ancillary handles, drain the origin semaphore andORIGINSqueue, andResetEventsecondary internal events whenever an event is unscheduled inset_frame_interval_xorschedule_frame_event_x; publish internal signals insideclock_threadunder the sameClock::generationcheck while keeping ancillary handle signalling outside the lock.crates/xcl/src/hle/d3d12x/frame.rs(tests): addstopping_interval_change_and_unschedule_drop_stale_signals_and_originsverifying ancillary handle release, secondary event reset onUNSCHEDULE, fresh post-restart pacing and origin QPCs after stopping the clock, and fresh origin QPCs across an active interval change (which also eliminates the latent0 msorder-dependent failure inorigin_events_issue_tokens_and_flips_have_statistics).Tested
32.0.32015.16001),rustc 1.100.0 (0ef1bc386 2026-11-09), debug and release.cargo test --workspace --no-fail-fast -- --test-threads=4on the head, rebased ontomain426a5a7: 1241 passed, 3 failed –gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,fuzz_validate_and_gpu_3andgpu::recomp::tests::gpu_image_get_resinfo_past_last_level, which fail the same way on a cleanmain426a5a7on this adapter; 46 ignored.cargo test -p xcl --lib hle::d3d12x::frame -- --test-threads=4: 6 passed, 0 failed, including #1053'sinterval_override_parsing_and_clamping.stopping_interval_change_and_unschedule_drop_stale_signals_and_originsfailed before the fix: 4 unconsumed origin counts carried acrossSetFrameIntervalX(..., 0, ...).Regression run
main:PR head:
Not tested
8 333 µs/25 000 µs), NVIDIA and Intel GPUs, Windows 10, wave32-only adapters, andXCL_SAMPLE_*sample-data tests.AI use
frame.rs, wrote the fix and unit test, and ran the test suite and smoke check. Antigravity (Claude Opus 5.5) – rebased it ontomain426a5a7over #1053 (the clock thread keepssleep_until(timer, deadline, allow_spin)and checks the generation under the lock, where the signals are published), and reran the suite and the smoke pair.@raylitebull on GitHub · 2026-11-25 01:12 UTC · original
Code review on
21a7291:crates/xcl/src/hle/d3d12x/frame.rscleanly drains pending signals andpending_originswhen events end (ending_events_clears_pending_signals_and_origins), verified on AMD RX 9070 XT.Remaining before merge:
main(currentlyCONFLICTING) soBuild and test (Windows, no GPU)can run againstmain.@raylitebull on GitHub · 2026-11-25 01:25 UTC · original
Nice —
@fromthemoonx's RTX 3060 pass (892 passed, 0 failed, 42 ignored) gives21a7291both AMD (RX 9070 XT) and NVIDIA coverage. Once rebased ontomain(resolving the#1053frame.rsconflict) withBuild and testgreen and a quick confirm on the rebased head, this will be ready to merge.@JJAutoCompare on GitHub · 2026-11-25 01:34 UTC · original
PR #2020 empirical test report
Tested the clean live head
21a7291ea41893218026938cfbaf818a64d06585of xcl-dev/xcl#2020 (Frame clock: drain pending signals and origins when events end).git merge-tree --write-tree origin/main HEADfound a content conflict incrates/xcl/src/hle/d3d12x/frame.rsagainstorigin/mainat8f5fca5bb9ad6e695093d75294ad2cec023bba60.Tested
26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver32.0.101.9175, wave lanes 8–32,DoublePrecisionFloatShaderOps=0).1.100.0 (0ef1bc386), DXC1.9.2609.5 (01b62ad4), unoptimized dev/test profiles withCARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0,XCL_ADAPTER=A770.cargo test --workspace --no-runandcargo build --workspacesucceeded (producing the test-title executable and DLL required bye2e).cargo test -p xcl --lib hle::d3d12x::frame::tests:: -- --show-output(outside GPU lock): 5 passed, 0 failed, 0 ignored, 0 skipped (including the new regression test).cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output(underInvoke-ArcTest.ps1): exited101across 20 test harness summaries with 874 passed, 18 failed, 42 ignored in raw Cargo totals, including 7 explicitSKIPPEDGPU tests (not counted as coverage, leaving 867 non-skipped passes).-p xcl --lib(CreateComputePipelineState: 0x80070057/ Arc shader assertions) and 1 in-p xcl --test e2e(test_title_runs_and_game_folder_is_untouchedsynthetic-titleRSSetDepthBiasXpixel check).Explicit GPU skips (7)
gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask— no wave64gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware— no wave64shaders::tests::pso_measurement_compiles_an_exact_synthetic_record— cannot disable driver cache (Windows Developer Mode required,0x887A002D)placed_title_textures_share_vram_and_preserve_pixels— tiled tier < 2test_title_draws_with_a_root_signature_under_the_debug_layer— nod3d12SDKLayers.dllheap_window_out_of_memory_falls_back_to_the_switch_form— no heap windowsuploads_start_from_each_subresources_state— no D3D12 debug layer (0x887A002D)Not tested
origin/mainbaseline comparison in this run (so the 18 GPU/e2e failures are not attributed to this PR here).scripts/smoke.ps1regression runs and optionalXCL_SAMPLE_*datasets.AI use
gpt-6.2-sol) fetched and checked the PR head, built and ran the targeted and workspace tests, and summarized the logs. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified the counts againstsuite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 04:01 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@eizispark on GitHub · 2026-11-25 11:45 UTC · original
Rebased onto
main426a5a7asbb461bb, as @raylitebull and @fromthemoonx asked. The conflict with #1053 was one line inclock_thread. The resolved version keepssleep_until(timer, deadline, allow_spin)and leaves the generation check out of that line, because the PR does that check under theCLOCKlock where the origins and internal events are published. #1053's effective interval and the uncapped path are untouched.On the RX 9070 XT:
hle::d3d12x::frame6 passed (including #1053'sinterval_override_parsing_and_clamping). Full workspace: 1241 passed; the 3 failures are the same ones that fail on a cleanmain426a5a7here. New smoke pair in the description: 1680 frames on main, 1671 on the PR, no removals or crashes. Thanks @fromthemoonx for the NVIDIA run and the mutation check on21a7291.@fromthemoonx on GitHub · 2026-11-25 01:22 UTC · original · edited 2026-11-25 12:12 UTC
Rerun on the rebased head
bb461bb: passes on the RTX 3060, and the conflict withmainis gone.cargo test --workspace --no-fail-fast -- --test-threads=4: 1244 passed, 0 failed, 46 ignored (base426a5a7; merges intomain1a0bbe3without conflicts).hle::d3d12x::frame -- --test-threads=4: 6 passed, 20 of 20 runs (including #1053'sinterval_override_parsing_and_clamping). The same mutation (drain inunschedule_kinddisabled) still fails onlystopping_interval_change_and_unschedule_drop_stale_signals_and_origins. The report below is for21a7291.Passes at the head on an RTX 3060 / Ryzen 7 5700X, and the new test fails without the fix. As the review above says, it needs a rebase: the conflict is in
frame.rs, with4f4db64(#1053's frame interval override).21a7291(base4178e88):cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4: 892 passed, 0 failed, 42 ignored. No GPU tests skipped beyond the usual ones for no wave64 and no heap windows.5796cc4:CONFLICT (content): Merge conflict in crates/xcl/src/hle/d3d12x/frame.rs. The only commit onmainsince the base that touches the file is4f4db64. I did not resolve it, so there is no merged-tree run.cargo test -p xcl --lib hle::d3d12x::frame -- --test-threads=4, 20 runs: 20 of 20 passed (5 tests each), includingorigin_events_issue_tokens_and_flips_have_statistics. So the timing tests hold on this CPU too.unschedule_kinddisabled (if false && !k.internal.is_null()),stopping_interval_change_and_unschedule_drop_stale_signals_and_originsfails (frame.rs:697). The other 4 frame tests still pass, so the new test is what covers it.Hardware: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug.
Not tested: the tree merged with
main(conflict), 120 Hz intervals, Windows 10, a release build.AI use: Claude Code (Claude Opus 5.5) ran the tests and the mutation check and wrote this report.
@DavidM1911 on GitHub · 2026-11-26 00:49 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.