hle/acphal: track cumulative XApu enqueued and dequeued totals #2041
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!2041
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2041"
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?
@Decodere on GitHub · 2026-11-25 01:40 UTC · original
Decodere:fix-1489-xapu-cumulative-counts→main· +119 −13 · 1 files · 1 commits · openWhat is in it
Track cumulative XApu enqueued and dequeued totals separately from the pending result queue length (
XCL-BT-043, part of #1489).Part of #1489
crates/xcl/src/hle/acphal.rs,XApuEnqueueCommandwroteq.len() as u32(current pending queue length) into its optionalcountout-parameter instead of the cumulative total of commands enqueued on the connection, andXApuGetResultCountwroteq.len() as u32(the same pending queue length it returns) into its optionaltotalout-parameter instead of the cumulative total of results dequeued viaXApuDequeueResult. After enqueueing 2 commands and dequeuing 2 results,XApuGetResultCount(h, &mut total)returned0with*total = 0instead of2, and enqueueing a 3rd command wrote*count = 1instead of3.queue: VecDeque<XApuResult>,enqueued: u32,dequeued: u32) inXApuResultsunderXApu.results: Mutex<XApuResults>so queue mutations and totals update atomically under one lock:XApuEnqueueCommandpushes the result, incrementsst.enqueuedviawrapping_add(1), and writesst.enqueuedto*countwhen non-null.XApuDequeueResultincrementsst.dequeuedviawrapping_add(1)only whenpop_front()returnsSome(r)(leavingdequeuedunchanged onXAPU_NO_RESULTS), releasing the lock beforewrite_unaligned.XApuGetResultCountreads(st.queue.len() as u32, st.dequeued)under the lock, writesdequeuedto*totalwhen non-null, and returnspending.xapu_enqueue_and_result_count_report_cumulative_totalsandxapu_cumulative_counters_wrap_at_u32_maxincrates/xcl/src/hle/acphal.rscovering cumulative counts across enqueue/dequeue cycles, empty dequeues (XAPU_NO_RESULTS), null optional out-parameters / null handle safety, andu32::MAXwraparound.Tested
621.14, wave32), Intel Core i5-11400F, 32 GB RAM, Windows 11 Home build 26200, Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.9.2609.5(01b62ad4).origin/main656c0e8with new test added, debug):cargo test -p xcl --lib hle::acphal::tests -- --nocapture->7 passed; 1 failed(xapu_enqueue_and_result_count_report_cumulative_totalspanicked withleft: 2, right: 0when checking*totalafter 2 enqueues and 0 dequeues).b591ccc7):cargo test --release -p xcl --lib hle::acphal::tests -- --nocapture->10 passed; 0 failed; 0 ignored.b591ccc7):cargo build --release --workspace+cargo test --release --workspace -- --test-threads=4 --nocapture->1104 passed, 0 failed, 46 ignoredacross 20 test binaries.SKIPPEDlines (26 total, all pre-existing on this wave32 Windows host without Graphics Tools / Developer Mode / heap windows):no wave64skips (4ingpu::recomp::lower::tests,13ingpu::recomp::lower_dxil::tests,2ingpu::recomp::tests).per-lane form: refusedskips ingpu::recomp::lower_dxil::tests(f16 arithmetic,f16 packed,f32 conversions).test_title_draws_with_a_root_signature_under_the_debug_layer: nod3d12SDKLayers.dll;uploads_start_from_each_subresources_state:0x887A002D).shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable driver cache without Windows Developer Mode.heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.Regression run
Paired 60 s retail title runs with
scripts/smoke.ps1(release build, same title, clean working tree) onorigin/main(8f5fca5b) and this PR (b591ccc7):main:this PR:
Not tested
*countor*totalout-parameters ofXApuEnqueueCommand/XApuGetResultCount; the paired smoke run is a regression check only.AI use
Google Antigravity (Gemini 4 Neon) wrote the fix, unit tests, and this PR description; all builds, tests, and paired retail smoke runs were executed locally on the hardware listed above.
@raylitebull on GitHub · 2026-11-25 01:43 UTC · original
Code review on
b591ccc:XApuResults(queue,enqueued: u32,dequeued: u32) incrates/xcl/src/hle/acphal.rscleanly separates cumulative enqueue/dequeue counters from the pendingqueue.len()returned byXApuGetResultCount.XApuEnqueueCommandwrites cumulativewrapping_add(1)enqueued,XApuDequeueResultincrementsdequeuedonly onSome(r), andXApuGetResultCountreturnspendingwhile writing cumulativedequeuedto*total.xapu_enqueue_and_result_count_report_cumulative_totalsandxapu_cumulative_counters_wrap_at_u32_max) cover empty dequeue (XAPU_NO_RESULTS), null out-pointers/handles, andu32::MAXwraparound cleanly.PR descriptionis green andBuild and test (Windows, no GPU)is running.Remaining before merge:
Build and testfinishing green plus dual-vendor (AMD + NVIDIA) verification onb591ccc.@JJAutoCompare on GitHub · 2026-11-25 02:26 UTC · original
PR #2041 verification
Tested live PR head
b591ccc73547b072cdf854ebf8e56dfdb0d58b1dfromrefs/pull/2041/headin a clean detached worktree. Fetchedorigin/mainwascbc296ab65a2661a61e3e2da109134bcd5319f60.git merge-tree --write-tree origin/main HEADexited 0 and produced treeef3ee3f8d9a7410d03ecd6af81afe8b01de9a8f5.What is in it
crates/xcl/src/hle/acphal.rstracks cumulative XApu enqueued and dequeued totals alongside the pending result count. The new tests exercise FIFO order, empty dequeues, optional pointers, and counter wraparound.Tested
DoublePrecisionFloatShaderOps=0). DXC/DXIL 1.9.2609.5,rustc 1.100.0 (0ef1bc386 2026-11-09). Unoptimized Cargo dev/test profiles with debug info and incremental compilation disabled.cargo build --workspaceandcargo test --workspace --no-runsucceeded outside the GPU lock.cargo test -p xcl --lib acphal -- --show-outputoutside the GPU lock reported 10 passed, 0 failed, and 0 ignored. Both new XApu tests also passed in the full suite.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputran once under the shared Arc lock and exited 101. Across 20 target summaries, libtest reported 1077 passed, 27 failed, 46 ignored. The log also records 26 skip notices across 16 tests, including partial skips that libtest can mark as passed. The skipped paths provide no coverage.CreateComputePipelineStatereturning0x80070057and mismatches in fused F32 arithmetic, implicit-LOD sampling, an F16 high-half result, and pixel-wave reduction. Thee2etarget had one failure intest_title_runs_and_game_folder_is_untouched. TheRSSetDepthBiasXdraw produced a blue pixel where the test expected green.Skip notices from the full workspace log
Full log
L:\XclTooling\neon-slot-5\tmp\pr2041-suite.log.Not tested
origin/mainis unverified.XCL_SAMPLE_*unset), and other GPU adapters.AI use
Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against
pr2041-suite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 04:28 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
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.