Frame clock: revalidate clock state before committing ScheduleFrameEventX #1611
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1621"
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 b3IKK on 2026-11-24T18:19:12Z.
schedule_frame_event_xreleased theCLOCKmutex while duplicating ancillary event handles, then committedc.active = trueandk.scheduled = truewithout re-checking whether another thread had stopped the clock viaSetFrameIntervalX(0)in the meantime. That left the clock marked active and scheduled withinterval_us == 0, whereclock_threaddoes not run andWaitFrameEventXhangs indefinitely.This extracts
schedule_invalid()andcommit_schedule(), re-checking validity under theCLOCKlock before mutating state and closing duplicated handles onE_INVALIDARG.What is in it
crates/xcl/src/hle/d3d12x/frame.rs: addschedule_invalid()andcommit_schedule()to revalidate underCLOCKbefore committing inschedule_frame_event_x; add unit testcommit_schedule_rejects_clock_stopped_between_check_and_commit.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 777 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware; 1no heap windows—heap_window_out_of_memory_falls_back_to_the_switch_form)cargo test -p xcl --lib hle::d3d12x::frame::tests: 5 passed, 0 failedRegression run
main:
PR:
Not tested
AI use
frame.rs, wrote the fix and unit test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:37:51Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.Thanks!
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:00:29Z.
XCL PR #1621 focused Windows verification
Tested head
39788e8cbe7d12828b1e54a40112340ac0d6adbain a clean detached checkout. The PR changescrates/xcl/src/hle/d3d12x/frame.rs.Tested
cargo build --workspacesucceeded.cargo test --workspace --no-runcompiled all workspace test executables.cargo test -p xcl --lib hle::d3d12x::frame::tests:: -- --nocaptureran withXCL_ADAPTER=NONE_CPU_ONLY. Parsed frompr1621-focused.log— 5 passed, 0 failed, 0 ignored, 0 SKIPPED, 744 filtered out. All three commands ran outside the Arc mutex.E_INVALIDARG, stays inactive, and leaves the origin unscheduled. With a 16,667 µs interval, scheduling type 0 returnsSTARTED_CLOCK, activates the clock, and schedules the origin.Not tested
Execution was limited to the focused CPU frame-clock tests. The rest of the workspace was compiled only. The full GPU workspace suite and retail-title smoke comparisons were omitted.
AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1621-focused.logand published.upstream-sync referenced this pull request2026-11-25 07:04:28 +00:00
Imported from ivall/xcl. Originally posted by afpruivo on 2026-11-26T12:18:22Z.
Tested
39788e8on an RTX 3090, as part of a batch merged ontomainb49be18: no failures, no regression.e15ddb2, #15946ea563b, #162139788e8, #165369f70c1. They touch no common file and merged cleanly ontob49be18(local commit1e3fb07). Check posted in #1607: B21, https://github.com/xcl-dev/xcl/issues/1607#issuecomment-7191828681.cargo test --workspace -- --test-threads=4(debug): 1,439 passed, 0 failed, 47 ignored. 26SKIPPEDGPU tests, mostly no wave64 on this card; they are not coverage.scripts/smoke.ps1, 60 s, retail 1.0.2.1 (title: 3c290c16), release. Peak commit was lower on the batch.mainb49be181e3fb07schedule_invalidnow runs again inside the clock lock incommit_schedule, and the duplicated handles are closed when it refuses. Dropping.max(1)is safe becauseinterval_us == 0is refused first.Not tested: a run that reaches this change on purpose (the smoke title only shows that nothing regresses); AMD.
AI use: Claude Code (Claude Opus 5.5) ran the commands on my machine and drafted this. Checked by me before posting.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:39:09Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-30T11:07:54Z.
@b3IKK Could you rebase this onto
main? I checked PR head39788e8cagainstmainat9dfbe3ea. The merge conflicts incrates/xcl/src/hle/d3d12x/frame.rs, and the scheduling race your patch addresses is still visible in that revision.ScheduleFrameEventXvalidates the clock under the lock, releases it while processing handles, then reacquires it to commit the event. If another thread stops the clock in between, the scheduling thread can still arm the event withinterval_usalready at zero. Your patch rechecks the clock under the lock immediately before committing.I verified that sequence in the source. I haven’t reproduced the interleaving at runtime, and the retail game loading traces I checked don’t establish that it happened there.
I used Codex GPT-6.2 Sol for the source and trace review. Codex GPT-6.1 Terra independently checked the findings. Codex GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:18:54Z.
Triage (#1607) – head
39788e8No open or merged PR changes this. Main's
schedule_frame_event_xstill checks validity, dropsCLOCKwhile it duplicates handles, and then commits without checking again.SetFrameIntervalX(0)in that window leaves the clock active withinterval_us == 0(hidden by.max(1)).The diff checks again under the lock in
commit_schedule. On refusal it closes the duplicated handles by droppingHandles. The test covers the refusal.No problems found in the diff. It conflicts with main's
frame.rs.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.