Re: Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread Richard Biener via Gcc
t; vadd.vv v4,v4,v8 > > sub a2,a2,a5 > > vsetvli zero,a5,e32,m4,ta,ma > > vse32.v v4,0(a4) > > add a0,a0,a3 > > add a1,a1,a3 > > add a4,a4,a3 > > bne a2,zero,.L3 > > > > Fantastic architecture of GCC Vector Cost model! > > > > Th

Re: Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread juzhe.zh...@rivai.ai
Biener Date: 2023-08-31 19:29 To: juzhe.zh...@rivai.ai CC: gcc; richard.sandiford Subject: Re: Re: Question about dynamic choosing vectorization factor for RVV On Thu, 31 Aug 2023, juzhe.zh...@rivai.ai wrote: > Hi. Thanks Richard and Richi. > > Now, I figure out how to choose sma

Re: Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread juzhe.zh...@rivai.ai
; > vse32.v v4,0(a0) > > .L12: > > ret > > .L7: > > li a2,0 > > j .L3 > > .L14: > > ret > > > > I hope it can generate the code like this: > > > > foo: > > ble a2,zero,.L5 > > mv a4,a0 > > .L3: > > vsetvli a5,a2,e3

Re: Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread Richard Biener via Gcc
,v4,v8 > sub a2,a2,a5 > vsetvli zero,a5,e32,m4,ta,ma > vse32.v v4,0(a4) > add a0,a0,a3 > add a1,a1,a3 > add a4,a4,a3 > bne a2,zero,.L3 > > Fantastic architecture of GCC Vector Cost model! > > Thanks a lot. > > > juzhe.zh...@rivai.ai > > From: Richard Bi

Re: Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread juzhe.zh...@rivai.ai
diford Subject: Re: Re: Question about dynamic choosing vectorization factor for RVV On Thu, 31 Aug 2023, juzhe.zh...@rivai.ai wrote: > Thanks Richi. > > I am trying to figure out how to adjust finish_cost to lower the LMUL > > For example: > > void > foo (int32_t *__res

Re: Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread Richard Biener via Gcc
v v4,0(a4) > add a0,a0,a3 > add a1,a1,a3 > add a4,a4,a3 > bne a2,zero,.L3 > .L5: > ret > > I am experimenting whether we can adjust cost statically to make loop > vectorizer use LMUL = 4 even though preferred_simd_mode return LMUL = 8. > If we can do that, I think we can ap

Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread Richard Sandiford via Gcc
"juzhe.zh...@rivai.ai" writes: > Thanks Richi. > > I am trying to figure out how to adjust finish_cost to lower the LMUL > > For example: > > void > foo (int32_t *__restrict a, int32_t *__restrict b, int n) > { > for (int i = 0; i < n; i++) > a[i] = a[i] + b[i]; > } > > preferred_simd_mode p

Re: Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread juzhe.zh...@rivai.ai
though preferred_simd_mode return LMUL = 8. If we can do that, I think we can apply analysis and then adjust the cost according to analysis. Thanks. juzhe.zh...@rivai.ai From: Richard Biener Date: 2023-08-31 15:38 To: juzhe.zh...@rivai.ai CC: gcc; richard.sandiford Subject: Re: Question about dynamic ch

Re: Question about dynamic choosing vectorization factor for RVV

2023-08-31 Thread Richard Biener via Gcc
On Thu, 31 Aug 2023, juzhe.zh...@rivai.ai wrote: > Hi, Richard and Richi. > > Currently, we are statically returning vectorization factor in > 'TARGET_VECTORIZE_PREFERRED_SIMD_MODE' > according to compile option. > > For example: > void > foo (int32_t *__restrict a, int32_t *__restrict b, int n

Question about dynamic choosing vectorization factor for RVV

2023-08-30 Thread juzhe.zh...@rivai.ai
Hi, Richard and Richi. Currently, we are statically returning vectorization factor in 'TARGET_VECTORIZE_PREFERRED_SIMD_MODE' according to compile option. For example: void foo (int32_t *__restrict a, int32_t *__restrict b, int n) { for (int i = 0; i < n; i++) a[i] = a[i] + b[i]; } with --