This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][RVV] Add Uses = [FRM] and mayRaiseFPException = true to RVV instructions
ClosedPublic

Authored by arcbbb on Mar 7 2022, 12:14 AM.

Details

Summary

This patch adds Uses = [FRM] and mayRaiseFPException = true to following instructions:

VFADD, VFSUB, VFRSUB, VFMUL, VFDIV, VFRDIV
VFWADD, VFWSUB, VFWMUL
VFMADD, VFMACC, VFMSAC, VFMSUB
VFNMADD, VFNMACC, VFNMSAC, VVFNMSUB
VFWMACC, VFWMSAC, 
VFWNMACC, VFWNMSAC
VFSQRT, VFREC7
VFREDOSUM, VFREDUSUM,
VFWREDOSUM, VFWREDUSUM

and only adds mayRaiseFPException = true to following instructions:

VFRSQRT7, 
VFMIN, VFMAX, VFREDMIN, VFREDMAX
VMFEQ, VMFNE, VMFLT,VMFLE, VMFGT, VMFGE

Diff Detail

Event Timeline

arcbbb created this revision.Mar 7 2022, 12:14 AM
arcbbb requested review of this revision.Mar 7 2022, 12:14 AM
HanKuanChen commandeered this revision.Mar 9 2022, 2:08 AM
HanKuanChen added a reviewer: arcbbb.
HanKuanChen added a subscriber: HanKuanChen.

VFRSQRT7 do not use FRM.
From v-spec,

The output value is independent of the dynamic rounding mode.

arcbbb commandeered this revision.Mar 9 2022, 5:58 PM
arcbbb edited reviewers, added: HanKuanChen; removed: arcbbb.

VFRSQRT7 do not use FRM.
From v-spec,

The output value is independent of the dynamic rounding mode.

Thanks!
I check again the spec https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc,
and it says The output value is independent of the dynamic rounding mode.
I'll update this.

arcbbb updated this revision to Diff 414257.Mar 9 2022, 6:03 PM
arcbbb edited the summary of this revision. (Show Details)

Updates:

  1. Removes FRM use from VFRSQRT7

Hi @arcbbb I may be missing context here

How does this interact with the scalar side of things (F and D instructions). AFAICT their usage of FRM is still unmodeled, right? I mean for codes that only use vector operations this seems fine but when we mix them with the scalar ones, won't we run into scheduling issues?

Maybe you have planned to land the modelling of FRM for the scalar ones too?

Hi @arcbbb I may be missing context here

How does this interact with the scalar side of things (F and D instructions). AFAICT their usage of FRM is still unmodeled, right? I mean for codes that only use vector operations this seems fine but when we mix them with the scalar ones, won't we run into scheduling issues?

Maybe you have planned to land the modelling of FRM for the scalar ones too?

FRM for scalar instructions is modeled. D116694, D116323, D115680, D115555 probably some others.

arcbbb updated this revision to Diff 415917.Mar 16 2022, 11:41 AM

rebase for per-merge checks

FRM for scalar instructions is modeled. D116694, D116323, D115680, D115555 probably some others.

Thanks, I definitely missed those. Sorry for the noise.

rogfer01 accepted this revision.Mar 24 2022, 12:29 AM

I understand we need this for proper modelling of FRM when lowering constrained FP operations

LGTM.

This revision is now accepted and ready to land.Mar 24 2022, 12:29 AM
This revision was landed with ongoing or failed builds.Mar 31 2022, 1:38 AM
This revision was automatically updated to reflect the committed changes.