From patchwork Thu Aug 31 23:10:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 137359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c792:0:b0:3f2:4152:657d with SMTP id b18csp555107vqu; Thu, 31 Aug 2023 16:10:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH//HbIDVGnjRHSJRmib6jRksQ3lOdRi4oB1lEXZsHXqYmbKrVflQ3A/0br9aKqF+UinoiY X-Received: by 2002:a17:907:a06d:b0:9a1:e8c0:7e2e with SMTP id ia13-20020a170907a06d00b009a1e8c07e2emr561370ejc.14.1693523443180; Thu, 31 Aug 2023 16:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693523443; cv=none; d=google.com; s=arc-20160816; b=KwaQ6vj/fsgoH/EpLVC2WeVFih31XzJ+1YWECazKH5EbxFzgaWlC4ZZVCSCQnCN6Cq 6yx7/mrqNy8vRl5uBua+rEVRG6rKYbfmqEcStJ3I7dOBB3Kkh5ND80577A2C7VWsWea5 rTPJnqPmNXgHEluhu9ied7igR0EYpP2aLfGUNRZFv6rBZAJ7rCoNeKhiuUTSvrIYzUki E9U4gDH+WUu5DgUSvkl6a/5BqktNVhmoK9EPyqSWidBfwer4w87q4Wc0kHlVtBl3qM8k QUGoXZzCENDx/LEAUVs4liL0FOjOv2mvrfACEywEWRhCLyn/2wG8kK9nUatSZmNwXxbu BFGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:to :from:dmarc-filter:delivered-to; bh=hgsKWW35xAwJJAXKxgriC7f8azvEcK572IdJfciYEY8=; fh=arl273cIQBNH1P6XLxHQvF0scgitfd773vOV+bwQx3o=; b=YEClqvrysBkDD/tM18pYuXSPIhSpxHGB9dISnxE0k1ErWVwalLK0ETv/uy1oqNAPJa SggxqDBrVCjzYyeI/LtZLAnwhB7CsPJn2ad5lUbSXoLR0BbhqmAM1bLrBL00PJ8RG0oT sAOKQ3Tyv+1Uv4b/MRxgG3JFwjOSJlmfrrjLcRiEAG3D8R40SDdlQ1npk8WAdxtxbim7 +wCd4KRHcKV3uqf4HQVEDZ70MwAppgofQYtR3FJkNw+Xuyjvq5QPxN1SAXPr78QS7BOF E5SPSh+93K0VuAflwXppP/PTdN5sclCr0HblqU15V2oMNyvLGcJxDtK4+HOYghga+PGe FUWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id o21-20020a1709062e9500b0098e07395330si1657138eji.746.2023.08.31.16.10.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 16:10:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F05138582A9 for ; Thu, 31 Aug 2023 23:10:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) by sourceware.org (Postfix) with ESMTPS id 714EE3858D37 for ; Thu, 31 Aug 2023 23:10:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 714EE3858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp89t1693523403tsxa03w7 Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 01 Sep 2023 07:10:02 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: 5q30pvLz2icvM9dESSYh5xXitGwKt13f1RkJUNU2LOBGDP8+y6Lvx6E3Y4V6u YugHP1qT27R13Emh0/iGJ3ikajPnXHM4hmn5y6lshzm4ytgNe6VvgXz5zXhaPyfBIQ9bRG+ rSgQ7Y2R5HTKYsqZ+T46Yg4PnpAcJrm6fbX92fcKkwWgyYOvueiiaHqSIUelZE7Eat9wccL cTkBKHPQbEwO+SpgLih9rcn6fxHKtNaNtx7NeFZAoRvP7geCsmQbc5iQzXaNA3mn/sNVuZB 2h1gK9BUXuMeSVNPalHELwsS8YINSb4oL0DLX3/p88+PBh7Tu/EW4+FKvLGlZRs96Ufsfp+ pz/OstlokbZiwka8Iv4U1sVQFW/TtrW6vDP2Rx1jyXyUaSulAgKA32BN4HklQ== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 5723824589218608856 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Subject: [PATCH] RISC-V: Enable VECT_COMPARE_COSTS by default Date: Fri, 1 Sep 2023 07:10:00 +0800 Message-Id: <20230831231000.1853225-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_PASS, TXREP, T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kito.cheng@sifive.com, kito.cheng@gmail.com, Juzhe-Zhong Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775788037648292710 X-GMAIL-MSGID: 1775788037648292710 since we have added COST framework, we by default enable VECT_COMPARE_COSTS. Also, add 16/32/64 to provide more choices for COST comparison. This patch doesn't change any behavior from the current testsuite since we are using default COST model. gcc/ChangeLog: * config/riscv/riscv-v.cc (autovectorize_vector_modes): Enable VECT_COMPARE_COSTS by default. --- gcc/config/riscv/riscv-v.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 6228ff3d92e..c8ad96f44d5 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -2173,7 +2173,7 @@ autovectorize_vector_modes (vector_modes *modes, bool) full vectors for wider elements. - full_size / 8: Try using 64-bit containers for all element types. */ - static const int rvv_factors[] = {1, 2, 4, 8}; + static const int rvv_factors[] = {1, 2, 4, 8, 16, 32, 64}; for (unsigned int i = 0; i < sizeof (rvv_factors) / sizeof (int); i++) { poly_uint64 units; @@ -2183,12 +2183,8 @@ autovectorize_vector_modes (vector_modes *modes, bool) modes->safe_push (mode); } } - unsigned int flag = 0; if (TARGET_VECTOR_VLS) { - /* Enable VECT_COMPARE_COSTS between VLA modes VLS modes for scalable - auto-vectorization. */ - flag |= VECT_COMPARE_COSTS; /* Push all VLSmodes according to TARGET_MIN_VLEN. */ unsigned int i = 0; unsigned int base_size = TARGET_MIN_VLEN * riscv_autovec_lmul / 8; @@ -2201,7 +2197,8 @@ autovectorize_vector_modes (vector_modes *modes, bool) size = base_size / (1U << i); } } - return flag; + /* Enable LOOP_VINFO comparison in COST model. */ + return VECT_COMPARE_COSTS; } /* If the given VECTOR_MODE is an RVV mode, first get the largest number