[PATCH] RISC-V: Support TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT to optimize codegen of RVV auto-vectorization

juzhe.zhong@rivai.ai juzhe.zhong@rivai.ai
Mon May 15 03:17:12 GMT 2023


Hi, address comment and send V2 patch here:
https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618477.html 

Thanks.


juzhe.zhong@rivai.ai
 
From: Kito Cheng
Date: 2023-05-15 10:56
To: juzhe.zhong@rivai.ai
CC: gcc-patches; palmer; Robin Dapp; jeffreyalaw
Subject: Re: Re: [PATCH] RISC-V: Support TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT to optimize codegen of RVV auto-vectorization
On Mon, May 15, 2023 at 10:48 AM juzhe.zhong@rivai.ai
<juzhe.zhong@rivai.ai> wrote:
>
> Oh, I see. I try this way:
> static poly_uint64
> riscv_vectorize_preferred_vector_alignment (const_tree type)
> {
>   if (riscv_v_ext_vector_mode_p (TYPE_MODE (type)))
>     return TYPE_ALIGN (TREE_TYPE (type));
>   return TYPE_ALIGN (type);
> }
>
> And disable both TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
> and TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
>
> Both VLA and VLS works well after the testing of align-1.c && align-2.c
> Is the way you prefer ?
>
> But I am not sure whether it's safe since both my downstream GCC and ARM SVE didn't use this approach.
> I am Ok of both for now. So do you prefer the second approach ? Then I can send V2 patch.
 
I am not sure it's safe either, but I am not convinced we need
TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE for improving the
VLS-VLMAX alignment, so I would prefer just using
TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT for now unless we found
it's not safe or we know why it's better way.
 


More information about the Gcc-patches mailing list