feat: v_floor/ceil/trunc/rndne_f16 in the RDNA 2 interpreter — 1,216/1,490 #245
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!245
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/245/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?
@lcg007xd-c on GitHub · 2026-11-25 21:02 UTC · original
lcg007xd-c:feat/rdna2-f16-rounding→main· +121 −18 · 11 files · 1 commits · merged 2026-11-26 00:15 UTCChange
The reference interpreter now runs the four f16 rounding ops in VOP1 and VOP3, 8 encodings that raised
Untranslateduntil now:v_floor_f16,v_ceil_f16,v_trunc_f16andv_rndne_f16.They join
rdna2_exec_f16.OPERATIONS(#218) through a small helper,half_round:_signed_round: IEEE 754 roundToIntegral,trunc(-0.5) = -0,ceil(-0.5) = -0);v_rndne_f16rounds ties to even (2.5 → 2, -2.5 → -2);0x7E00(the rule of every f16 result in this module).The existing f16 rules apply unchanged:
op_selreads or writes the high half;abs/negact on bit 15;clamplimits the result to [0, 1];Source: AMD, "RDNA 2" ISA, November 2020, §12.8 "VOP1 Instructions", opcodes 91-94 (printed p. 148). Note that the ISA pseudo-code of V_RNDNE_F16 (
floor(S0 + 0.5), minus 1 on an even tie) gives +0 for -0.5. This PR keeps the sign, asv_rndne_f32does here (_round_even,copysign) and as LLVM's constant folding ofrintdoes. Neither case is measured; say if you prefer the pseudo-code.HLSL: not changed. The recompiler still refuses these ops (tested). The translation can follow with GPU parity tests, as #219 did after #218.
Coverage (
rdna2_exec.coverage()): 1,208 → 1,216 of 1,490. All 9 READMEs go from 81% to 82%. Overlap: #230, #232, #241 and #244 change the same README number; whichever merges later adds its own delta.Linked issue: Refs #115 (f16).
Verification
Linux (Arch, Python 3.14.10), no C++ runtime, no GPU (runtime and GPU tests skip), rebased rebased on
main9a06443:The suite is green on this machine since #237 and #238 merged.
Not run: the Windows CI job and GPU/WARP (no HLSL change).
Oracle and test data
New
tests/test_rdna2_f16_rounding.py(14 tests). A hand-written table of 16 inputs lists all four results for each:The tests:
op_selreading and writing the high half;neg,absandclamp;Failure case: 10 of the 14 fail on
main(the 4 that pass are the HLSL refusals).Checklist
E_NOTIMPL), never a fake success.test_readme_sync.pychecks it).Made with AI assistance (Claude Code).
🤖 Generated with Claude Code
@LooperSalty on GitHub · 2026-11-25 21:56 UTC · original
Thanks — this one is approved, but it now conflicts with main after #242, #244 and #248 were merged (mostly the README RDNA 2 line, plus shared rdna2 files for some). Could you merge or rebase onto main, recount the README line with
rdna2_exec.coverage()on the merged tree (all 9 languages), and push? I will merge it as soon as CI is green.@lcg007xd-c on GitHub · 2026-11-25 22:01 UTC · original
Rebased onto
main(9a06443), README line recounted withrdna2_exec.coverage()on the merged tree: 1,216 of 1,490 (82%), all 9 languages.