XGameRuntime: XTaskQueueIsEmpty counts delayed callbacks not yet due #1671

Merged
emirduran707 merged 1 commit from upstream-pr/1681 into main 2026-11-30 02:44:54 +00:00
emirduran707 commented 2026-11-24 19:14:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-24T19:14:51Z.


XTaskQueueIsEmpty looked only at a port's queued items and the callbacks in flight. A callback submitted with a delay (XTaskQueueSubmitDelayedCallback, or XAsyncSchedule with a delay) waits in the task queue's timer heap until it is due, so while it waited the port read as empty. libHttpClient's task queue, which XTaskQueue is, counts those entries. TaskQueuePortImpl::IsEmpty is (m_queueList->empty()) && (m_pendingList->empty()) && (m_processingCallback == 0), and a delayed entry goes to m_pendingList (TaskQueue.cpp).

A title that dispatches until the port is empty before it terminates a queue, or that uses XTaskQueueIsEmpty to tell whether its timers are done, stopped too early. The delayed callback then ran canceled at termination.

XTaskQueueIsEmpty now also looks for the queue's entries on that port in the timer heap. The locks are taken in the order submit_delayed already uses: the timer heap, then the port's items, then the queue state. No path takes the timer lock while it holds the other two.

What is in it

  • crates/xcl/src/hle/xgameruntime/taskqueue.rs: XTaskQueueIsEmpty counts delayed callbacks not yet due. Test is_empty_counts_delayed_callbacks_not_yet_due: a 60 s delayed callback keeps the work port non-empty and leaves the completion port empty, and termination cancels it.

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on c53eed3: 859 passed, 0 failed, 42 ignored; SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
  • the new test without the change in XTaskQueueIsEmpty: it fails at assert!(!XTaskQueueIsEmpty(h, PORT_WORK), "a delayed callback not yet due is still queued")

Regression run

main:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1321 (PresentX 1323)
presents per 2 s (last 3): 44 22 24
device removals: 0
crashes: 0
peak commit: 47832 MB

this PR:

xcl-smoke v1
commit: c53eed33ef1625568c739ca854e4eb34db8d1775
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1166 (PresentX 1166)
presents per 2 s (last 3): 1 0 23
device removals: 0
crashes: 0
peak commit: 49046 MB

Not tested

  • A title that waits on XTaskQueueIsEmpty with delayed callbacks pending; the smoke title's run is a regression check only.
  • The short window in which the timer thread has taken a due entry off the heap but not yet queued it still reads as empty. #1276 closes that.
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5478683941 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1681). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-24T19:14:51Z. --- `XTaskQueueIsEmpty` looked only at a port's queued items and the callbacks in flight. A callback submitted with a delay (`XTaskQueueSubmitDelayedCallback`, or `XAsyncSchedule` with a delay) waits in the task queue's timer heap until it is due, so while it waited the port read as empty. libHttpClient's task queue, which XTaskQueue is, counts those entries. `TaskQueuePortImpl::IsEmpty` is `(m_queueList->empty()) && (m_pendingList->empty()) && (m_processingCallback == 0)`, and a delayed entry goes to `m_pendingList` ([TaskQueue.cpp](https://github.com/microsoft/libHttpClient/blob/main/Source/Task/TaskQueue.cpp)). A title that dispatches until the port is empty before it terminates a queue, or that uses `XTaskQueueIsEmpty` to tell whether its timers are done, stopped too early. The delayed callback then ran canceled at termination. `XTaskQueueIsEmpty` now also looks for the queue's entries on that port in the timer heap. The locks are taken in the order `submit_delayed` already uses: the timer heap, then the port's items, then the queue state. No path takes the timer lock while it holds the other two. **What is in it** - `crates/xcl/src/hle/xgameruntime/taskqueue.rs`: `XTaskQueueIsEmpty` counts delayed callbacks not yet due. Test `is_empty_counts_delayed_callbacks_not_yet_due`: a 60 s delayed callback keeps the work port non-empty and leaves the completion port empty, and termination cancels it. **Tested** - AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release - `cargo test --workspace -- --test-threads=4` on c53eed3: 859 passed, 0 failed, 42 ignored; SKIPPED: `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) - the new test without the change in `XTaskQueueIsEmpty`: it fails at `assert!(!XTaskQueueIsEmpty(h, PORT_WORK), "a delayed callback not yet due is still queued")` **Regression run** main: ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1321 (PresentX 1323) presents per 2 s (last 3): 44 22 24 device removals: 0 crashes: 0 peak commit: 47832 MB ``` this PR: ``` xcl-smoke v1 commit: c53eed33ef1625568c739ca854e4eb34db8d1775 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1166 (PresentX 1166) presents per 2 s (last 3): 1 0 23 device removals: 0 crashes: 0 peak commit: 49046 MB ``` **Not tested** - A title that waits on `XTaskQueueIsEmpty` with delayed callbacks pending; the smoke title's run is a regression check only. - The short window in which the timer thread has taken a due entry off the heap but not yet queued it still reads as empty. #1276 closes that. - NVIDIA and Intel GPUs. **AI use** - Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mantavisual commented 2026-11-24 21:09:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mantavisual on 2026-11-24T20:46:59Z.


