Frame clock: drain pending signals and origins when events end #2010
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by eizispark on 2026-11-25T00:55:38Z.
Stopping 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.Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:12:51Z.
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.Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-25T01:22:21Z.
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.
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:25:49Z.
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.Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T01:34:03Z.
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.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T04:01:37Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.upstream-sync referenced this pull request2026-11-25 10:09:30 +00:00
Imported from ivall/xcl. Originally posted by eizispark on 2026-11-25T11:45:21Z.
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.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:49:45Z.
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
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T21:29:50Z.
Tested head
bb461bb5f4552ed36c4d5175125cee7aa5b72096(merge-base with main426a5a7) on Windows 11 Pro 26100, rustc 1.100.0 MSVC, debug, CPU only (no GPU opened).cargo test -p xcl --lib hle::d3d12x::frame:: -- --test-threads=1: head 6 passed, 0 failed, 0 ignored; merge-base 5 passed, 0 failed. New on head:stopping_interval_change_and_unschedule_drop_stale_signals_and_origins. Applied to the merge-base426a5a745db4d5e4b037449ede0b70cb342f5192code (test hunk only, no fix),hle::d3d12x::frame::tests::stopping_interval_change_and_unschedule_drop_stale_signals_and_originsfails at frame.rs:752 withstop drops ancillary handles, 0 passed, 1 failed.Not tested: full suite, GPU, retail title. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T05:01:27Z.
Independent desktop NVIDIA verification of PR #2020 at head
bb461bb5f4552ed36c4d5175125cee7aa5b72096(1commit; exact parent & merge-base:426a5a745db4d5e4b037449ede0b70cb342f5192, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
bb461bb5)cargo test --release -p xcl --lib stopping_interval_change_and_unschedule_drop_stale_signals_and_origins -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1200 filtered out× 3 (0.30s× 3,0skipped)cargo test --release -p xcl --lib hle::d3d12x::frame:: -- --test-threads=1(3 consecutive runs)6 passed; 0 failed; 0 ignored; 1195 filtered out× 3 (0.62s× 3,0skipped)cargo build --release -p xcl1m 04s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
426a5a745db4d5e4b037449ede0b70cb342f5192, cached baseline on the same machine):PR #2020 (
bb461bb5f4552ed36c4d5175125cee7aa5b72096):Runtime log observations (
xcl.log)9203log lines,0[ERROR]/ device-removal / panic lines (dxil_cache:460hits,0misses,0compilation failures;228background pipelines,0failures).19480 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14466 MB committed by the process; video memory 6115 MB local, 4683 MB non-local.Limits of coverage
ORIGINStimestamps, secondary auto-reset events, and ancillary handles acrossSetFrameIntervalXstop/interval changes andScheduleFrameEventXunscheduling was directly verified viastopping_interval_change_and_unschedule_drop_stale_signals_and_origins(3/3) andhle::d3d12x::frame::(6/6× 3).60 60 60frame-clock pacing and zero runtime regression ontitle: 29640639(single-run frame/commit delta vs. cached parent reflects normal startup variance, not this PR); it did not drive a dynamic mid-sessionSetFrameIntervalXcadence switch.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:12:27Z.
Triage (#1607) – head
bb461bbNo open or merged PR drains the origin semaphore / ORIGINS queue or resets the type 1/2 events on unschedule; #841 and #1621 touch the same clock code (the generation check in
clock_thread, theschedule_frame_event_xcommit) for different problems, and the branch conflicts with main's frame.rs changes (#3294,8aba55ba).No problems found in the diff; lock order is CLOCK then ORIGINS in both
unschedule_kindand the clock thread, and a wait that loses its queued origin to the drain falls back toqpc(). The new test depends on sleeps of 25-85 ms.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.