Recompiler: legacy FMA zero product adds c; XAsync waits cover the callback #670
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!670
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@henriazz10 on GitHub · 2026-11-24 03:11 UTC · original
henriazz10:recompiler/fma-legacy-zero-product→main· +459 −20 · 3 files · 3 commits · draftTwo 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
@dadnotdaddy on GitHub · 2026-11-24 04:11 UTC · original
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).@ryosen0 on GitHub · 2026-11-24 04:14 UTC · original
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.
@joeypercia on GitHub · 2026-11-24 04:14 UTC · original
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).
@Toons29 on GitHub · 2026-11-24 13:40 UTC · original
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
@DavidM1911 on GitHub · 2026-11-25 12:21 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.