Test report for c53eed33ef16 on NVIDIA, which the PR lists as not tested.

Tested

  • RTX 4060 8 GB (driver 616.92, wave32), i5-13600K, 32 GB, Windows 11 Pro 22631, Rust 1.100.0 MSVC, DXC 1.9.2602.17 (SDK 10.0.26100), debug.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 859 passed, 0 failed, 42 ignored. The new test ran.
  • Merged locally with main 4178e88: 892 passed, 0 failed, 42 ignored.
  • SKIPPED at the head: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).

Does the test notice a broken fix?

  • Fix reverted: fails. The port of a delayed callback ignored: fails.
  • Gap: with Arc::ptr_eq(&t.queue, &q) removed, so that delayed callbacks of any queue count, all 11 taskqueue tests still pass. The timer heap is shared by all queues and the test makes one. Creating a second queue while the callback is pending and asserting XTaskQueueIsEmpty(other, PORT_WORK) passes normally and fails with that break.

Not tested: AMD, retail title, concurrent use.

AI use: Claude Code (Claude Opus 5.5) ran this on my machine, wrote the report and posted it for me.

<!-- greyfinch-sync:ivall/xcl:comment:7144049111 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1681#issuecomment-7144049111). Originally posted by [mantavisual](https://github.com/mantavisual) on 2026-11-24T20:46:59Z. --- Test report for `c53eed33ef16` on NVIDIA, which the PR lists as not tested. **Tested** - RTX 4060 8 GB (driver 616.92, wave32), i5-13600K, 32 GB, Windows 11 Pro 22631, Rust 1.100.0 MSVC, DXC 1.9.2602.17 (SDK 10.0.26100), debug. - `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: 859 passed, 0 failed, 42 ignored. The new test ran. - Merged locally with main `4178e88`: 892 passed, 0 failed, 42 ignored. - SKIPPED at the head: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). **Does the test notice a broken fix?** - Fix reverted: fails. The port of a delayed callback ignored: fails. - Gap: with `Arc::ptr_eq(&t.queue, &q)` removed, so that delayed callbacks of any queue count, all 11 `taskqueue` tests still pass. The timer heap is shared by all queues and the test makes one. Creating a second queue while the callback is pending and asserting `XTaskQueueIsEmpty(other, PORT_WORK)` passes normally and fails with that break. **Not tested:** AMD, retail title, concurrent use. **AI use:** Claude Code (Claude Opus 5.5) ran this on my machine, wrote the report and posted it for me.
DavidM1911 commented 2026-11-24 22:06:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:37:47Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7145182349 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1681#issuecomment-7145182349). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T21:37:47Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
MiharaxD commented 2026-11-24 22:06:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MiharaxD on 2026-11-24T21:44:21Z.


Test report on an NVIDIA card, head c53eed3 (on main c160d86), which covers the "NVIDIA" line.

