Recompiler: legacy FMA zero product adds c; XAsync waits cover the callback #665
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/670"
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 henriazz10 on 2026-11-24T03:11:26Z.
Two fixes and a set of GPU tests, kept as separate commits so each can be reviewed or dropped on its own. Part of #576 (points 1, 3 and 4).
v_fma_legacy_f32/v_fmac_legacy_f32still addcto a +0.0 product, soc = -0.0gives +0.0 (LLVM foldsfma_legacy(±0.0, x, y)tofadd y, 0.0). The recompiler'sfma_legacyhelper returnedcunchanged and gave -0.0.XAsyncBlock;XAsyncGetStatus(wait = true)could return before the completion callback ran;XAsyncGetResultSizedid not always write the size.What is in it
Tests: GPU tests for V_CUBE*_F32 and the legacy mul / fma / fmac:gpu_cube_face_sc_tc_ma_and_tiesandgpu_legacy_zero_wins_mul_fma_fmacingpu/recomp/tests.rs(test only).Recompiler: a zero product in v_fma_legacy_f32 still adds c: the zero-product branch offma_legacyingpu/recomp/emit.rsreturnsprecise c + 0.0f; new testgpu_fma_legacy_zero_product_adds_c(fails without the change:0x80000000where0x00000000is expected).XGameRuntime: XAsync work items carry their call, and waits cover the callback, inhle/xgameruntime/xasync.rs: each queued item carries its call's state (anArcas the queue context); a wait returns only after the completion callback has returned, also when it starts after completion (a call without a payload stays registered until its callback returns), and a wait from inside the callback does not deadlock;XAsyncGetResultSizealways writes the size. Four new tests, each failing without its part of the change.Tested
cargo test --workspace -- --test-threads=4on this branch (47b4989): 697 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.Regression run
scripts/smoke.ps1. The second and third commits change the runtime (emit.rs,xasync.rs), so this PR needs someone with a title to add the twoxcl-smokeblocks. It stays a draft until then.Not tested
cwith a zero product is not covered.AI use
fma_legacyfix, the XAsync change and their tests, the commits and this description; ran the tests.fma_legacybehaviour, and reviewed the XAsync change (found the late-wait case fixed here).🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by dadnotdaddy on 2026-11-24T04:11:56Z.
For the #679 part: the issue's bit-based form,
asfloat(select(c == 0.0f, 0u, asuint(c))), leaves DXC nothing to fold and doesn't depend onpreciseholding across drivers. Tested with a GPU test in #720 (VOP3 and VOP2, c = -0 with 05, -05, 5*-0, 0inf, -0NaN): fails on main, passes with it on an RTX 2070 SUPER. Feel free to take it into this PR; I'll close #720 so there's one fix to review. AI-assisted (Claude Code).Imported from ivall/xcl. Originally posted by ryosen0 on 2026-11-24T04:14:15Z.
Smoke blocks for this head, from a machine with the title — you asked for someone to run them.
Setup: RTX 3060 Ti 8 GB (wave32), Ryzen 7 9800X3D, 32 GB RAM, driver 32.0.16.1742, Windows 11, release builds, retail title 1.0.2.1,
scripts/smoke.ps1 -Seconds 90(it setsXCL_NETWORK=0 XCL_ACTIVITY=1itself).Tests on
47b4989:cargo test --workspace --no-fail-fast -- --test-threads=1: 697 passed, 0 failed, 41 ignored; SKIPPED: the two wave64 GPU tests (no wave64 here). Matches your count on the RTX 5080.Regression run
Main
dd2ae9a(this branch's merge-base):Head
47b4989:Both reach the menus at a steady 60 presents / 2 s; the frame-count difference is within run-to-run variance we see between identical builds.
Not tested: the XAsync change against a retail title doing real async work beyond the 90 s menu window (the smoke runs stay in the menus); wave64 hardware; the legacy-FMA result on console hardware (as your description notes).
AI use: GPT-6.2 Astra (API model selector) in DSH built both revisions, ran the suite and the two smoke runs, and wrote this report; the human contributor reviewed the numbers before posting.
Imported from ivall/xcl. Originally posted by joeypercia on 2026-11-24T04:14:15Z.
Data for the
precisevs bits question on thefma_legacypart: thepreciseform doesn't hold on AMD's driver.I put this PR's helper (
precise float z = c + 0.0f; … ? z : …) intomain91f9a5eand ran the zero-product test from #679 (VOP3v_fma_legacy_f32and VOP2v_fmac_legacy_f32;c = -0with0 · inf,-0 · 5,0 · NaN):precise c + 0.0f(this PR)asfloat(select(c == 0.0f, 0u, asuint(c)))c = -0cases give-0(0x80000000), same asmainWindows 11 Pro 26200, DXC 1.8.2502.11, Rust 1.100.0 MSVC, debug. So the add survives DXC here but AMD's compiler still drops it; on the bits there is nothing for either compiler to fold, which is what @dadnotdaddy suggested.
Also, this PR predates #679 (my search missed drafts, sorry for the duplicate issue). If you take the bit form, a
Fixes #679would close that one too.Run and report by Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-24T13:40:34Z.
RDNA4 data for the
precisevs bits question above: on an RX 9070 this PR's own new test fails the same way as on the RDNA2 iGPU.Tested
47b4989merged intomain1ec4c98(clean merge), debugcargo test --workspace --no-fail-fast -- --test-threads=4: 718 passed, 4 failed, 41 ignored, 0 GPU tests SKIPPEDgpu_fma_legacy_zero_product_adds_c--exact)gpu_cube_face_sc_tc_ma_and_ties,gpu_legacy_zero_wins_mul_fma_fmac, the 4 XAsync tests)So the
precise c + 0.0fadd is dropped here too (0x80000000instead of+0).With only that helper line changed locally to the bit form suggested above,
return (a == 0.0f || b == 0.0f) ? asfloat(select(c == 0.0f, 0u, asuint(c))) : mad(a, b, c);(this PR merged intomain077ce40, everything else as in the PR):precise c + 0.0f(this PR)gpu_fma_legacy_zero_product_adds_c, alonegpu_legacy_zero_wins_mul_fma_fmac, aloneSo the bit form holds on RDNA4 as well as on the RDNA2 iGPU.
The other 3 failures in the suite run are the title-texture trio from #718 (
placed_title_textures_share_vram_and_preserve_pixelsand the twoPoisonErrortests). They fail the same way onmain1ec4c98without this PR and pass alone on both, so they are not from this PR.Not tested
scripts/smoke.ps1): I have no retail title.AI use
upstream-sync referenced this pull request2026-11-24 21:29:08 +00:00
upstream-sync referenced this pull request2026-11-25 07:04:28 +00:00
upstream-sync referenced this pull request2026-11-25 10:09:30 +00:00
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T12:21:09Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:42:30Z.
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 Foniass on 2026-12-01T03:55:51Z.
Triage (#1607) – head
47b4989Overlap: the
XAsyncGetResultSizehunk in xasync.rs (write 0 while pending, and on theFinishedpath whatever the status) is the same change as #1201, which makes only that change and is mergeable. The rest of this PR (work and completion items carry the call'sArc<State>, waits cover the completion callback, thefma_legacyzero-product fix in emit.rs, the cube / legacy GPU tests) is not on main and no other open PR does it. #641 also touches xasync.rs but keeps the queue alive after the handle closes (#576 point 2), which is a different problem.No problems found in the diff. The PR combines a recompiler fix and an XAsync fix that are unrelated. Splitting them, and leaving the GetResultSize part to #1201, would make each easier to review.
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.