Skip to content

riscv: use exact rounding for tiny directed FMA results - #314

Open
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/fma-tiny-directed
Open

riscv: use exact rounding for tiny directed FMA results#314
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/fma-tiny-directed

Conversation

@carlosqwqqwq

Copy link
Copy Markdown

riscv: use exact rounding for tiny directed FMA results

Fixes #308

Commit message

riscv: use exact rounding for tiny directed FMA results

Description

The directed-rounding FMA path can double-round a subnormal product and
its error term, producing a wrong result and false UF. Use one 128-bit exact
rounding path for the affected fmadd.d range under RTZ/RDN/RUP, and restore
NX/UF from the exact result. The change is limited to src/util/fpu_lib.h;
validation artifacts stay out of the source diff. This patch applies independently
to the staging branch and does not depend on an unmerged FMA change.

Validation

  • The witness runs on native RISC-V hardware, QEMU, and the affected RVVM build; the patched build matches both references.
  • Both the interpreter and JIT lanes were exercised, and the patched build is limited to this root.

The patch is independently applicable to the staging branch. RNE/RMM tiny
results remain outside this patch's scope.

@carlosqwqqwq
carlosqwqqwq force-pushed the fix/fma-tiny-directed branch 2 times, most recently from 541927d to a4ffb6a Compare September 6, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fmadd.d directed rounding returns wrong results and flags for tiny sums

1 participant