From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 2D4093835418 for ; Fri, 7 May 2021 09:43:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2D4093835418 Received: by mail-ej1-x634.google.com with SMTP id l4so12622537ejc.10 for ; Fri, 07 May 2021 02:43:39 -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; bh=FBAardyR+QENzwUVTabAqM6O4r4oPUNzH34c5HmipOY=; b=dpx4uwv7QS7Jn3FSljGLiIp9FafuiTgLt1Casg/i/Qen72cXI1xISDOCa1Dld08iob BO6uupFvZ660zTW+m2IUjn3IfyrCQWD441ncFEaNh6OGN+CLO7YIuNKR9xj0RYfDrwZ3 jQXygpp0HZ2NI78Yqh4z9vktLCF8ct1ra/ShaZ3BcefqSkFVSz9xY8gVrgtIb9a0XrFI Vs4PEIBoEZyEUuhpQpOjRjeVznpq8TgfB9mvdko1YqwuxdMM2bgunEty3T5cZLcQpdtH +InrKzzoxO6HgsWi2hwk33rBy8mmoe98eYaFp9+rx26NYYGLwBcjGZfweJrlrg5wUG1W +ydQ== X-Gm-Message-State: AOAM533obAoRHQjLCAjYircBdLwkiZfXSxA5E7thca3VQYccZv9ScWEM i4GJ5J/9KbO8eBhOV1uBFhjN0519RleS5ydZpzM= X-Google-Smtp-Source: ABdhPJxAffxLVqprJBDD0J5bhCqpqJL1R3eSfX1cyrro/e9u7RGboVJ8AnhrlchBfblhgdz3RZRvhDbceqS/ABV119E= X-Received: by 2002:a17:906:d7a6:: with SMTP id pk6mr8993655ejb.118.1620380618225; Fri, 07 May 2021 02:43:38 -0700 (PDT) MIME-Version: 1.0 References: <990b2492-9198-b713-c79f-68563d488ba0@linux.ibm.com> In-Reply-To: <990b2492-9198-b713-c79f-68563d488ba0@linux.ibm.com> From: Richard Biener Date: Fri, 7 May 2021 11:43:27 +0200 Message-ID: Subject: Re: [PATCH] rs6000: Make density_test only for vector version To: "Kewen.Lin" Cc: GCC Patches , Bill Schmidt , David Edelsohn , Segher Boessenkool Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.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: Fri, 07 May 2021 09:43:40 -0000 On Fri, May 7, 2021 at 5:30 AM Kewen.Lin via Gcc-patches wrote: > > Hi, > > When I was investigating density_test heuristics, I noticed that > the current rs6000_density_test could be used for single scalar > iteration cost calculation, through the call trace: > vect_compute_single_scalar_iteration_cost > -> rs6000_finish_cost > -> rs6000_density_test > > It looks unexpected as its desriptive function comments and Bill > helped to confirm this needs to be fixed (thanks!). > > So this patch is to check the passed data, if it's the same as > the one in loop_vinfo, it indicates it's working on vector version > cost calculation, otherwise just early return. > > Bootstrapped/regtested on powerpc64le-linux-gnu P9. > > Nothing remarkable was observed with SPEC2017 Power9 full run. > > Is it ok for trunk? + /* Only care about cost of vector version, so exclude scalar version here. */ + if (LOOP_VINFO_TARGET_COST_DATA (loop_vinfo) != (void *) data) + return; Hmm, looks like a quite "random" test to me. What about adding a parameter to finish_cost () (or init_cost?) indicating the cost kind? OTOH we already pass scalar_stmt to individual add_stmt_cost, so not sure whether the context really matters. That said, the density test looks "interesting" ... the intent was that finish_cost might look at gathered data from add_stmt, not that it looks at the GIMPLE IL ... so why are you not counting vector_stmt vs. scalar_stmt entries in vect_body and using that for this metric? Richard. > BR, > Kewen > ------ > gcc/ChangeLog: > > * config/rs6000/rs6000.c (rs6000_density_test): Early return if > calculating single scalar iteration cost.