public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] test: Isolate slp-1.c check of target supports vect_strided5
@ 2023-09-15  9:16 Juzhe-Zhong
  2023-09-15  9:38 ` Richard Biener
  2023-10-06 14:29 ` Andrew Stubbs
  0 siblings, 2 replies; 6+ messages in thread
From: Juzhe-Zhong @ 2023-09-15  9:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: rguenther, jeffreyalaw, richard.sandiford, Juzhe-Zhong

This test failed in RISC-V:
FAIL: gcc.dg/vect/slp-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorizing stmts using SLP" 4
FAIL: gcc.dg/vect/slp-1.c scan-tree-dump-times vect "vectorizing stmts using SLP" 4

Because this loop:
  /* SLP with unrolling by 8.  */
  for (i = 0; i < N; i++)
    {
      out[i*5] = 8;
      out[i*5 + 1] = 7;
      out[i*5 + 2] = 81;
      out[i*5 + 3] = 28;
      out[i*5 + 4] = 18;
    }

is using vect_load_lanes with array size = 5.
instead of SLP.

When we adjust the COST of LANES load store, then it will use SLP.

gcc/testsuite/ChangeLog:

	* gcc.dg/vect/slp-1.c: Add vect_stried5.

---
 gcc/testsuite/gcc.dg/vect/slp-1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/vect/slp-1.c b/gcc/testsuite/gcc.dg/vect/slp-1.c
index 82e4f6469fb..d4a13f12df6 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-1.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-1.c
@@ -122,5 +122,5 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect"  } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
-  
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target {! vect_strided5 } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_strided5 } } } */
-- 
2.36.3


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

* Re: [PATCH] test: Isolate slp-1.c check of target supports vect_strided5
  2023-09-15  9:16 [PATCH] test: Isolate slp-1.c check of target supports vect_strided5 Juzhe-Zhong
@ 2023-09-15  9:38 ` Richard Biener
  2023-09-15 11:07   ` Li, Pan2
  2023-10-06 14:29 ` Andrew Stubbs
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Biener @ 2023-09-15  9:38 UTC (permalink / raw)
  To: Juzhe-Zhong; +Cc: gcc-patches, jeffreyalaw, richard.sandiford

On Fri, 15 Sep 2023, Juzhe-Zhong wrote:

> This test failed in RISC-V:
> FAIL: gcc.dg/vect/slp-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorizing stmts using SLP" 4
> FAIL: gcc.dg/vect/slp-1.c scan-tree-dump-times vect "vectorizing stmts using SLP" 4
> 
> Because this loop:
>   /* SLP with unrolling by 8.  */
>   for (i = 0; i < N; i++)
>     {
>       out[i*5] = 8;
>       out[i*5 + 1] = 7;
>       out[i*5 + 2] = 81;
>       out[i*5 + 3] = 28;
>       out[i*5 + 4] = 18;
>     }
> 
> is using vect_load_lanes with array size = 5.
> instead of SLP.
> 
> When we adjust the COST of LANES load store, then it will use SLP.

OK.

> gcc/testsuite/ChangeLog:
> 
> 	* gcc.dg/vect/slp-1.c: Add vect_stried5.
> 
> ---
>  gcc/testsuite/gcc.dg/vect/slp-1.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/vect/slp-1.c b/gcc/testsuite/gcc.dg/vect/slp-1.c
> index 82e4f6469fb..d4a13f12df6 100644
> --- a/gcc/testsuite/gcc.dg/vect/slp-1.c
> +++ b/gcc/testsuite/gcc.dg/vect/slp-1.c
> @@ -122,5 +122,5 @@ int main (void)
>  }
>  
>  /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect"  } } */
> -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
> -  
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target {! vect_strided5 } } } } */
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_strided5 } } } */
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

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

* RE: [PATCH] test: Isolate slp-1.c check of target supports vect_strided5
  2023-09-15  9:38 ` Richard Biener