Tested

  • RTX 3070 Ti 8 GB (driver 621.01), Intel i5-14400F, 32 GB RAM, Windows 11 Pro 10.0.26300, Rust 1.100.0, DXC 1.9.2602.17.
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 (debug) on c53eed3: 859 passed, 0 failed, 42 ignored (lib tests 810 / 0 / 22).
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64).
  • is_empty_counts_delayed_callbacks_not_yet_due passes.

Regression run
scripts/smoke.ps1 -Game <game folder> -Seconds 60 (release builds, start screen, no input). main is c160d86:

main:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: NVIDIA GeForce RTX 3070 Ti
title: game
seconds: 60
exit: 0x0
frames shown: 1586 (PresentX 1586)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15055 MB

this PR's head:

xcl-smoke v1
commit: c53eed33ef1625568c739ca854e4eb34db8d1775
gpu: NVIDIA GeForce RTX 3070 Ti
title: game
seconds: 60
exit: 0x0
frames shown: 1607 (PresentX 1607)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15583 MB

Not tested

  • A title that waits on XTaskQueueIsEmpty with delayed callbacks pending: the smoke run is a regression check only.
  • AMD / Intel, gameplay past the start screen.

AI use: Claude Code (Claude Opus 5.5) built the PR, ran the tests and both smoke runs, read the logs and wrote this report; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7145323901 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1681#issuecomment-7145323901). Originally posted by [MiharaxD](https://github.com/MiharaxD) on 2026-11-24T21:44:21Z. --- Test report on an NVIDIA card, head `c53eed3` (on `main` `c160d86`), which covers the "NVIDIA" line. **Tested** - RTX 3070 Ti 8 GB (driver 621.01), Intel i5-14400F, 32 GB RAM, Windows 11 Pro 10.0.26300, Rust 1.100.0, DXC 1.9.2602.17. - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` (debug) on `c53eed3`: **859 passed, 0 failed, 42 ignored** (lib tests 810 / 0 / 22). - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask` (no wave64), `gpu_wave32_program_in_wave64_hardware` (no wave64). - `is_empty_counts_delayed_callbacks_not_yet_due` passes. **Regression run** `scripts/smoke.ps1 -Game <game folder> -Seconds 60` (release builds, start screen, no input). `main` is `c160d86`: main: ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: NVIDIA GeForce RTX 3070 Ti title: game seconds: 60 exit: 0x0 frames shown: 1586 (PresentX 1586) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15055 MB ``` this PR's head: ``` xcl-smoke v1 commit: c53eed33ef1625568c739ca854e4eb34db8d1775 gpu: NVIDIA GeForce RTX 3070 Ti title: game seconds: 60 exit: 0x0 frames shown: 1607 (PresentX 1607) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15583 MB ``` **Not tested** - A title that waits on `XTaskQueueIsEmpty` with delayed callbacks pending: the smoke run is a regression check only. - AMD / Intel, gameplay past the start screen. **AI use:** Claude Code (Claude Opus 5.5) built the PR, ran the tests and both smoke runs, read the logs and wrote this report; I checked it before posting.
JJAutoCompare commented 2026-11-25 04:10:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T03:55:20Z.


XCL PR #1681 compatibility verification

Commit c53eed33ef1625568c739ca854e4eb34db8d1775 on STOR-WINLAB. Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB with driver 32.0.101.9175. The adapter reports DoublePrecisionFloatShaderOps=0 and a wave range of 8–32. d3d12SDKLayers.dll is absent. DXC/DXIL 1.9.2609.5 and rustc 1.100.0 (0ef1bc386 2026-11-09), unoptimized builds with debug info disabled.

