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: 814013 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-462189-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="KpPGFZXq"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xtd752sRzz9t2V for ; Fri, 15 Sep 2017 11:27:29 +1000 (AEST) 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=dBPi72YLfV7yH8LJ+T2hT2D6KU1MXBp/HD9Zcdy2geV4m4 YLMltOFf3uMAEHP+CswzMAuH2YS12NI7SEaue2RHO1JeYx857we61Jf1dx3D9pVQ xShGQ5sHXci0AXLmV5SUJYaf4fFhuE/X3FE7wXbUkrbYHjDAi195I+WxE+BaA= 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=KpPGFZXqUrpUeYLq7OP7 IrmLX+wgLvNr93+wnuV/cf/6yMy5Fs51kt+3jAFL6iy88jgda7IXCyC9ZNJJtV2m gOnJoJC8FuyYIRNaO8ry+cJhmJ1VDzi7vABF67vyokREc5BHsfrlaFSnIBTJIXCF KuTOqkP21l9boiNAZ81df0k= 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