@ 2023-09-15 11:07   ` Li, Pan2
  0 siblings, 0 replies; 6+ messages in thread
From: Li, Pan2 @ 2023-09-15 11:07 UTC (permalink / raw)
  To: Richard Biener, Juzhe-Zhong; +Cc: gcc-patches, jeffreyalaw, richard.sandiford

Committed, thanks Richard.

Pan

-----Original Message-----
From: Gcc-patches <gcc-patches-bounces+pan2.li=intel.com@gcc.gnu.org> On Behalf Of Richard Biener via Gcc-patches
Sent: Friday, September 15, 2023 5:38 PM
To: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Cc: gcc-patches@gcc.gnu.org; jeffreyalaw@gmail.com; richard.sandiford@arm.com
Subject: Re: [PATCH] test: Isolate slp-1.c check of target supports vect_strided5

On Fri, 15 Sep 2023, Juzhe-Zhong wrote:

> This test failed in RISC-V:
> FAIL: gcc.dg/vect/slp-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorizing stmts using SLP" 4
> FAIL: gcc.dg/vect/slp-1.c scan-tree-dump-times vect "vectorizing stmts using SLP" 4
> 
> Because this loop:
>   /* SLP with unrolling by 8.  */
>   for (i = 0; i < N; i++)
>     {
>       out[i*5] = 8;
>       out[i*5 + 1] = 7;
>       out[i*5 + 2] = 81;
>       out[i*5 + 3] = 28;
>       out[i*5 + 4] = 18;
>     }
> 
> is using vect_load_lanes with array size = 5.
> instead of SLP.
> 
> When we adjust the COST of LANES load store, then it will use SLP.

OK.

> gcc/testsuite/ChangeLog:
> 
> 	* gcc.dg/vect/slp-1.c: Add vect_stried5.
> 
> ---
>  gcc/testsuite/gcc.dg/vect/slp-1.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/vect/slp-1.c b/gcc/testsuite/gcc.dg/vect/slp-1.c
> index 82e4f6469fb..d4a13f12df6 100644
> --- a/gcc/testsuite/gcc.dg/vect/slp-1.c
> +++ b/gcc/testsuite/gcc.dg/vect/slp-1.c
> @@ -122,5 +122,5 @@ int main (void)
>  }
>  
>  /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect"  } } */
> -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
> -  
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target {! vect_strided5 } } } } */
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_strided5 } } } */
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

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

* Re: [PATCH] test: Isolate slp-1.c check of target supports vect_strided5
  2023-09-15  9:16 [PATCH] test: Isolate slp-1.c check of target supports vect_strided5 Juzhe-Zhong
  2023-09-15  9:38 ` Richard Biener
@ 2023-10-06 14:29 ` Andrew Stubbs
  2023-10-07  1:04   ` juzhe.zhong
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Stubbs @ 2023-10-06 14:29 UTC (permalink / raw)
  To: Juzhe-Zhong, gcc-patches; +Cc: rguenther, jeffreyalaw, richard.sandiford

On 15/09/2023 10:16, Juzhe-Zhong wrote:
> This test failed in RISC-V:
> FAIL: gcc.dg/vect/slp-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorizing stmts using SLP" 4
> FAIL: gcc.dg/vect/slp-1.c scan-tree-dump-times vect "vectorizing stmts using SLP" 4
> 
> Because this loop:
>    /* SLP with unrolling by 8.  */
>    for (i = 0; i < N; i++)
>      {
>        out[i*5] = 8;
>        out[i*5 + 1] = 7;
>        out[i*5 + 2] = 81;
>        out[i*5 + 3] = 28;
>        out[i*5 + 4] = 18;
>      }
> 
> is using vect_load_lanes with array size = 5.
> instead of SLP.
> 
> When we adjust the COST of LANES load store, then it will use SLP.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.dg/vect/slp-1.c: Add vect_stried5.
> 
> ---
>   gcc/testsuite/gcc.dg/vect/slp-1.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/vect/slp-1.c b/gcc/testsuite/gcc.dg/vect/slp-1.c
> index 82e4f6469fb..d4a13f12df6 100644
> --- a/gcc/testsuite/gcc.dg/vect/slp-1.c
> +++ b/gcc/testsuite/gcc.dg/vect/slp-1.c
> @@ -122,5 +122,5 @@ int main (void)
>   }
>   
>   /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect"  } } */
> -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
> -
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target {! vect_strided5 } } } } */
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_strided5 } } } */

This patch causes a test regression on amdgcn because vect_strided5 is 
true (because check_effective_target_vect_fully_masked is true), but the 
testcase still gives the message 4 times. Perhaps because amdgcn uses 
masking and not vect_load_lanes?

