tombox-xshader: emit v_fract_f32 as x - floor(x); fix v_ceil_f16 test literal #34
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!34
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/34/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?
@artareias on GitHub · 2026-11-21 18:42 UTC · original
artareias:fix-v-fract-v-ceil-f16→main· +3 −2 · 2 files · 69 commits · closed without mergingProblem
vop::basic::vop1_basicfails 11 cases. Two of the causes are addressed here.v_fract_f32with negative inputs. The emitter writesfrac(x), which dxc lowers to theFrcoperation. On an AMD Radeon RX 7600 and on WARP,frac(-3.7)returns0.7(the fractional part of|x|) instead of0.3. The RDNA 2 ISA guide (V_FRACT_F32, p. 148) definesD = S0 + -floor(S0)and givesfract(-1.2) = 0.8.v_ceil_f16is a test bug, not an emitter bug. The test input is0xbc00 - 0x3c00 + 0x8001. That evaluates to0x10001, so the low 16 bits are0x0001, the smallest positive subnormal.ceilof a positive value is1.0(0x3c00), which is what the emitter returned (V_CEIL_F16, p. 156). The test meant0x8001, the smallest negative subnormal, whoseceilis-0.0(0x8000).Change
v_fract_f32is now emitted as(x - floor(x)).v_fract_f16is not touched; its tests already pass.tests/exec_vop/basic.rs: thev_ceil_f16input literal is now0x8001.Testing
Windows 10 19045, MSVC 14.44, rustc 1.100.0, AMD Radeon RX 7600 (
TOMBOX_EXEC_HW=1) and WARP:vop1_basicfailing cases (RX 7600)vop1_basicfailing cases (WARP)Per-test run of all 61
exectests on the RX 7600 before and after: no other test changes status.Not changed
The 9 cases left in
vop1_basicare NaN sign (v_log_f32,v_rsq_f32,v_sqrt_f32,v_fract_f32: result0xffc00000where0x7fc00000is expected),v_fract_f32(-0.0)(+0vs-0), and onev_fract_f32case that expects0x3f7fffff(a clamp below 1.0) wherex - floor(x)gives1.0. The manual does not describe any of these, so I left the emitter and tests as they are.🤖 Generated with Claude Code
@omonkeyz on GitHub · 2026-11-22 13:13 UTC · original
Main's history was rewritten, which auto-closed this PR (sorry for the noise). Already covered on main by tb_fract, which also clamps below 1.0 as the ISA does. Thanks!
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-21 18:42 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Pull request closed