From patchwork Fri Sep 15 01:27:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 112666 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp68844qgf; Thu, 14 Sep 2017 18:27:34 -0700 (PDT) X-Received: by 10.101.86.133 with SMTP id v5mr9884317pgs.249.1505438853928; Thu, 14 Sep 2017 18:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505438853; cv=none; d=google.com; s=arc-20160816; b=cs26v9fELtzTVUpB64BDuuUWfKuO2zKI8K3pg0tm9WatwbwMGz9NerBPGZInxWQt3p 6kTzx5U2etAMlnsasBnnqj5aIYL3J4PoGLEqoWklqALErTunkNRWgbf7J0E1PgQ1kSI0 3OHSDYVFaqiLsou2YVUClR4+nNanMOiAreyZfeeHds0NtxNbR13vRIouWk2Ys4Mozg/q 9UqKlPGKnrs3e2dbWA1fmEo+uS/krJFtEV/Fg/0eIEwtg7TPN3fh/iaVtDm8uI0VQSSn N1B24cOiGLudJjttv7c61dpMP5rGUHxKwLwP26kkFo1NM+3o21l/WpL7LzsJ8xblLbk8 p/Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:delivered-to:sender :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=6MPDYOo3f/puIH6TqK14g6/GZ4vBKdW5DJ3JmA0WjDA=; b=oAGbTe6ck8LcHQPLy3QKQM6w0ZzoIyQlyDFIKFhM/lTTQONbcBot5gsb1qQ7y6oCOs t4sOI9L42am6RJFxD7atSLMGgeXexWJ4BsderBjGxRD0rcxIvJkKjHZp6ZTl9dR9tKuO sWENzlwHER+7pMSKDzQHxi4juNqa3KdV6Z6y9n+r72SyTW3o1wSfCinYvhcpXT4LcGOC 0YNiokggMAw/MEOHVUJ9yW9hPGT/DBVvASWzawwu9XU1a8xLYXc2kJLB7E3hQv/lAU6a 6GkiJOBnZ+1SQG+9VzuSDDwf9i8U4r1oYFCQJfu15OpqLp9TPeP4njiN9Z6cgPBSJEHZ 8UdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=q7P6YIeo; spf=pass (google.com: domain of gcc-patches-return-462189-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-462189-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a2si11528917pgt.611.2017.09.14.18.27.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Sep 2017 18:27:33 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-462189-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=q7P6YIeo; spf=pass (google.com: domain of gcc-patches-return-462189-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-462189-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=ggQpxgfiFnsmeH0rF3ZGibmxXg53Pywxd3hrqEXHNh68w3 bruemF3i+Ephhii5XfugZc9Jcn/ATZcVA4jmRpkfY1SexZJBpe9xntLD7D7kDbm2 CpGQaTR0ZU77WzouCo97GQkD0mMW9fmKiEavV4pl42mpGTlLZIHYKc/4RxFaI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=JaUq8xBvOk0nCekCuniDeJs/7/8=; b=q7P6YIeoNsWEcdmjXy7u MZ4MjvHa2/BOBg9I6IR6iUNI8JChevkT6YeyGY7vvWdOI96RP3QFojQEVQ1YKLHJ d0UWitCt90d04pNo9wKKBeaTCCFiHWiMyqG3G3FGggCOMooM7CkCAUXwV2SfUGGq 6FTnRSMkIVSWq/s6iXIT7LU= Received: (qmail 104526 invoked by alias); 15 Sep 2017 01:27:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 104517 invoked by uid 89); 15 Sep 2017 01:27:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f182.google.com Received: from mail-qt0-f182.google.com (HELO mail-qt0-f182.google.com) (209.85.216.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 01:27:19 +0000 Received: by mail-qt0-f182.google.com with SMTP id q4so982476qtq.8 for ; Thu, 14 Sep 2017 18:27:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=1CGfYS5m6hl48bwfiD8NOudEnkDWW99CkDLowbe7tMg=; b=DQT0dliMJ4l7mS+7R9dJ8yP0dnRKieWj8Bv5a2Jd9F3CcOz14YPtaLtITsvTGcAtwk bdsh6g9392s5s5F3wsqJJ2TvThQsse+w00RgORSNdKlFmsbTvBi6aiiHk5GdRQEdDVdw J+BBh3yOK6BqidX6cLoRfzIQ50YR6y3h+bEyZBBYhHx2pyB0i0+KolZbqAWj2w9orU7s 1skkXGcy4cUfAkCdGgBtKRzEhV1U7KlSAxd52uBZI2wCp6ZAzDydUPdbq3W1c1rrlccQ XtGfiooO7eczOZhrp80S2TM0yMgJfFHCK1SYxaOcHD0xpPGXAZ28nBmtOFZIE7SbSV+m NH8w== X-Gm-Message-State: AHPjjUjx9QwxZ4/WdFINpGbrb7xzjCdXe0Ng1cTT1SRDiTKnC3yGD52s ZP/aZTZUt8XIlo5WqsrwuE/tdbKSltcEtFj3qzOCqY4pxNg= X-Google-Smtp-Source: AOwi7QDmlCgK3PFVNOsV3DbANvqV9lwDTpVhwTJEnwUnm0ZOwjUtCSn/WFSFj68EoVmwaA7Beuq63kEj4HyRO8q7evU= X-Received: by 10.237.37.228 with SMTP id y33mr25177351qtc.79.1505438837957; Thu, 14 Sep 2017 18:27:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.37.211 with HTTP; Thu, 14 Sep 2017 18:27:15 -0700 (PDT) From: Kugan Vivekanandarajah Date: Fri, 15 Sep 2017 11:27:15 +1000 Message-ID: Subject: [RFC][PATCH 1/5] Add separate parms for rtl unroller To: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes This patch adds separate params for rtl unroller so that they can be tunned accordingly. Default values I have are based on some testing on aarch64. I am happy to leave it as the current value and set them in the back-end. Thanks, Kugan gcc/ChangeLog: 2017-09-12 Kugan Vivekanandarajah * loop-unroll.c (decide_unroll_constant_iterations): Use new params. (decide_unroll_runtime_iterations): Likewise. (decide_unroll_stupid): Likewise. * params.def (DEFPARAM): Separate and add new params for rtl unroller. >From a899caf9f82767de3db556225b28dc52a81d5967 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Mon, 14 Aug 2017 10:12:09 +1000 Subject: [PATCH 1/5] add parms for rtl unroller --- gcc/loop-unroll.c | 24 ++++++++++++------------ gcc/params.def | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 84145bb..871558c 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -360,13 +360,13 @@ decide_unroll_constant_iterations (struct loop *loop, int flags) /* nunroll = total number of copies of the original loop body in unrolled loop (i.e. if it is 2, we have to duplicate loop body once. */ - nunroll = PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) / loop->ninsns; + nunroll = PARAM_VALUE (PARAM_MAX_UNROLLEDP_INSNS) / loop->ninsns; nunroll_by_av - = PARAM_VALUE (PARAM_MAX_AVERAGE_UNROLLED_INSNS) / loop->av_ninsns; + = PARAM_VALUE (PARAM_MAX_AVERAGE_UNROLLEDP_INSNS) / loop->av_ninsns; if (nunroll > nunroll_by_av) nunroll = nunroll_by_av; - if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLL_TIMES)) - nunroll = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES); + if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLLP_TIMES)) + nunroll = PARAM_VALUE (PARAM_MAX_UNROLLP_TIMES); if (targetm.loop_unroll_adjust) nunroll = targetm.loop_unroll_adjust (nunroll, loop); @@ -664,12 +664,12 @@ decide_unroll_runtime_iterations (struct loop *loop, int flags) /* nunroll = total number of copies of the original loop body in unrolled loop (i.e. if it is 2, we have to duplicate loop body once. */ - nunroll = PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) / loop->ninsns; - nunroll_by_av = PARAM_VALUE (PARAM_MAX_AVERAGE_UNROLLED_INSNS) / loop->av_ninsns; + nunroll = PARAM_VALUE (PARAM_MAX_UNROLLEDP_INSNS) / loop->ninsns; + nunroll_by_av = PARAM_VALUE (PARAM_MAX_AVERAGE_UNROLLEDP_INSNS) / loop->av_ninsns; if (nunroll > nunroll_by_av) nunroll = nunroll_by_av; - if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLL_TIMES)) - nunroll = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES); + if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLLP_TIMES)) + nunroll = PARAM_VALUE (PARAM_MAX_UNROLLP_TIMES); if (targetm.loop_unroll_adjust) nunroll = targetm.loop_unroll_adjust (nunroll, loop); @@ -1158,13 +1158,13 @@ decide_unroll_stupid (struct loop *loop, int flags) /* nunroll = total number of copies of the original loop body in unrolled loop (i.e. if it is 2, we have to duplicate loop body once. */ - nunroll = PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) / loop->ninsns; + nunroll = PARAM_VALUE (PARAM_MAX_UNROLLEDP_INSNS) / loop->ninsns; nunroll_by_av - = PARAM_VALUE (PARAM_MAX_AVERAGE_UNROLLED_INSNS) / loop->av_ninsns; + = PARAM_VALUE (PARAM_MAX_AVERAGE_UNROLLEDP_INSNS) / loop->av_ninsns; if (nunroll > nunroll_by_av) nunroll = nunroll_by_av; - if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLL_TIMES)) - nunroll = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES); + if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLLP_TIMES)) + nunroll = PARAM_VALUE (PARAM_MAX_UNROLLP_TIMES); if (targetm.loop_unroll_adjust) nunroll = targetm.loop_unroll_adjust (nunroll, loop); diff --git a/gcc/params.def b/gcc/params.def index 805302b..c8b0a2b 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -302,6 +302,23 @@ DEFPARAM(PARAM_MAX_PEELED_INSNS, "max-peeled-insns", "The maximum number of insns of a peeled loop.", 100, 0, 0) + +DEFPARAM(PARAM_MAX_UNROLLEDP_INSNS, + "max-partial-unrolled-insns", + "The maximum number of instructions to consider to unroll in a loop by rtl unroller.", + 100, 0, 0) +/* This parameter limits how many times the loop is unrolled depending + on number of insns really executed in each iteration. */ +DEFPARAM(PARAM_MAX_AVERAGE_UNROLLEDP_INSNS, + "max-partial-average-unrolled-insns", + "The maximum number of instructions to consider to unroll in a loop on average by rtl unroller.", + 40, 0, 0) +/* The maximum number of unrollings of a single loop. */ +DEFPARAM(PARAM_MAX_UNROLLP_TIMES, + "max-partial-unroll-times", + "The maximum number of unrollings of a single loop by rtl unroller.", + 4, 0, 0) + /* The maximum number of peelings of a single loop. */ DEFPARAM(PARAM_MAX_PEEL_TIMES, "max-peel-times", -- 2.7.4