Tested

  • cargo build --workspace and cargo test --workspace --no-run succeeded. Both emitted two deprecation warnings for Atomic::fetch_update (duplicated in the test build).
  • cargo test -p xcl xgameruntime -- --nocapture under the Arc lock reported 75 passed, 0 failed, 0 ignored, 0 SKIPPED lines. All 74 unit tests ran. The libHttpClient integration test returned early because XCL_SAMPLE_DLLS was unset. The new regression passed here and in the workspace run. In a manual queue it verified that a not-yet-due callback makes the work port nonempty, leaves the completion port empty, and clears on termination.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once under the Arc lock and exited 101. Across 20 harness summaries, pr1681-suite.log recorded 841 passed, 18 failed, 42 ignored and 3 SKIPPED lines. The harness totals include early returns. Two explicit skips cited no wave64 and one cited no heap windows. These skips provide no test coverage.

Of the 18 failures, 13 GPU tests reported CreateComputePipelineState returning 0x80070057. Four other GPU tests reported mismatches in fused multiply-add, implicit texture LOD, f16 lane preservation, and wave64 pixel reduction. The test-title e2e failed the D3D12.X dynamic depth-bias check (RSSetDepthBiasX), which produced a blue pixel where green was expected.

Not tested

Main-branch baseline, retail-title smoke runs, optional XCL_SAMPLE_* fixtures, and other GPU adapters.

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 pr1681-suite.log and published.

<!-- greyfinch-sync:ivall/xcl:comment:7152364155 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1681#issuecomment-7152364155). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T03:55:20Z. --- # XCL PR #1681 compatibility verification Commit `c53eed33ef1625568c739ca854e4eb34db8d1775` on STOR-WINLAB. Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB with driver 32.0.101.9175. The adapter reports `DoublePrecisionFloatShaderOps=0` and a wave range of 8–32. `d3d12SDKLayers.dll` is absent. DXC/DXIL 1.9.2609.5 and rustc 1.100.0 (0ef1bc386 2026-11-09), unoptimized builds with debug info disabled. **Tested** - `cargo build --workspace` and `cargo test --workspace --no-run` succeeded. Both emitted two deprecation warnings for `Atomic::fetch_update` (duplicated in the test build). - `cargo test -p xcl xgameruntime -- --nocapture` under the Arc lock reported **75 passed, 0 failed, 0 ignored, 0 SKIPPED lines**. All 74 unit tests ran. The libHttpClient integration test returned early because `XCL_SAMPLE_DLLS` was unset. The new regression passed here and in the workspace run. In a manual queue it verified that a not-yet-due callback makes the work port nonempty, leaves the completion port empty, and clears on termination. - `cargo test --workspace --no-fail-fast -- --test-threads=4` ran once under the Arc lock and exited 101. Across 20 harness summaries, `pr1681-suite.log` recorded **841 passed, 18 failed, 42 ignored** and **3 SKIPPED lines**. The harness totals include early returns. Two explicit skips cited no wave64 and one cited no heap windows. These skips provide no test coverage. Of the 18 failures, 13 GPU tests reported `CreateComputePipelineState` returning `0x80070057`. Four other GPU tests reported mismatches in fused multiply-add, implicit texture LOD, f16 lane preservation, and wave64 pixel reduction. The test-title e2e failed the D3D12.X dynamic depth-bias check (`RSSetDepthBiasX`), which produced a blue pixel where green was expected. **Not tested** Main-branch baseline, retail-title smoke runs, optional `XCL_SAMPLE_*` fixtures, and other GPU adapters. **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 `pr1681-suite.log` and published.
throny commented 2026-11-28 06:50:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T06:50:17Z.


merge-check claim
head: c53eed33ef

<!-- greyfinch-sync:ivall/xcl:comment:7235548737 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1681#issuecomment-7235548737). Originally posted by [throny](https://github.com/throny) on 2026-11-28T06:50:17Z. --- merge-check claim head: c53eed33ef1625568c739ca854e4eb34db8d1775
throny commented 2026-11-28 07:07:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T07:07:00Z.


