From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) by sourceware.org (Postfix) with ESMTPS id E79A03858404 for ; Mon, 15 May 2023 14:41:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E79A03858404 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ua1-x935.google.com with SMTP id a1e0cc1a2514c-76d846a4b85so3817106241.1 for ; Mon, 15 May 2023 07:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684161680; x=1686753680; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YmiVAkAGDbNmj3lq9sUl/q7T6M6G9tPiYYHk7I9MuMA=; b=HyXm0+irkBPp7Mtspss4mEkffu0/zbsENr9hDr6iFzDL4U9SITA7KavLkYwzkt188b 8rVEOMUgHrsz/FIQhirZl5XuRB4O3kn2m6hQefVKD2JgAKsf8Wrpl/uadUAumQVuyLz0 xzyGUxs9+LFHufKpav80gyGi936sY+rG36tygptIuZvIZEzxdeIfTQmH1YyorE2iJZpH F3EoIzoBPN24bUPZQczgab7NRtqV/WU2yj4tdNEw6Q37dpt1MasCDmZjHi2WlLGpGEd4 TzcGk70ol9aP3n2vqbfoCluktTdWFlOcWnXbzndbGiLoVffBMA2/VYOclZQEGtgmkqbZ ExDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684161680; x=1686753680; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YmiVAkAGDbNmj3lq9sUl/q7T6M6G9tPiYYHk7I9MuMA=; b=jTTS4oxFCgz2biSI9M9kbLDWWUxlRWJBvIkF/IY/A2NtcwE/MWYqW5pxKf9J7ZArTS qdzOzP3K0tIPUUvaRASVCZUDpCGfi5g5iB1YF8VJUsam+KUFsl4E42DpAZJs7LuZu3nE gr7c5Q1nCzL4wFiotJDjMKJLTlXUk9VgtutiTdRIlPYFSM7AdtK4TZ5HRHiLQwvkpwEv RGYSAugwgEs/NLMO1mWTenI29TXpZpZCdrHetrJPSPobmQkhFBLUpe8QAp+U5KaqGf45 Mt82Q+Xffco4PvXYxFMPFwJb1viauU+RYMdyRtPNio3h7boXxbIB9yx0dPb/l49gJyoj KwEQ== X-Gm-Message-State: AC+VfDw628Za7JW5S/JVeFpK69wzrcBPnhyoKRG5x9UJpNQXbrmMT4f3 liE9dkcfk5y73aS7XSrh3S5lGLl6qL41ES/6rr0= X-Google-Smtp-Source: ACHHUZ5pWpOSrF2NkjCw5VVIV49t+86XyDtGEYYa2TYRwMX3UPbBAcqihP37Yj4GzdcnfJmS5ibq3V8cgavTM4+2Ikc= X-Received: by 2002:a05:6102:3671:b0:426:b1d7:c62f with SMTP id bg17-20020a056102367100b00426b1d7c62fmr13479628vsb.22.1684161679856; Mon, 15 May 2023 07:41:19 -0700 (PDT) MIME-Version: 1.0 References: <20230515114932.244397-1-juzhe.zhong@rivai.ai> <9FFF0823FD8F9416+2023051522375712417518@rivai.ai> In-Reply-To: <9FFF0823FD8F9416+2023051522375712417518@rivai.ai> From: Kito Cheng Date: Mon, 15 May 2023 22:41:08 +0800 Message-ID: Subject: Re: Re: [PATCH] RISC-V: Add rounding mode operand for floating point instructions To: =?UTF-8?B?6ZKf5bGF5ZOy?= Cc: Jeff Law , gcc-patches , "kito.cheng" , palmer , palmer , "rdapp.gcc" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: all sign injection operations (vfsgnjn/ vfsgnj/vfsgnjx and its friends) didn't involve rounding in the operation, so vfneg.v and vfabs.v don't need FRM. On Mon, May 15, 2023 at 10:38=E2=80=AFPM =E9=92=9F=E5=B1=85=E5=93=B2 wrote: > > And what about vfabs ? I guess it also need FRM ? > vfneg/vfabs/vfsgnj/vfsgnj/vfsgnjx > vfneg.v vd,vs =3D vfsgnjn.vv vd,vs,vs > vfabs.v vd,vs =3D vfsgnjx.vv vd,vs,vs > > That's all questions I have, plz double check for me. > Thanks. > > > juzhe.zhong@rivai.ai > > From: Kito Cheng > Date: 2023-05-15 22:22 > To: =E9=92=9F=E5=B1=85=E5=93=B2 > CC: Jeff Law; gcc-patches; kito.cheng; palmer; palmer; rdapp.gcc > Subject: Re: Re: [PATCH] RISC-V: Add rounding mode operand for floating p= oint instructions > > Oh, do you mean vfsqrt7/vfrec7 doesn't have frm, but vfsqrt/vfneg shoul= d have frm. > > Is that rigth? If yes, I am gonna send a patch to fix it immediately. > > Yes, and I also double checked spike implementation :P > > and it seems like you're not committed yet, so let's send V2 :) > > On Mon, May 15, 2023 at 10:12=E2=80=AFPM =E9=92=9F=E5=B1=85=E5=93=B2 wrote: > > > > Oh, do you mean vfsqrt7/vfrec7 doesn't have frm, but vfsqrt/vfneg shoul= d have frm. > > Is that rigth? If yes, I am gonna send a patch to fix it immediately. > > > > > > > > juzhe.zhong@rivai.ai > > > > From: Kito Cheng > > Date: 2023-05-15 22:07 > > To: =E9=92=9F=E5=B1=85=E5=93=B2 > > CC: Jeff Law; gcc-patches; kito.cheng; palmer; palmer; rdapp.gcc > > Subject: Re: Re: [PATCH] RISC-V: Add rounding mode operand for floating= point instructions > > Oh, Craig says vfrsqrt7.v not have frm but vsqrt.v have frm, and > > checked spike that match that. > > > > On Mon, May 15, 2023 at 9:55=E2=80=AFPM =E9=92=9F=E5=B1=85=E5=93=B2 wrote: > > > > > > I don't know why we should not add frm vfsqrt.v since I saw topper (L= LVM maintainer) said we should > > > not add frm into vsqrt.v. Maybe kito knows the reason ? > > > > > > https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/226 > > > > > > > > > > > > > > > juzhe.zhong@rivai.ai > > > > > > From: Jeff Law > > > Date: 2023-05-15 21:52 > > > To: juzhe.zhong; gcc-patches > > > CC: kito.cheng; kito.cheng; palmer; palmer; rdapp.gcc > > > Subject: Re: [PATCH] RISC-V: Add rounding mode operand for floating p= oint instructions > > > > > > > > > On 5/15/23 05:49, juzhe.zhong@rivai.ai wrote: > > > > From: Juzhe-Zhong > > > > > > > > This patch is adding rounding mode operand and FRM_REGNUM dependenc= y > > > > into floating-point instructions. > > > > > > > > The floating-point instructions we added FRM and rounding mode oper= and: > > > > 1. vfadd/vfsub > > > > 2. vfwadd/vfwsub > > > > 3. vfmul > > > > 4. vfdiv > > > > 5. vfwmul > > > > 6. vfwmacc/vfwnmacc/vfwmsac/vfwnmsac > > > > 7. vfsqrt7/vfrec7 > > > > 8. floating-point conversions. > > > > 9. floating-point reductions. > > > > > > > > The floating-point instructions we did NOT add FRM and rounding mod= e operand: > > > > 1. vfsqrt/vfneg > > > Assuming vfsqrt is actually an estimator the best place to handle > > > rounding modes is at the last step(s) after N-R or Goldschmidt > > > refinement steps. I haven't paid too much attention to FP yet, but t= his > > > is an area I've got fairly extensive experience. > > > > > > Sadly RISC-V's estimator is fairly poor and the single instance FMACs > > > are going to result in an implementation that may not actually be any > > > better than what glibc can do. > > > > > > Jeff > > > > > >