FPU: deliver full architectural FP register to the vector coprocessor (preserve NaN-box for .vf scalars) - #3820
Open
emiliengnr wants to merge 1 commit into
Conversation
Signed-off-by: Emilien Garnier <garnieremilien@orange.fr>
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.
Hello, here is a pull request for a bug I found.
Problem
A vector
.vfop reads its scalar FP operand from Rocket through the FPU store-data port,which
FPToIntbuilds by replicating the low element bits acrossfLen. For theread_frs1micro-op atSEW=32the tag isS, so a NaN-boxed single0xFFFFFFFF_3f800000reaches the coprocessor as
0x3f800000_3f800000: the box is overwritten by a copy of thevalue. The coprocessor can no longer tell a boxed single from an unboxed register, so it
cannot apply NaN-boxing for a narrow
.vfscalar.io.v_sewis the architecturalvtype.vsew, so the coprocessor cannot ask for wider delivery; the fix belongs here.Fix
Use the max-width tag for the
read_frs1micro-op so the store emits the fullieee(in.in1)and the box survives:The low bits are unchanged, so no correct result changes. Here
typeTagOutfeeds onlyio.out.bits.store(tointkeys onin.fmt(0)) and only forread_frs1, so scalarstores and
fmv.x/fcvtare unaffected. Verified against spike: atSEW=32a boxedsingle passes through and an unboxed double reads as the canonical NaN.
Related: ucb-bar/saturn-vectors#88
This is the delivery-side change the NaN-box check in
ucb-bar/saturn-vectors#88 depends on.
That check inspects the scalar's upper 32 bits, which on stock rocket-chip are a copy of
the low bits, so it wrongly turns boxed singles into NaN. With this patch the coprocessor
sees the real box and the check becomes correct. #88 cannot work without it.