gpu/recomp: validate s_round_mode and round non-fused intermediate products #120
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!120
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/120/head"
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?
@Lum7nt on GitHub · 2026-11-23 13:20 UTC · original
Lum7nt:recomp-fp-modes→main· +62 −2 · 2 files · 1 commits · closed without mergingResolves #73
Summary of Changes
s_round_modevalidation & reporting (crates/xcl/src/gpu/recomp/emit.rs):s_round_modefrom the unconditionalNOOPSlist.sopp(): default rounding mode (Round to Nearest Even,SIMM16 == 0) is tracked inignoredand continues cleanly as a safe no-op.SIMM16 != 0) are recorded inunsupported/unsupported_why(s_round_mode: non-default round mode 0x...), preventing silent miscompilations in titles that configure directed rounding.v_mad_f16non-fused intermediate rounding (crates/xcl/src/gpu/recomp/emit.rs):v_mad_f16tomad_nf16(a, b, c)in the shader preamble with explicitf16rounding on both the intermediate product and sum:Unit & GPU Kernel Tests (
crates/xcl/src/gpu/recomp/tests.rs):s_round_mode_default_is_ignored_non_default_is_unsupported.mad_nf_and_mad_nf16_non_fused_intermediate_roundingverifying the golden vector from #73.@Foniass on GitHub · 2026-11-23 13:25 UTC · original
Heads-up @Lum7nt: #73 was already resolved by #91 (merged this morning,
088d682), and this PR conflicts with it.main,s_round_modeand the MODE writes ofs_setreg*are no longer no-ops. The f16 rounding mode is tracked (dynamic_f16_rm/xcl_fp16_rm) and applied throughf32_to_f16_rm. Recording every non-zeros_round_modeas unsupported would make those programs incomplete. Per #73, mode0xCalone appears in 3 305 programs of the retail pack, and incomplete translations aren't used for pipelines.v_mad_f16:V_MAD_F16is in neitherrdna2_spec.rsnorrdna2_xbox.rs;encode("V_MAD_F16", …)fails. So thev_mad_f16lowering here, like the arm #91 added, can never be reached.@ivall on GitHub · 2026-11-23 14:14 UTC · original
Thanks – closing: #73 was resolved by #91, and as @Foniass explains above, recording every non-zero
s_round_modeas unsupported would make the ~3 300 retail programs that set 0xC incomplete. The remaining f16 double-rounding is tracked in #111.Pull request closed