Repository navigation
Conversation
…f two NaNs with an sNaN fsgnj/fsgnjn/fsgnjx share the compare arm of the non-computational unit and took the compare's NV verdict, so a signaling NaN operand set fflags.NV. Sign injection never raises a flag. Gate NV on the compare select in the STD/DSP unit (VX_fncp_unit) and on is_fcmp in the DPI backend. fmin/fmax with two NaN operands returned the canonical NaN through an early exit that skipped the signaling check, so NV was lost when either input was an sNaN. rvfloats is shared by SimX and the DPI backend, so both were wrong; the RTL STD unit was already correct. New regression fp_flags checks results and fflags of sign injection, min/max and compares on NaN operands against values from the F/D specification (not softfloat, which the simulators share), single and, at XLEN 64, double precision. CI runs it on SimX and on rtlsim with the DPI, STD and DSP backends. On the old code it fails 4 min/max cases on SimX and 5 sign-injection cases on STD. At XLEN 64 it also runs single-precision ops on raw 64-bit register values: an improperly NaN-boxed operand must read as the canonical NaN and every result must come back NaN-boxed; SimX, DPI and STD pass them. Fixes #444, fixes #449. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… error bound The check summed the products sequentially in float on the host and allowed a fixed 6 ulp. A float sum's rounding error grows with n, so -n4096 failed even though the device result (one product per thread, grid-stride accumulation, block tree reduction) was closer to the exact sum than the reference. Compute the reference and the sum of the block partials in double, and accept |device - exact| <= gamma_depth * sum|a*b|, where depth counts the float roundings on any product's path to its block sum (the product, the grid-stride accumulations, the tree levels). The bound is rigorous for any IEEE-correct device and stays tight: at -n4096 it is about 6 ulp of the result, far below a single dropped product. The integer variant keeps the exact comparison, now in unsigned arithmetic, so the reference wraps modulo 2^32 as the device does instead of overflowing a signed int. The partials buffer is now sized in elements, not bytes. Fixes #450. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 19, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fsgnj/fsgnjn/fsgnjxshare the compare arm of the non-computational unit and took its NV verdict, so a signaling-NaN operand setfflags.NV. The STD/DSP unit (VX_fncp_unit) now gates NV on the compare select, and the DPI backend reports compare flags only for compares. Fixes fsgnj / fsgnjn / fsgnjx set fflags.NV when an operand is a signaling NaN #444.sw/common/rvfloats.cppskipped the signaling check. SimX and the DPI backend share that code; the STD RTL was already correct. Fixes DPI FPU fmin.s / fmax.s drop fflags.NV when both inputs are NaN #449.fp_flags. It checks results and fflags against constants from the F/D specification, not softfloat. At XLEN 64 it also runs single-precision ops on raw 64-bit registers, checking NaN-box handling on input and output.Impact and evidence
Impact class: R2 (
ci/change_impact.py classify)Contracts touched: none
-n4096.model_parityperf_gatelogic_gateVX_fncp_unit-Walllint at XLEN 32 and 64 (default, A+Zacas, L1 line 8, 2x2 cores + L2/L3 + PERF, STD/DSP/FPNEW); SimX with-DSIMX_FUNCTIONAL🤖 Generated with Claude Code