Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for building Hwacha with reduced FP precision/no FDIV/no IDIV #29

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jerryz123
Copy link
Contributor

No description provided.

@jerryz123 jerryz123 requested review from a0u and colinschmidt March 14, 2021 03:38
Copy link
Member

@a0u a0u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If unimplemented, the FMA instructions should be excluded from the decode tables so an illegal instruction assertion will be raised if used:

VFMADD_D ->(List[BitPat](Y,N,N,N,Y,RX,Y,Y,RX,Y,Y,RX,Y,Y,RX,Y,Y,IMM_X,FN_X, DW__,A1_X, A2_X, Y,FPD,N,VM_X,M_X, N,SM_X,MT_X, N,I_X, N, N,IM_X, N,ID_X, Y,FM_MADD, N,FD_X, N,FC_X, N,FV_X, N,N) ++ FMADD_D),
VFMSUB_D ->(List[BitPat](Y,N,N,N,Y,RX,Y,Y,RX,Y,Y,RX,Y,Y,RX,Y,Y,IMM_X,FN_X, DW__,A1_X, A2_X, Y,FPD,N,VM_X,M_X, N,SM_X,MT_X, N,I_X, N, N,IM_X, N,ID_X, Y,FM_MSUB, N,FD_X, N,FC_X, N,FV_X, N,N) ++ FMSUB_D),
VFNMADD_D ->(List[BitPat](Y,N,N,N,Y,RX,Y,Y,RX,Y,Y,RX,Y,Y,RX,Y,Y,IMM_X,FN_X, DW__,A1_X, A2_X, Y,FPD,N,VM_X,M_X, N,SM_X,MT_X, N,I_X, N, N,IM_X, N,ID_X, Y,FM_NMADD,N,FD_X, N,FC_X, N,FV_X, N,N) ++ FNMADD_D),
VFNMSUB_D ->(List[BitPat](Y,N,N,N,Y,RX,Y,Y,RX,Y,Y,RX,Y,Y,RX,Y,Y,IMM_X,FN_X, DW__,A1_X, A2_X, Y,FPD,N,VM_X,M_X, N,SM_X,MT_X, N,I_X, N, N,IM_X, N,ID_X, Y,FM_NMSUB,N,FD_X, N,FC_X, N,FV_X, N,N) ++ FNMSUB_D),
VFADD_D ->(List[BitPat](Y,N,N,N,Y,RX,Y,Y,RX,Y,Y,RX,Y,N,RX,N,Y,IMM_X,FN_X, DW__,A1_X, A2_X, Y,FPD,N,VM_X,M_X, N,SM_X,MT_X, N,I_X, N, N,IM_X, N,ID_X, Y,FM_ADD, N,FD_X, N,FC_X, N,FV_X, N,N) ++ FADD_D),
VFSUB_D ->(List[BitPat](Y,N,N,N,Y,RX,Y,Y,RX,Y,Y,RX,Y,N,RX,N,Y,IMM_X,FN_X, DW__,A1_X, A2_X, Y,FPD,N,VM_X,M_X, N,SM_X,MT_X, N,I_X, N, N,IM_X, N,ID_X, Y,FM_SUB, N,FD_X, N,FC_X, N,FV_X, N,N) ++ FSUB_D),
VFMUL_D ->(List[BitPat](Y,N,N,N,Y,RX,Y,Y,RX,Y,Y,RX,Y,N,RX,N,Y,IMM_X,FN_X, DW__,A1_X, A2_X, Y,FPD,N,VM_X,M_X, N,SM_X,MT_X, N,I_X, N, N,IM_X, N,ID_X, Y,FM_MUL, N,FD_X, N,FC_X, N,FV_X, N,N) ++ FMUL_D),

This should also apply to single and half precision for consistency.

src/main/scala/vfu-fma.scala Show resolved Hide resolved
@colinschmidt
Copy link
Contributor

I would suggest making all double precision operations illegal (the strange subset that exists when only DFMA is removed is unlikely to be useful) and then I would consider looking at all the other double precision functional units included (FDIV, FCMP, FCOMP) to see how much more area/power you could save.

@jerryz123
Copy link
Contributor Author

I've revised the PR to more thoroughly remove unused FP units, and explicitly throw illegal instruction exceptions for unsupported types.

@jerryz123 jerryz123 changed the title Add support for building Hwacha with no DFMAs Add support for building Hwacha with reduced FP precision/no FDIV/no IDIV Mar 17, 2021
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.

3 participants