public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Lehua Ding" <lehua.ding@rivai.ai>
To: "Jeff Law" <jeffreyalaw@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "juzhe.zhong" <juzhe.zhong@rivai.ai>,
	"kito.cheng" <kito.cheng@gmail.com>,
	"rdapp.gcc" <rdapp.gcc@gmail.com>, palmer <palmer@rivosinc.com>
Subject: Re: [PATCH] RISC-V: Revert the convert from vmv.s.x to vmv.v.i
Date: Fri, 11 Aug 2023 23:43:32 +0800	[thread overview]
Message-ID: <2A2BF09C15AEBD43+tencent_C5EBE2190BE4F3FA9E5D56CE5EBBF88FA607@qq.com> (raw)
In-Reply-To: <d80dd447-92fe-ecda-b60f-e9a1a085967f@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3235 bytes --]

&gt; I can't speak for other uarches, but as a guiding principle for Ventana
&gt; we're assuming vsetvl instructions are common and as a result need to be
&gt; very cheap in hardware.&nbsp;&nbsp; It's likely a good tradeoff for us.


&gt; I could see other uarches making different design choices though.&nbsp; So at
&gt; a high level, do we want this to be driven by cost modeling in some way?

&gt; Not a review yet.&nbsp; Wanted to get that feedback to you now since the rest
&gt; of my day is going to be fairly busy.


Thanks for the feedback.&nbsp;We'll think about it some more.
Just out of curiosity,&nbsp;will the combination of vsetvli + vmv.v.x perform
better than li + vmv.s.x on&nbsp;Ventana's CPU?&nbsp;




------------------&nbsp;Original&nbsp;------------------
From:                                                                                                                        "Jeff Law"                                                                                    <gcc-patches@gcc.gnu.org&gt;;
Date:&nbsp;Fri, Aug 11, 2023 11:04 PM
To:&nbsp;"Lehua Ding"<lehua.ding@rivai.ai&gt;;"gcc-patches"<gcc-patches@gcc.gnu.org&gt;;
Cc:&nbsp;"juzhe.zhong"<juzhe.zhong@rivai.ai&gt;;"kito.cheng"<kito.cheng@gmail.com&gt;;"rdapp.gcc"<rdapp.gcc@gmail.com&gt;;"palmer"<palmer@rivosinc.com&gt;;
Subject:&nbsp;Re: [PATCH] RISC-V: Revert the convert from vmv.s.x to vmv.v.i



On 8/11/23 03:01, Lehua Ding wrote:
&gt; Hi,
&gt; 
&gt; This patch revert the convert from vmv.s.x to vmv.v.i and add new pattern
&gt; optimize the special case when the scalar operand is zero.
&gt; 
&gt; Currently, the broadcast pattern where the scalar operand is a imm
&gt; will be converted to vmv.v.i from vmv.s.x and the mask operand will be
&gt; converted from 00..01 to 11..11. There are some advantages and
&gt; disadvantages before and after the conversion after discussing
&gt; with Juzhe offline and we chose not to do this transform.
&gt; 
&gt; Before:
&gt; 
&gt;&nbsp;&nbsp;&nbsp; Advantages: The vsetvli info required by vmv.s.x has better compatibility since
&gt;&nbsp;&nbsp;&nbsp; vmv.s.x only required SEW and VLEN be zero or one. That mean there
&gt;&nbsp;&nbsp;&nbsp; is more opportunities to combine with other vsetlv infos in vsetvl pass.
&gt; 
&gt;&nbsp;&nbsp;&nbsp; Disadvantages: For non-zero scalar imm, one more `li rd, imm` instruction
&gt;&nbsp;&nbsp;&nbsp; will be needed.
&gt; 
&gt; After:
&gt; 
&gt;&nbsp;&nbsp;&nbsp; Advantages: No need `li rd, imm` instruction since vmv.v.i support imm operand.
&gt; 
&gt;&nbsp;&nbsp;&nbsp; Disadvantages: Like before's advantages. Worse compatibility leads to more
&gt;&nbsp;&nbsp;&nbsp; vsetvl instrunctions need.
I can't speak for other uarches, but as a guiding principle for Ventana 
we're assuming vsetvl instructions are common and as a result need to be 
very cheap in hardware.&nbsp;&nbsp; It's likely a good tradeoff for us.

I could see other uarches making different design choices though.&nbsp; So at 
a high level, do we want this to be driven by cost modeling in some way?

Not a review yet.&nbsp; Wanted to get that feedback to you now since the rest 
of my day is going to be fairly busy.

jeff

  reply	other threads:[~2023-08-11 15:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11  9:01 Lehua Ding
2023-08-11 15:04 ` Jeff Law
2023-08-11 15:43   ` Lehua Ding [this message]
2023-08-11 15:48     ` Jeff Law
2023-08-11 23:02 ` Jeff Law
2023-08-12  4:09   ` Lehua Ding
2024-02-20  4:15 Alexandre Oliva
2024-02-23  7:37 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2A2BF09C15AEBD43+tencent_C5EBE2190BE4F3FA9E5D56CE5EBBF88FA607@qq.com \
    --to=lehua.ding@rivai.ai \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@rivosinc.com \
    --cc=rdapp.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).