From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 348BB3858D3C for ; Tue, 30 Nov 2021 23:06:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 348BB3858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 1AUN5GZ0023827; Tue, 30 Nov 2021 17:05:16 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 1AUN5GgC023826; Tue, 30 Nov 2021 17:05:16 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 30 Nov 2021 17:05:16 -0600 From: Segher Boessenkool To: "Kewen.Lin" Cc: GCC Patches , David Edelsohn , Bill Schmidt Subject: Re: [PATCH v2] rs6000: Modify the way for extra penalized cost Message-ID: <20211130230516.GA614@gate.crashing.org> References: <20211129220608.GV614@gate.crashing.org> <609c8985-9927-5219-9619-7656f4b29620@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <609c8985-9927-5219-9619-7656f4b29620@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 30 Nov 2021 23:06:18 -0000 Hi! On Tue, Nov 30, 2021 at 01:05:48PM +0800, Kewen.Lin wrote: > on 2021/11/30 上午6:06, Segher Boessenkool wrote: > > On Tue, Sep 28, 2021 at 04:16:04PM +0800, Kewen.Lin wrote: > >> unsigned adjusted_cost = (nunits == 2) ? 2 : 1; > >> unsigned extra_cost = nunits * adjusted_cost; > > > >> For V2DI/V2DF, it uses 2 penalized cost for each scalar load > >> while for the other modes, it uses 1. > > > > So for V2D[IF] we get 4, for V4S[IF] we get 4, for V8HI it's 8, and > > for V16QI it is 16? Pretty terrible as well, heh (I would expect all > > vector ops to be similar cost). > > But for different vector units it has different number of loads, it seems > reasonable to have more costs when it has more loads to be fed into those > limited number of load/store units. More expensive, yes. This expensive? That doesn't look optimal :-) > > This also suggests we should cost vector construction separately, which > > would pretty obviously be a good thing anyway (it happens often, it has > > a quite different cost structure). > > vectorizer does model vector construction separately, there is an enum > vect_cost_for_stmt *vec_construct*, normally it works well. But for this > bwaves hotspot, it requires us to do some more penalization as evaluated, > so we put the penalized cost onto this special vector construction when > some heuristic thresholds are met. Ah, heuristics. We can adjust them forever :-) Segher