public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] vect: Check that vector factor is a compile-time constant
@ 2023-02-22 15:27 juzhe.zhong
  2023-02-22 17:54 ` Michael Collison
  0 siblings, 1 reply; 23+ messages in thread
From: juzhe.zhong @ 2023-02-22 15:27 UTC (permalink / raw)
  To: gcc-patches
  Cc: kito.cheng, kito.cheng, richard.sandiford, richard.guenther,
	Michael Collison

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

> gcc/
>
>      * tree-vect-loop-manip.cc (vect_do_peeling): Verify
>      that vectorization factor is a compile-time constant.
>
> ---
>   gcc/tree-vect-loop-manip.cc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
> index 6aa3d2ed0bf..1ad1961c788 100644
> --- a/gcc/tree-vect-loop-manip.cc
> +++ b/gcc/tree-vect-loop-manip.cc
> @@ -2930,7 +2930,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree
> niters, tree nitersm1,
>         niters = vect_build_loop_niters (loop_vinfo, &new_var_p);
>         /* It's guaranteed that vector loop bound before vectorization is at
>        least VF, so set range information for newly generated var. */
> -      if (new_var_p)
> +      if (new_var_p && vf.is_constant ())
>       {
>         value_range vr (type,
>                 wi::to_wide (build_int_cst (type, vf)),

I don't think we need to apply this limit in case of RVV auto-vectorization.
I have talked with Kito and I have a full solution of supporting RVV solution.

We are going to support RVV auto-vectorization in 3 configuration according to RVV ISA spec:
1. -march=zve32* support QI and HI auto-vectorization by VNx4QImode and VNx2HImode
2. -march=zve64* support QI and HI and SI auto-vectorization by VNx8QImode and VNx4HImode and VNx2SImode
3. -march=v* support QI and HI and SI and DI auto-vectorization by VNx16QImode and VNx8HImode and VNx4SImode and VNx2DImode

I will support them in GCC 14. Current loop vectorizer works well for us no need to fix it. 
Thanks.


juzhe.zhong@rivai.ai

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [PATCH] vect: Check that vector factor is a compile-time constant
@ 2023-02-21 23:02 Michael Collison
  2023-02-22  8:20 ` Richard Biener
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Collison @ 2023-02-21 23:02 UTC (permalink / raw)
  To: gcc-patches

While working on autovectorizing for the RISCV port I encountered an 
issue where vect_do_peeling assumes that the vectorization factor is a 
compile-time constant. The vectorization is not a compile-time constant 
on RISCV.

Tested on RISCV and x86_64-linux-gnu. Okay?

Michael

gcc/

     * tree-vect-loop-manip.cc (vect_do_peeling): Verify
     that vectorization factor is a compile-time constant.

---
  gcc/tree-vect-loop-manip.cc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 6aa3d2ed0bf..1ad1961c788 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -2930,7 +2930,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree 
niters, tree nitersm1,
        niters = vect_build_loop_niters (loop_vinfo, &new_var_p);
        /* It's guaranteed that vector loop bound before vectorization is at
       least VF, so set range information for newly generated var. */
-      if (new_var_p)
+      if (new_var_p && vf.is_constant ())
      {
        value_range vr (type,
                wi::to_wide (build_int_cst (type, vf)),
-- 
2.34.1


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

end of thread, other threads:[~2023-03-25 22:45 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 15:27 [PATCH] vect: Check that vector factor is a compile-time constant juzhe.zhong
2023-02-22 17:54 ` Michael Collison
2023-02-22 23:43   ` juzhe.zhong
2023-02-22 23:47   ` juzhe.zhong
2023-02-23  4:01   ` Jeff Law
2023-02-23  4:25     ` juzhe.zhong
2023-02-23  4:50     ` Michael Collison
2023-02-24  3:34       ` Jeff Law
2023-02-24  4:04         ` Kito Cheng
2023-03-14 17:48           ` Jeff Law
2023-03-17 16:57             ` Palmer Dabbelt
2023-03-17 16:57               ` Palmer Dabbelt
2023-03-21  2:02               ` juzhe.zhong
2023-03-23 23:18               ` Jeff Law
2023-03-24  2:28                 ` Palmer Dabbelt
2023-03-25 22:45                   ` Jeff Law
  -- strict thread matches above, loose matches on Subject: below --
2023-02-21 23:02 Michael Collison
2023-02-22  8:20 ` Richard Biener
2023-02-22 16:42   ` Michael Collison
2023-02-23  9:08     ` Richard Biener
2023-02-27 14:51   ` Richard Sandiford
2023-03-01 21:00     ` Michael Collison
2023-03-02  7:56       ` Richard Biener

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