From patchwork Thu Sep 26 18:09:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang David Li X-Patchwork-Id: 278232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 725C92C0196 for ; Fri, 27 Sep 2013 04:09:57 +1000 (EST) 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:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=ZIo5+RKmudFkve8RVr YzDDPpwnjPXorRUSZDE89dRGPkRqflSWDBQ08hLGR8vCTUmgekjxKqLop0GPUfhx rK+0SzxqDTG8SM7Qfgb6JoiCgeXb8UNg9K7SDclkBSM6hPI8YWrxSPObBVNJP2l7 e0hUVTLkykGPwdXt91HvilLcA= 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:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=Je/n3qRCefe2WDn6K4P3r9YU ZKo=; b=Zp6VXEnG0OHKe8YXlyS9J6yIKEvM5PcBqwasHcKJ45FWVsPtzsGfoxYK p1/fdE8lFcs5J2VkchZPeXU0zHWEZtRPESsMpxU60Rh455Jk8+qXDVYHSh5hZLUd puC+dTh9ynq50XN9h4K3NHg81XN5B+G/P3WYEqTAcIzmlRBFNb8= Received: (qmail 29663 invoked by alias); 26 Sep 2013 18:09:50 -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 29649 invoked by uid 89); 26 Sep 2013 18:09:49 -0000 Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 26 Sep 2013 18:09:49 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.9 required=5.0 tests=AWL, BAYES_50, NO_RELAYS, SPAM_SUBJECT autolearn=no version=3.3.2 X-HELO: mail-wi0-f178.google.com Received: by mail-wi0-f178.google.com with SMTP id hn9so1664805wib.11 for ; Thu, 26 Sep 2013 11:09:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=kwn/zCEWNgxPkhgtsgPRhrcH+cJHK9/ETP0cg5yTKy8=; b=C03Wprnt7w5MJCV2YZzJVlW63M1chNhhabf9zW81Z3ohbaWP5n5bkgVdKDu+PNoLyF TOZKeyJzf5kSva1uYB1ejmMj5UAbDrNyFpx/9AhDdGeu7DHDy9p8NsO44N2ZGV0VnGmJ SWywv27mYdZJTPaH+pxHjvPHtvRxuGRgQHFDFeHjjTUEKmMAoPg3drY1Csx3pt+U/GAx wR6pkT5jjotJhGZg1C1qAszV0bwj7XBK4bUNLb7Bm7PyD6pKzUcYfl/OF1PokdYtsSJZ UIa+8sUNWcrcd63l0EOV3Ry1g2obmw6ZEUYy3Rnxg9W89Ck5LWmVUoX9uE/5pUS5bnnb t/SQ== X-Gm-Message-State: ALoCoQl5rDojInssrOh72FP0EXeKDPZONw1l8h68Vb3uHiD3QmPE2zrZKsJqD0z9uMISJ0j4ZPEv1du3frfbDLLhfWCckI1kpIYOpM+2+qwNNC+77j6vLIRX5po6vNEArqI9eLoURDsH30J6q3QVhUzTcHoxblmq9J+ihEMUQrYgnojdBr/HSXynwM+TPuRyuZmHN0aZo6C3hVhwgwz7NOF1Pm5NpLBHog== MIME-Version: 1.0 X-Received: by 10.194.94.137 with SMTP id dc9mr2191892wjb.38.1380218986023; Thu, 26 Sep 2013 11:09:46 -0700 (PDT) Received: by 10.180.212.81 with HTTP; Thu, 26 Sep 2013 11:09:45 -0700 (PDT) In-Reply-To: References: Date: Thu, 26 Sep 2013 11:09:45 -0700 Message-ID: Subject: Re: cost model patch From: Xinliang David Li To: Richard Biener Cc: GCC Patches X-IsSubscribed: yes On Thu, Sep 26, 2013 at 7:37 AM, Richard Biener wrote: > On Thu, Sep 26, 2013 at 1:10 AM, Xinliang David Li wrote: >> I took the liberty to pick up Richard's original fvect-cost-model >> patch and made some modification. >> >> What has not changed: >> 1) option -ftree-vect-loop-version is removed; >> 2) three cost models are introduced: cheap, dynamic, and unlimited; >> 3) unless explicitly specified, cheap model is the default at O2 (e.g. >> when -ftree-loop-vectorize is used with -O2), and dynamic mode is the >> default for O3 and FDO >> 4) alignment based versioning is disabled with cheap model. >> >> What has changed: >> 1) peeling is also disabled with cheap model; >> 2) alias check condition limit is reduced with cheap model, but not >> completely suppressed. Runtime alias check is a pretty important >> enabler. >> 3) tree if conversion changes are not included. >> >> Does this patch look reasonable? > > In principle yes. Note that it changes the behavior of -O2 -ftree-vectorize > as -ftree-vectorize does not imply changing the default cost model. I am > fine with that, but eventually this will have some testsuite fallout. This > reorg would also need documenting in changes.html to make people > aware of this. Here is the proposed change: vectorizer is turned on at the expense of not getting the maximum potential runtime speedup. The 'cheap' model will be the default when vectorizer is turned on at -O2. To override this, use option -fvect-cost-model=[cheap|dynamic|unlimited].

New Languages and Language specific improvements

> > With completely disabling alingment peeling and alignment versioning > you cut out targets that have no way of performing unaligned accesses. > From looking at vect_no_align this are mips, sparc, ia64 and some arm. > A compromise for them would be to allow peeling a single iteration > and some alignment checks (like up to two?). > Possibly. I think target owners can choose to do target specific tunings as follow up. > Reducing the number of allowed alias-checks is ok, but I'd reduce it > more than to 6 (was that an arbitrary number or is that the result of > some benchmarking?) > yes -- we found that it is not uncommon to have a loop with 2 or 3 distinct source address and 1 or 2 target address. There are also tuning opportunities. For instance, in cases where source address are derived from the same base, a consolidated alias check (against the whole access range instead of just checking cross 1-unrolled iteration dependence) can be done. > I suppose all of the params could use some benchmarking to select > a sweet spot in code size vs. runtime. Agree. > > I suppose the patch is ok as-is (if it actually works) if you provide > a changelog and propose an entry for changes.html. We can > tune the params for the cheap model as followup. Ok. I will do more testing and check in the patch with proper ChangeLog. The changes.html change will be done separately. thanks, David > > Thanks for picking this up, > Richard. > >> thanks, >> >> David Index: htdocs/gcc-4.9/changes.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/changes.html,v retrieving revision 1.26 diff -u -r1.26 changes.html --- htdocs/gcc-4.9/changes.html 26 Aug 2013 14:16:31 -0000 1.26 +++ htdocs/gcc-4.9/changes.html 26 Sep 2013 18:02:33 -0000 @@ -37,6 +37,7 @@
  • AddressSanitizer, a fast memory error detector, is now available on ARM.
  • +
  • GCC introduces a new cost model for vectorizer, called 'cheap' model. The new cost model is intenteded to minimize compile time, code size, and potential negative runtime impact introduced when