From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 40E443858D32 for ; Mon, 15 May 2023 02:56:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 40E443858D32 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-64a9335a8e7so17331889b3a.0 for ; Sun, 14 May 2023 19:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1684119411; x=1686711411; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pn94PjLF1+JQrV16EBUpMQ/O0UDO5hoWxM6MJfzC7PA=; b=LcGDdbGYFplY63JJ3+GRfGaMgdDZNZn+KTV5rTH97C1XMZOQ82M6UBO6B0+E+tJKqB 4vrqYvInTzvpStgSL5N9VNue5jYbGEl6re/q6BS84SjuT2MtLBTjPvdckYyTYjVtA4mz Buw2etZbGcMc2/BtYcY74XjDZfAvi88+nVY427QvBpQnCI/GfJ9OZe9yQR2eDiumqIIG XRhgGN023peVdtPcU3nRis+ZoP20yieLpeStA/tbxFslAVWW5j5ahO7fNvVUpjkxNY7F n61ybCx8D85V1liFgiBNJUEH2/9v6WUyij85fK43crJSONOxI3ar+JvOuiZ+/hs5Si// X1qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684119411; x=1686711411; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pn94PjLF1+JQrV16EBUpMQ/O0UDO5hoWxM6MJfzC7PA=; b=URX1B9OvfdOA4/E0SC7tBX8GHq/b5YjYu9PD92r36eEhRkI+gXy/Y5+cM7Z973Ksb7 7BHWcq/rv7fmMibuNvlsOGQxdwtrKFyB0SzJn2gqsS1CRenAbZS6CpVlvn1LyQnUGjer 6yD6ROAurRgNcdpwq6FPAZJ/NHeGwz7sz2l7Ie+bc7s+cUBXr9MX7iIWZ1+uVKvHz+cy BmtX0nkLc6jI8kVqxLDf6lMz2Zt8XsMSuHcL+/dfyxKbiXzV43dvajBqqjWQ2rXkz9yv zdrjE1G65DidTJTGQgmsntk9MKGEnOtLA6+7rn9WGGkcIVIeln+nx/MnffuaTZWeVNoF Jv5w== X-Gm-Message-State: AC+VfDxZ0bF3FoPivSLJ6fkjsBrh8WEXRhLhEnfOjqbONQDFrmlXFHFg HkFJzMhWcIiXoGp/qL0k4hr9LA0qa00Nu2bjg9bfmg== X-Google-Smtp-Source: ACHHUZ4ppC8gvTbBIL1oj4sH9Lp2cut3BtUNBdfdC59a0fx8FyiC9K0e+i3jEoZNXSSe4XaY+Tj5VgcECqpu6+u94a0= X-Received: by 2002:a17:90a:db8c:b0:24b:52cb:9a31 with SMTP id h12-20020a17090adb8c00b0024b52cb9a31mr42768272pjv.22.1684119411189; Sun, 14 May 2023 19:56:51 -0700 (PDT) MIME-Version: 1.0 References: <20230513114421.196081-1-juzhe.zhong@rivai.ai> <9749BBE19D80DC01+2023051508355391896637@rivai.ai> In-Reply-To: From: Kito Cheng Date: Mon, 15 May 2023 10:56:40 +0800 Message-ID: Subject: Re: Re: [PATCH] RISC-V: Support TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT to optimize codegen of RVV auto-vectorization To: "juzhe.zhong@rivai.ai" Cc: gcc-patches , palmer , Robin Dapp , jeffreyalaw Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, May 15, 2023 at 10:48=E2=80=AFAM 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 ca= n 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.