From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by sourceware.org (Postfix) with ESMTPS id 6EB27383E835 for ; Wed, 22 Jul 2020 06:38:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6EB27383E835 Received: by mail-ej1-x642.google.com with SMTP id ga4so959119ejb.11 for ; Tue, 21 Jul 2020 23:38:52 -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:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=pF5KDeBRUCUSv2wplSQj7e5/MihETabjNCUEDBRcUZI=; b=aXDVYr6+8CtMYnl32m0EKX07NBA/bf+7G36+dqUAE+NLDWuNs74u8KSC2LHAllM+OK FDZtzkYHzmymOybErubzx8l5etXN34CaTPHyPWtdLUkIOUsgiwqtnjQE6YNyrWSmWFCJ A+HGHQDL9r22MZOQJPBETfTJ/sXhlgi3bOl+cZypVlG3Ed2yurhmNyq+kwhDWdjSUBiy d/HuX5SKgsneVZSdZnzl9QMQqQD/oydXFVfVp+ym8xOd1ftfYkPJdjNXILf6ZFi+4eld RCbvClFYHZ2oDUvZ9PRS/LS+LpfZuBW4a+iywVFQsCkp5wAH2byimTZ2bZhJ17s0sgAS 0qrQ== X-Gm-Message-State: AOAM532jtzOzTlm5jHzYPplFZ6WmUdCHa0Eo5/28I0nLMkU1E1/k8ZhK 8yxTMtbUHMSlIKZh8LyTYUPOzhS/Fn/V8+8Pb6U= X-Google-Smtp-Source: ABdhPJzwwmCbNltxhS0IlR3T/dLR1HTJKG0lEbtQoeEBnQO1esnCdSj0W7OUJKaqbP3phFqi8HIBWF/k9BiogbDbxZ8= X-Received: by 2002:a17:906:e089:: with SMTP id gh9mr28230919ejb.482.1595399931485; Tue, 21 Jul 2020 23:38:51 -0700 (PDT) MIME-Version: 1.0 References: <419f1fad-05be-115c-1a53-cb710ae7b2dc@linux.ibm.com> In-Reply-To: From: Richard Biener Date: Wed, 22 Jul 2020 08:38:40 +0200 Message-ID: Subject: Re: [PATCH v2] vect/rs6000: Support vector with length cost modeling To: "Kewen.Lin" Cc: GCC Patches , Bill Schmidt , Segher Boessenkool , Richard Sandiford Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-List-Received-Date: Wed, 22 Jul 2020 06:38:53 -0000 On Wed, Jul 22, 2020 at 3:26 AM Kewen.Lin wrote: > > Hi Richard, > > on 2020/7/21 =E4=B8=8B=E5=8D=883:57, Richard Biener wrote: > > On Tue, Jul 21, 2020 at 7:52 AM Kewen.Lin wrote: > >> > >> Hi, > >> > >> This patch is to add the cost modeling for vector with length, > >> it mainly follows what we generate for vector with length in > >> functions vect_set_loop_controls_directly and vect_gen_len > >> at the worst case. > >> > >> For Power, the length is expected to be in bits 0-7 (high bits), > >> we have to model the cost of shifting bits. To allow other targets > >> not suffer this, I used one target hook to describe this extra cost, > >> I'm not sure if it's a correct way. > >> > >> Bootstrapped/regtested on powerpc64le-linux-gnu (P9) with explicit > >> param vect-partial-vector-usage=3D1. > >> > >> Any comments/suggestions are highly appreciated! > > > > I don't like the introduction of an extra target hook for this. All > > vectorizer cost modeling should ideally go through > > init_cost/add_stmt_cost/finish_cost. If the extra costing is > > not per stmt then either init_cost or finish_cost is appropriate. > > Currently init_cost only gets a struct loop while we should > > probably give it a vec_info * parameter so targets can > > check LOOP_VINFO_USING_PARTIAL_VECTORS_P and friends. > > > > Thanks! Nice, your suggested way looks better. I've removed the hook > and taken care of it in finish_cost. The updated v2 is attached. > > Bootstrapped/regtested again on powerpc64le-linux-gnu (P9) with explicit > param vect-partial-vector-usage=3D1. LGTM (with assuming the first larger hunk is mostly re-indenting under LOOP_VINFO_USING_PARTIAL_VECTORS_P). Thanks, Richard. > BR, > Kewen > ----- > gcc/ChangeLog: > > * config/rs6000/rs6000.c (adjust_vect_cost): New function. > (rs6000_finish_cost): Call function adjust_vect_cost. > * tree-vect-loop.c (vect_estimate_min_profitable_iters): Add cost > modeling for vector with length.