public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: RISC-V: Support XTheadVector extensions
  2023-11-17 11:39 juzhe.zhong
@ 2023-11-17 17:11 Palmer Dabbelt
  2023-11-17 23:16 ` 钟居哲
  0 siblings, 1 reply; 13+ messages in thread
From: Palmer Dabbelt @ 2023-11-17 17:11 UTC (permalink / raw)
  To: juzhe.zhong
  Cc: gcc-patches, Kito Cheng, kito.cheng, cooper.joshua, rdapp.gcc,
	jeffreyalaw

On Fri, 17 Nov 2023 03:39:48 PST (-0800), juzhe.zhong@rivai.ai wrote:
> 90% theadvector extension reusing current RVV 1.0 instructions patterns:
> Just change ASM, For example:
> 
> @@ -2923,7 +2923,7 @@ (define_insn "*pred_mulh<v_su><mode>_scalar"
>  	     (match_operand:VFULLI_D 3 "register_operand"  "vr,vr, vr, vr")] VMULH)
>  	  (match_operand:VFULLI_D 2 "vector_merge_operand" "vu, 0, vu,  0")))]
>    "TARGET_VECTOR"
> -  "vmulh<v_su>.vx\t%0,%3,%z4%p1"
> +  "%^vmulh<v_su>.vx\t%0,%3,%z4%p1"
>    [(set_attr "type" "vimul")
>     (set_attr "mode" "<MODE>")])
> +  if (letter == '^')
> +    {
> +      if (TARGET_XTHEADVECTOR)
> +	fputs ("th.", file);
> +      return;
> +    }
> 
> For almost all patterns, you just simply append "th." in the ASM prefix.
> like change "vmulh.vv" -> "th.vmulh.vv"
> 
> Almost all theadvector instructions are not new features,  all same as RVV1.0.
> Why do you invent the such ISA doesn't include any features that RVV1.0 doesn't satisfy ?
> 
> I am not explicitly object this patch. But I should know the reason.

There's some more in the later threads, but with the top posting it kind 
of got lost so I'm just replying here.

This really isn't T-Head's fault: we announced V-0.7 as a stable draft 
that was being implemented, and then T-Head went and implemented it.  
Most of that history has been scrubbed by RVI, but you can still find 
some stuff like this old talk on YouTube 
<https://www.youtube.com/watch?v=F66F1nT1T8o>.

In general we've just figured out a way to make things work when HW 
vendors end up in a grey area in RISC-V land.  That obviously results in 
a bunch of pain for the SW people, but this stuff is only useful if we 
can run on real HW and that always involves some amount of pain.  
Hopefully we can get to a point where we make fewer problems for 
ourselves, but we've got a long history to dig out from and there's 
going to be a lot more of this in the future.

So I don't like this XTHeadV stuff, but I think we're best to take it: 
these guys tried to do the right thing and got thrown under the bus by 
RVI, we should help them.  This is almost certainly going to be a lot 
more pain that we're used to, just given the size of the extensions in 
question, but I still think it's the right  way to go.

The other option is to essentially just tell them to fork the ISA, which 
isn't good for anyone.

> Btw, stage 1 will close soon.  So I will review this patch on GCC-15 as long as all other RISC-V maintainers agree.

I agree this is gcc-15 material: there's a lot of subtle differences in 
behavior between 0.7 and 1.0, even when the mnemonics are the same.  
We're already pretty buried in testing for 14, so trying to pick up 
another target is going to be a huge headache (particularly one that's a 
bit special).

> 
> 
> 
> 
> juzhe.zhong@rivai.ai

^ permalink raw reply	[flat|nested] 13+ messages in thread
* RISC-V: Support XTheadVector extensions
@ 2023-11-17 11:39 juzhe.zhong
  2023-11-17 16:47 ` Jeff Law
  0 siblings, 1 reply; 13+ messages in thread
From: juzhe.zhong @ 2023-11-17 11:39 UTC (permalink / raw)
  To: gcc-patches
  Cc: kito.cheng, kito.cheng, cooper.joshua, Robin Dapp, jeffreyalaw

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

90% theadvector extension reusing current RVV 1.0 instructions patterns:
Just change ASM, For example:

@@ -2923,7 +2923,7 @@ (define_insn "*pred_mulh<v_su><mode>_scalar"
 	     (match_operand:VFULLI_D 3 "register_operand"  "vr,vr, vr, vr")] VMULH)
 	  (match_operand:VFULLI_D 2 "vector_merge_operand" "vu, 0, vu,  0")))]
   "TARGET_VECTOR"
-  "vmulh<v_su>.vx\t%0,%3,%z4%p1"
+  "%^vmulh<v_su>.vx\t%0,%3,%z4%p1"
   [(set_attr "type" "vimul")
    (set_attr "mode" "<MODE>")])
+  if (letter == '^')
+    {
+      if (TARGET_XTHEADVECTOR)
+	fputs ("th.", file);
+      return;
+    }

For almost all patterns, you just simply append "th." in the ASM prefix.
like change "vmulh.vv" -> "th.vmulh.vv"

Almost all theadvector instructions are not new features,  all same as RVV1.0.
Why do you invent the such ISA doesn't include any features that RVV1.0 doesn't satisfy ?

I am not explicitly object this patch. But I should know the reason.

Btw, stage 1 will close soon.  So I will review this patch on GCC-15 as long as all other RISC-V maintainers agree.




juzhe.zhong@rivai.ai

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-11-22 23:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <202311171939484236058@rivai.ai>
2023-11-17 13:41 ` RISC-V: Support XTheadVector extensions juzhe.zhong
2023-11-22 10:07   ` Christoph Müllner
2023-11-22 13:52     ` 钟居哲
2023-11-22 14:24       ` Christoph Müllner
2023-11-22 22:27         ` Jeff Law
2023-11-22 22:40           ` 钟居哲
2023-11-22 22:48           ` Kito Cheng
2023-11-22 23:37             ` Christoph Müllner
2023-11-17 17:11 Palmer Dabbelt
2023-11-17 23:16 ` 钟居哲
2023-11-18  0:01   ` Jeff Law
2023-11-18  0:04     ` 钟居哲
  -- strict thread matches above, loose matches on Subject: below --
2023-11-17 11:39 juzhe.zhong
2023-11-17 16:47 ` Jeff Law
2023-11-18  9:45   ` Philipp Tomsich
2023-11-18 10:32     ` Kito Cheng
2023-11-18 15:16       ` 钟居哲
2023-11-20  3:04       ` juzhe.zhong
2023-11-20 16:58         ` Jason Kridner

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).