From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129394 invoked by alias); 5 Nov 2015 22:01:10 -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 129381 invoked by uid 89); 5 Nov 2015 22:01:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS 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; Thu, 05 Nov 2015 22:01:09 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8441FAABB for ; Thu, 5 Nov 2015 22:00:47 +0000 (UTC) Date: Thu, 05 Nov 2015 22:01:00 -0000 From: Martin Jambor To: GCC Patches Cc: Richard Biener Subject: [hsa 7/12] Disabling the vectorizer for GPU kernels/functions Message-ID: <20151105220105.GJ9264@virgil.suse.cz> Mail-Followup-To: GCC Patches , Richard Biener References: <20151105215108.GC9264@virgil.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20151105215108.GC9264@virgil.suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00526.txt.bz2 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). 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