Andrew

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

* Re: Re: [PATCH] test: Isolate slp-1.c check of target supports vect_strided5
  2023-10-06 14:29 ` Andrew Stubbs
@ 2023-10-07  1:04   ` juzhe.zhong
  2023-10-09  9:27     ` Andrew Stubbs
  0 siblings, 1 reply; 6+ messages in thread
From: juzhe.zhong @ 2023-10-07  1:04 UTC (permalink / raw)
  To: ams, gcc-patches; +Cc: rguenther, jeffreyalaw, richard.sandiford

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

Thanks for reporting it.

I think we may need to change it into:
+ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target {! vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_strided5 && vect_load_lanes } } } */

Could you verify it whether it work for you ?

Thanks.


juzhe.zhong@rivai.ai
 
From: Andrew Stubbs
Date: 2023-10-06 22:29
To: Juzhe-Zhong; gcc-patches@gcc.gnu.org
CC: rguenther@suse.de; jeffreyalaw@gmail.com; richard.sandiford@arm.com
Subject: Re: [PATCH] test: Isolate slp-1.c check of target supports vect_strided5
On 15/09/2023 10:16, Juzhe-Zhong wrote:
> This test failed in RISC-V:
> FAIL: gcc.dg/vect/slp-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorizing stmts using SLP" 4
> FAIL: gcc.dg/vect/slp-1.c scan-tree-dump-times vect "vectorizing stmts using SLP" 4
> 
> Because this loop:
>    /* SLP with unrolling by 8.  */
>    for (i = 0; i < N; i++)
>      {
>        out[i*5] = 8;
>        out[i*5 + 1] = 7;
>        out[i*5 + 2] = 81;
>        out[i*5 + 3] = 28;
>        out[i*5 + 4] = 18;
>      }
> 
> is using vect_load_lanes with array size = 5.
> instead of SLP.
> 
> When we adjust the COST of LANES load store, then it will use SLP.
> 
> gcc/testsuite/ChangeLog:
> 
> * gcc.dg/vect/slp-1.c: Add vect_stried5.
> 
> ---
>   gcc/testsuite/gcc.dg/vect/slp-1.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/vect/slp-1.c b/gcc/testsuite/gcc.dg/vect/slp-1.c
> index 82e4f6469fb..d4a13f12df6 100644
> --- a/gcc/testsuite/gcc.dg/vect/slp-1.c
> +++ b/gcc/testsuite/gcc.dg/vect/slp-1.c
> @@ -122,5 +122,5 @@ int main (void)
>   }
>   
>   /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect"  } } */
> -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
> -
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target {! vect_strided5 } } } } */
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_strided5 } } } */
 
This patch causes a test regression on amdgcn because vect_strided5 is 
true (because check_effective_target_vect_fully_masked is true), but the 
testcase still gives the message 4 times. Perhaps because amdgcn uses 
masking and not vect_load_lanes?
 
Andrew
 

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

* Re: [PATCH] test: Isolate slp-1.c check of target supports vect_strided5
  2023-10-07  1:04   ` juzhe.zhong
@ 2023-10-09  9:27     ` Andrew Stubbs
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Stubbs @ 2023-10-09  9:27 UTC (permalink / raw)
  To: juzhe.zhong, gcc-patches; +Cc: rguenther, jeffreyalaw, richard.sandiford

On 07/10/2023 02:04, juzhe.zhong@rivai.ai wrote:
> Thanks for reporting it.
> 
> I think we may need to change it into:
> + /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 
> "vect" { target {! vect_load_lanes } } } } */
> +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 
> "vect" { target vect_strided5 && vect_load_lanes } } } */
> 
> Could you verify it whether it work for you ?

You need an additional set of curly braces in the second line to avoid a 
syntax error message, but I get a pass with that change.

Thanks

Andrew

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

end of thread, other threads:[~2023-10-09  9:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15  9:16 [PATCH] test: Isolate slp-1.c check of target supports vect_strided5 Juzhe-Zhong
2023-09-15  9:38 ` Richard Biener
2023-09-15 11:07   ` Li, Pan2
2023-10-06 14:29 ` Andrew Stubbs
2023-10-07  1:04   ` juzhe.zhong
2023-10-09  9:27     ` Andrew Stubbs

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