public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Increase cost of vector aligned store/load.
@ 2023-11-16  8:44 Jiahao Xu
  2023-11-17  2:21 ` [pushed][PATCH] " chenglulu
  0 siblings, 1 reply; 4+ messages in thread
From: Jiahao Xu @ 2023-11-16  8:44 UTC (permalink / raw)
  To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Jiahao Xu

Based on SPEC2017 performance evaluation results, it's better to make them equal
to the cost of unaligned store/load so as to avoid odd alignment peeling.

gcc/ChangeLog:

	* config/loongarch/loongarch.cc
	(loongarch_builtin_vectorization_cost): Adjust.

diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index 738911661d7..d05743bec87 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -3893,11 +3893,9 @@ loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
       case scalar_stmt:
       case scalar_load:
       case vector_stmt:
-      case vector_load:
       case vec_to_scalar:
       case scalar_to_vec:
       case scalar_store:
-      case vector_store:
 	return 1;
 
       case vec_promote_demote:
@@ -3905,6 +3903,8 @@ loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
 	return LASX_SUPPORTED_MODE_P (mode)
 	  && !LSX_SUPPORTED_MODE_P (mode) ? 2 : 1;
 
+      case vector_load:
+      case vector_store:
       case unaligned_load:
       case unaligned_store:
 	return 2;
-- 
2.20.1


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

* Re: [pushed][PATCH] LoongArch: Increase cost of vector aligned store/load.
  2023-11-16  8:44 [PATCH] LoongArch: Increase cost of vector aligned store/load Jiahao Xu
@ 2023-11-17  2:21 ` chenglulu
  2023-11-18 18:25   ` Xi Ruoyao
  0 siblings, 1 reply; 4+ messages in thread
From: chenglulu @ 2023-11-17  2:21 UTC (permalink / raw)
  To: Jiahao Xu, gcc-patches; +Cc: xry111, i, xuchenghua

Pushed to r14-5545.

在 2023/11/16 下午4:44, Jiahao Xu 写道:
> Based on SPEC2017 performance evaluation results, it's better to make them equal
> to the cost of unaligned store/load so as to avoid odd alignment peeling.
>
> gcc/ChangeLog:
>
> 	* config/loongarch/loongarch.cc
> 	(loongarch_builtin_vectorization_cost): Adjust.
>
> diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
> index 738911661d7..d05743bec87 100644
> --- a/gcc/config/loongarch/loongarch.cc
> +++ b/gcc/config/loongarch/loongarch.cc
> @@ -3893,11 +3893,9 @@ loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
>         case scalar_stmt:
>         case scalar_load:
>         case vector_stmt:
> -      case vector_load:
>         case vec_to_scalar:
>         case scalar_to_vec:
>         case scalar_store:
> -      case vector_store:
>   	return 1;
>   
>         case vec_promote_demote:
> @@ -3905,6 +3903,8 @@ loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
>   	return LASX_SUPPORTED_MODE_P (mode)
>   	  && !LSX_SUPPORTED_MODE_P (mode) ? 2 : 1;
>   
> +      case vector_load:
> +      case vector_store:
>         case unaligned_load:
>         case unaligned_store:
>   	return 2;


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

* Re: [pushed][PATCH] LoongArch: Increase cost of vector aligned store/load.
  2023-11-17  2:21 ` [pushed][PATCH] " chenglulu
@ 2023-11-18 18:25   ` Xi Ruoyao
  2023-11-23  8:11     ` Jiahao Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Xi Ruoyao @ 2023-11-18 18:25 UTC (permalink / raw)
  To: chenglulu, Jiahao Xu, gcc-patches; +Cc: i, xuchenghua

On Fri, 2023-11-17 at 10:21 +0800, chenglulu wrote:
> Pushed to r14-5545.
> 
> 在 2023/11/16 下午4:44, Jiahao Xu 写道:
> > Based on SPEC2017 performance evaluation results, it's better to make them equal
> > to the cost of unaligned store/load so as to avoid odd alignment peeling.
> > 
> > gcc/ChangeLog:
> > 
> > 	* config/loongarch/loongarch.cc
> > 	(loongarch_builtin_vectorization_cost): Adjust.

/* snip */

> > +      case vector_load:
> > +      case vector_store:
> >         case unaligned_load:
> >         case unaligned_store:
> >   	return 2;

It seems penalizing the vectorizing and causes:

FAIL: gcc.target/loongarch/vector/lasx/lasx-xvstelm.c  -mlasx  scan-assembler-times xvstelm.w 8

Maybe we can make unaligned_load and unaligned_store cost 1 too instead
of increasing vector_load and vector_store?

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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

* Re: [pushed][PATCH] LoongArch: Increase cost of vector aligned store/load.
  2023-11-18 18:25   ` Xi Ruoyao
@ 2023-11-23  8:11     ` Jiahao Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Jiahao Xu @ 2023-11-23  8:11 UTC (permalink / raw)
  To: Xi Ruoyao, chenglulu, gcc-patches; +Cc: i, xuchenghua


在 2023/11/19 上午2:25, Xi Ruoyao 写道:
> On Fri, 2023-11-17 at 10:21 +0800, chenglulu wrote:
>> Pushed to r14-5545.
>>
>> 在 2023/11/16 下午4:44, Jiahao Xu 写道:
>>> Based on SPEC2017 performance evaluation results, it's better to make them equal
>>> to the cost of unaligned store/load so as to avoid odd alignment peeling.
>>>
>>> gcc/ChangeLog:
>>>
>>> 	* config/loongarch/loongarch.cc
>>> 	(loongarch_builtin_vectorization_cost): Adjust.
> /* snip */
>
>>> +      case vector_load:
>>> +      case vector_store:
>>>          case unaligned_load:
>>>          case unaligned_store:
>>>    	return 2;
> It seems penalizing the vectorizing and causes:
>
> FAIL: gcc.target/loongarch/vector/lasx/lasx-xvstelm.c  -mlasx  scan-assembler-times xvstelm.w 8
>
> Maybe we can make unaligned_load and unaligned_store cost 1 too instead
> of increasing vector_load and vector_store?
>
If make the cost of unaligned_load and unaligned_store cost 1 too, it 
will result in a 1.5% overall performance decrease in SPEC CPU 2017 
fprate on 3A6000. Therefore, I don't think it's a good idea. The 
lasx-xvstelm.c file tests whether the vec_extract operation and fst can 
be combined into xvstelm.I think it would be better to add a compilation 
option, such as "-fno-vect-cost-model," to make it unaffected by the 
cost model.


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16  8:44 [PATCH] LoongArch: Increase cost of vector aligned store/load Jiahao Xu
2023-11-17  2:21 ` [pushed][PATCH] " chenglulu
2023-11-18 18:25   ` Xi Ruoyao
2023-11-23  8:11     ` Jiahao Xu

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