From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88093 invoked by alias); 6 Nov 2015 08:38:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 88050 invoked by uid 89); 6 Nov 2015 08:38:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 06 Nov 2015 08:38:25 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D47D7AAD1 for ; Fri, 6 Nov 2015 08:38:01 +0000 (UTC) Date: Fri, 06 Nov 2015 08:38:00 -0000 From: Richard Biener To: Martin Jambor cc: GCC Patches Subject: Re: [hsa 7/12] Disabling the vectorizer for GPU kernels/functions In-Reply-To: <20151105220105.GJ9264@virgil.suse.cz> Message-ID: References: <20151105215108.GC9264@virgil.suse.cz> <20151105220105.GJ9264@virgil.suse.cz> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2015-11/txt/msg00562.txt.bz2 On Thu, 5 Nov 2015, Martin Jambor wrote: > Hi, > > in the previous email I wrote we need to "change behavior" of a few > optimization passes. One was the flattening of GPU functions and the > other two are in the patch below. It all comes to that, at the > moment, we need to switch off the vectorizer (only for the GPU > functions, of course). > > We are actually quite close to being able to handle gimple vector > input in HSA back-end but not all the way yet, and before allowing the > vectorizer again, we will have to make sure it never produces vectors > bigger than 128bits (in GPU functions). Hmm. I'd rather have this modify DECL_FUNCTION_SPECIFIC_OPTIMIZATION of the hsa function to get this effect. I think I mentioned this to the OACC guys as well for a similar needs of them. Richard. > Thanks, > > Martin > > > 2015-11-05 Martin Jambor > > * tree-ssa-loop.c: Include cgraph.c, symbol-summary.c and hsa.h. > (pass_vectorize::gate): Do not run on HSA functions. > * tree-vectorizer.c: Include symbol-summary.c and hsa.h. > (pass_slp_vectorize::gate): Do not run on HSA functions. > > diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c > index 8ecd140..0d119e2 100644 > --- a/gcc/tree-ssa-loop.c > +++ b/gcc/tree-ssa-loop.c > @@ -35,6 +35,9 @@ along with GCC; see the file COPYING3. If not see > #include "tree-inline.h" > #include "tree-scalar-evolution.h" > #include "tree-vectorizer.h" > +#include "cgraph.h" > +#include "symbol-summary.h" > +#include "hsa.h" > > > /* A pass making sure loops are fixed up. */ > @@ -257,7 +260,8 @@ public: > /* opt_pass methods: */ > virtual bool gate (function *fun) > { > - return flag_tree_loop_vectorize || fun->has_force_vectorize_loops; > + return (flag_tree_loop_vectorize || fun->has_force_vectorize_loops) > + && !hsa_gpu_implementation_p (fun->decl); > } > > virtual unsigned int execute (function *); > diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c > index b80a8dd..366138c 100644 > --- a/gcc/tree-vectorizer.c > +++ b/gcc/tree-vectorizer.c > @@ -75,6 +75,8 @@ along with GCC; see the file COPYING3. If not see > #include "tree-ssa-propagate.h" > #include "dbgcnt.h" > #include "tree-scalar-evolution.h" > +#include "symbol-summary.h" > +#include "hsa.h" > > > /* Loop or bb location. */ > @@ -675,7 +677,10 @@ public: > > /* opt_pass methods: */ > opt_pass * clone () { return new pass_slp_vectorize (m_ctxt); } > - virtual bool gate (function *) { return flag_tree_slp_vectorize != 0; } > + virtual bool gate (function *fun) > + { > + return flag_tree_slp_vectorize && !hsa_gpu_implementation_p (fun->decl); > + } > virtual unsigned int execute (function *); > > }; // class pass_slp_vectorize > > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)