"juzhe.zh...@rivai.ai" <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 pick LMUL = 8 (RVVM8SImode)
But is the LMUL decided by the mode? Like Richard says, the vectoriser already provides a way of trying vectorisation with different modes and picking the best one, via autovectorize_vector_modes, VECT_COMPARE_COST, and the cost structures. preferred_simd_mode then just picks the first mode to try -- the choide isn't final. The idea is that you get to see what vectorisation looks like with multiple mode choices, and can pick the best one. It's not clear from your reply whether you've tried that or not. Thanks, Richard