merge-check
base: e429936c
head: c53eed33ef
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored (26 SKIPPED lines). The 9 failures are main's own at e429936c on this GPU (reported with a bisect on #3041: they arrive with the merge of #2959); the set is identical with and without this PR. Base alone: 2126 passed, 9 failed, 48 ignored.
review: no blocking finding. Lock order is timer, then items, then state, and no path on main takes them the other way round. Minor: the timer thread drops the heap lock between popping an entry and submitting it, so IsEmpty can briefly say true in that gap (still better than main). Test gap from the thread: removing the queue-identity comparison still passes all tests.
performance: XTaskQueueIsEmpty now takes the process-wide timer lock and scans the delayed heap; small unless a title polls it hard with many timers (not measured).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7235725924 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1681#issuecomment-7235725924). Originally posted by [throny](https://github.com/throny) on 2026-11-28T07:07:00Z. --- merge-check base: e429936c head: c53eed33ef1625568c739ca854e4eb34db8d1775 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored (26 SKIPPED lines). The 9 failures are main's own at e429936c on this GPU (reported with a bisect on #3041: they arrive with the merge of #2959); the set is identical with and without this PR. Base alone: 2126 passed, 9 failed, 48 ignored. review: no blocking finding. Lock order is timer, then items, then state, and no path on main takes them the other way round. Minor: the timer thread drops the heap lock between popping an entry and submitting it, so IsEmpty can briefly say true in that gap (still better than main). Test gap from the thread: removing the queue-identity comparison still passes all tests. performance: XTaskQueueIsEmpty now takes the process-wide timer lock and scans the delayed heap; small unless a title polls it hard with many timers (not measured). verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
fromthemoonx commented 2026-11-30 00:01:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-30T00:01:07Z.


merge-check
base: 53e85fb124
head: c53eed33ef
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2793 passed, 1 failed, 49 ignored; SKIPPED: 29 (mostly "no wave64"); failing: hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, which fails on the base 53e85fb alone too (#2369's test against main's late_release, see #2369), not this PR
review: none blocking, after reading the whole diff (xgameruntime/taskqueue.rs). Lock order: XTaskQueueIsEmpty now takes timer, then items, then state. The other timer-lock sites fit that order: submit_delayed takes timer then state (is_terminated), the timer thread drops the heap lock before submit_now, and XTaskQueueTerminate releases the timer lock before taking state. No path takes timer while holding items or state. is_empty_counts_delayed_callbacks_not_yet_due passes 30/30 alone and hle::xgameruntime::taskqueue:: (11 tests) 30/30 at --test-threads=8. With the new delayed condition disabled (scratch), the test fails ("a delayed callback not yet due is still queued").
performance: one more mutex (the shared timer heap) and a scan of the pending delayed callbacks per XTaskQueueIsEmpty; nothing per frame unless a title polls it. Reasoned, not measured.
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug / Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ivall/xcl:comment:7264899852 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1681#issuecomment-7264899852). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-30T00:01:07Z. --- merge-check base: 53e85fb124eae624641e9884517e4f3c4a7d8794 head: c53eed33ef1625568c739ca854e4eb34db8d1775 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2793 passed, 1 failed, 49 ignored; SKIPPED: 29 (mostly "no wave64"); failing: `hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline`, which fails on the base `53e85fb` alone too (#2369's test against `main`'s `late_release`, see #2369), not this PR review: none blocking, after reading the whole diff (`xgameruntime/taskqueue.rs`). Lock order: `XTaskQueueIsEmpty` now takes timer, then `items`, then `state`. The other timer-lock sites fit that order: `submit_delayed` takes timer then `state` (`is_terminated`), the timer thread drops the heap lock before `submit_now`, and `XTaskQueueTerminate` releases the timer lock before taking `state`. No path takes timer while holding `items` or `state`. `is_empty_counts_delayed_callbacks_not_yet_due` passes 30/30 alone and `hle::xgameruntime::taskqueue::` (11 tests) 30/30 at `--test-threads=8`. With the new `delayed` condition disabled (scratch), the test fails ("a delayed callback not yet due is still queued"). performance: one more mutex (the shared timer heap) and a scan of the pending delayed callbacks per `XTaskQueueIsEmpty`; nothing per frame unless a title polls it. Reasoned, not measured. verdict: safe to merge hardware / tool and model: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug / Claude Code (Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1671
No description provided.