From patchwork Mon Jan 9 23:17:20 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: 41214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2433661wrt; Mon, 9 Jan 2023 15:17:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXtxU/2/t8GeJX4O4m2FFVT71dxom50XcWktk4zM9+yBMB1InBeCDI2E0MxUa+RR/A0fz8Bz X-Received: by 2002:a17:906:6a1a:b0:7b9:ee36:6153 with SMTP id qw26-20020a1709066a1a00b007b9ee366153mr74453146ejc.2.1673306277854; Mon, 09 Jan 2023 15:17:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673306277; cv=none; d=google.com; s=arc-20160816; b=SDWyovpfRS/H0g+7pmdxfhe/YXot5mSYkpUVbSBCuzTZf+WYr0TQS7HD7QyT5iPZkR 4W01toFgBuzvdqMD3qOEUjw5hkiwphUwotn2aPYiP9gCtOiIefsuAURi2uyQhiM/981n K47fcyD/gwMNjC/+uLNY629QBOkIGAbYYAuyZp/YyL6r8Y456g4JnSSnhJfW4pisnpac 9JixaYxgLUFo7DD0gQY0sD9lqfdoTZl8FPvZZFP40TNOTDI0qfcIke8KFGuIChph53ea lVCx35UlzvjgqKyHynHnR0oZGP2WQNp5kf4KX/eRxgkRSyf+GFXeUfreD2ehG1h1HSHy BPZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=0AGG9UziP2fE62dDZs+EJeiC1Nz/rZsYQRyOiZTwkm4=; b=CZZKhLDt+0r/d+3xtsAyLXvFy2wo2T8lW1KQp/XkWZSwyJ2JSqVLR3/z+HxGt/41UI SOxMoJmbhXeq/fkr6uXu30zF93c/a6KYMkKIqw1KurnzEmBd/F2fr32DwjOd93NJJgon IhCJeLWypP1V5ok4HVilwiwxhDmwEKCltm32RIOn9aIpP7WUoKgtAsX5EqHlyRTihX0f agINzWprrmjJ8GwjiEtT7KRt3y8hEpLzSDi26gmqZoUWMjYzSHbVP997Y9aAzzs8rIVP O5b6PMIBYsVoW/1UfT71ghsmSD0X/R6nuQZMd0BP9B3w+9rhah7tNIonZtpsYKMLYiMS hH8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e10-20020a50ec8a000000b0046bdaa564bdsi8984515edr.419.2023.01.09.15.17.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 15:17:57 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 92B3F3858289 for ; Mon, 9 Jan 2023 23:17:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by sourceware.org (Postfix) with ESMTPS id B145F3858CDA for ; Mon, 9 Jan 2023 23:17:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B145F3858CDA 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: bizesmtp65t1673306242t2cg1kkq Received: from server1.localdomain ( [58.60.1.22]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 10 Jan 2023 07:17:21 +0800 (CST) X-QQ-SSF: 01400000002000E0L000B00A0000000 X-QQ-FEAT: rZJGTgY0+YOmqgMjemrY57wMYlFRB1xZcNE+LzzNIJdmeQVI2YuntYrPN1NVP 6ZvH/2BIe773Ax0YJjBMT4YVKyEtMPkZBT1cK1Y4P694eutzzjYqLbUuxqIZCIok1jqm0fN EfUaI52pbWp+BnE56HXj08/WpO0HOcIUrMm4OstHj39Zk5V5APGECUIl/0Qdv8j+xLv/Zh2 IUJ0yiF+t7G1Q7/crrQo/n/hTrDj3/pnNQUvYbaNPACit9BCQRJiSU4pAfn/sgiCpC8pN++ EY3/NAiKAGTKckgQA5abCXUA71UpaLcvEIRpVdKfhgZzf6sWudB4P/JTWBSOZcA5nmcgwSX uVZjEZbcSA5I1fw1x2kk4LNjQvkFH1zWWJUInDcvFdJNvhW2y2LnOnD/BMisw== X-QQ-GoodBg: 2 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, Ju-Zhe Zhong Subject: [PATCH] RISC-V: Add probability model of each block to prevent endless loop of Phase 3 Date: Tue, 10 Jan 2023 07:17:20 +0800 Message-Id: <20230109231720.155773-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvr:qybglogicsvr7 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754588803540575452?= X-GMAIL-MSGID: =?utf-8?q?1754588803540575452?= From: Ju-Zhe Zhong Notice that the PASS is just simpily pick the probability >= 50% to do the backward fusion which will create endless loop on Phase 3. Adding this probability to fix this bug. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (vector_infos_manager::vector_infos_manager): Add probability. (vector_infos_manager::dump): Ditto. (pass_vsetvl::compute_probabilities): Ditto. * config/riscv/riscv-vsetvl.h (struct vector_block_info): Ditto. --- gcc/config/riscv/riscv-vsetvl.cc | 39 ++++++++++++++++++++++++++++++++ gcc/config/riscv/riscv-vsetvl.h | 3 +++ 2 files changed, 42 insertions(+) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 0f12d4ddb23..7d8c3a32aaa 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1465,6 +1465,7 @@ vector_infos_manager::vector_infos_manager () vector_block_infos[bb->index ()].reaching_out = vector_insn_info (); for (insn_info *insn : bb->real_insns ()) vector_insn_infos[insn->uid ()].parse_insn (insn); + vector_block_infos[bb->index ()].probability = profile_probability (); } } } @@ -1642,6 +1643,8 @@ vector_infos_manager::dump (FILE *file) const } fprintf (file, "