From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21127 invoked by alias); 28 Jul 2015 09:22:00 -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 21116 invoked by uid 89); 28 Jul 2015 09:21:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Jul 2015 09:21:58 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1ZK158-00032Z-3v from Thomas_Schwinge@mentor.com ; Tue, 28 Jul 2015 02:21:54 -0700 Received: from tftp-cs (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.224.2; Tue, 28 Jul 2015 02:21:53 -0700 Received: by tftp-cs (Postfix, from userid 49978) id 032C5C227C; Tue, 28 Jul 2015 02:21:53 -0700 (PDT) From: Thomas Schwinge To: Cesar Philippidis , "gcc-patches@gcc.gnu.org" , Jakub Jelinek CC: Nathan Sidwell Subject: Re: [gomp4] Add new oacc_transform patch In-Reply-To: <55AE7E19.90508@codesourcery.com> References: <55AE7E19.90508@codesourcery.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Tue, 28 Jul 2015 09:36:00 -0000 Message-ID: <87io94r61k.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2015-07/txt/msg02334.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 4812 Hi! On Tue, 21 Jul 2015 10:15:05 -0700, Cesar Philippidis wrote: > Jakub, >=20 > Nathan pointed out that I should make the fold_oacc_reductions pass that > I introduced in my reduction patch more generic so that other openacc > transformations may use it. This patch introduces an empty skeleton pass > called oacc_transform. Currently I'm stashing it inside omp-low.c. Is > that a good place for it, or should I move it to it's own separate file? >=20 > The motivation behind this pass is to allow us to generate > target-specific code in a generic manner. E.g., for reductions, I'm > emitting calls to internal functions during lowering, then later on in > this pass I'm expanding those calls using target machine hooks. This > pass will run after lto on the target compiler. (Another use case for this is to evaluate acc_on_device with compile-time constant argument earlier than currently.) Jakub, is this conceptually OK, or even OK to commit to trunk already? Cesar, please address the following compiler diagnostig: > 2015-07-21 Cesar Philippidis >=20 > gcc/ > * omp-low.c (execute_oacc_transform): New function. > (class pass_oacc_transform): New function. > (make_pass_oacc_transform): New function. > * passes.def: Add pass_oacc_transform to all_passes. > * tree-pass.h (make_pass_oacc_transform): Declare. >=20=09 >=20 > diff --git a/gcc/omp-low.c b/gcc/omp-low.c > index 388013c..23989f9 100644 > --- a/gcc/omp-low.c > +++ b/gcc/omp-low.c > @@ -14394,4 +14394,76 @@ make_pass_late_lower_omp (gcc::context *ctxt) > return new pass_late_lower_omp (ctxt); > } >=20=20 > +/* Main entry point for oacc transformations which run on the device > + compiler. */ > + > +static unsigned int > +execute_oacc_transform () > +{ > + basic_block bb; > + gimple_stmt_iterator gsi; > + gimple stmt; > + > + if (!lookup_attribute ("oacc function", > + DECL_ATTRIBUTES (current_function_decl))) > + return 0; > + > + > + FOR_ALL_BB_FN (bb, cfun) > + { > + gsi =3D gsi_start_bb (bb); > + > + while (!gsi_end_p (gsi)) > + { > + stmt =3D gsi_stmt (gsi); > + gsi_next (&gsi); > + } > + } > + > + return 0; > +} [...]/source-gcc/gcc/omp-low.c: In function 'unsigned int execute_oacc_= transform()': [...]/source-gcc/gcc/omp-low.c:14406:10: error: variable 'stmt' set but= not used [-Werror=3Dunused-but-set-variable] gimple stmt; ^ > + > +namespace { > + > +const pass_data pass_data_oacc_transform =3D > +{ > + GIMPLE_PASS, /* type */ > + "fold_oacc_transform", /* name */ > + OPTGROUP_NONE, /* optinfo_flags */ > + TV_NONE, /* tv_id */ > + PROP_cfg, /* properties_required */ > + 0 /* Possibly PROP_gimple_eomp. */, /* properties_provided */ > + 0, /* properties_destroyed */ > + 0, /* todo_flags_start */ > + TODO_update_ssa, /* todo_flags_finish */ > +}; > + > +class pass_oacc_transform : public gimple_opt_pass > +{ > +public: > + pass_oacc_transform (gcc::context *ctxt) > + : gimple_opt_pass (pass_data_oacc_transform, ctxt) > + {} > + > + /* opt_pass methods: */ > + virtual unsigned int execute (function *) > + { > + bool gate =3D (flag_openacc !=3D 0 && !seen_error ()); > + > + if (!gate) > + return 0; > + > + return execute_oacc_transform (); > + } > + > +}; // class pass_oacc_transform > + > +} // anon namespace > + > +gimple_opt_pass * > +make_pass_oacc_transform (gcc::context *ctxt) > +{ > + return new pass_oacc_transform (ctxt); > +} > + > #include "gt-omp-low.h" > diff --git a/gcc/passes.def b/gcc/passes.def > index 43e67df..6a2b095 100644 > --- a/gcc/passes.def > +++ b/gcc/passes.def > @@ -165,6 +165,7 @@ along with GCC; see the file COPYING3. If not see > INSERT_PASSES_AFTER (all_passes) > NEXT_PASS (pass_fixup_cfg); > NEXT_PASS (pass_lower_eh_dispatch); > + NEXT_PASS (pass_oacc_transform); > NEXT_PASS (pass_all_optimizations); > PUSH_INSERT_PASSES_WITHIN (pass_all_optimizations) > NEXT_PASS (pass_remove_cgraph_callee_edges); > diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h > index 13f20ea..67dc017 100644 > --- a/gcc/tree-pass.h > +++ b/gcc/tree-pass.h > @@ -410,6 +410,7 @@ extern gimple_opt_pass *make_pass_late_lower_omp (gcc= ::context *ctxt); > extern gimple_opt_pass *make_pass_diagnose_omp_blocks (gcc::context *ctx= t); > extern gimple_opt_pass *make_pass_expand_omp (gcc::context *ctxt); > extern gimple_opt_pass *make_pass_expand_omp_ssa (gcc::context *ctxt); > +extern gimple_opt_pass *make_pass_oacc_transform (gcc::context *ctxt); > extern gimple_opt_pass *make_pass_object_sizes (gcc::context *ctxt); > extern gimple_opt_pass *make_pass_strlen (gcc::context *ctxt); > extern gimple_opt_pass *make_pass_fold_builtins (gcc::context *ctxt); Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature; name="signature.asc" Content-length: 472 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVt0moAAoJEK3/DN1sMFFt5TUIAJiWgNu5Kf3Z4GBs3ELAUDwO fkfxYYuRXGn8NfSQfJd7kPicjNpeoHpvDScUn3cb9wKv3Bgq9lut5KY7Wd56Amis lVlpzbSfhKLplredok5dd8kD+IY3mDLm1O2ci+lUc1Iqx7XaNmRzvRq9jvuEMgHq khxXqu6PUs+RtVDgt/N9sOnw6ZJk4VGPXXcuB/dvGIQumDK3UzpIy+z+dLtl3Du1 Vs0/qGVvTaKpc8rXX92a0Jp+eOahocm47+epNXFByAFyMS6W2tNYaIrVmFqVcnY+ y0FNqxE8F957by6nwltRJr0JnYr20jeEYkLRy+cRBVQBE0u7t6vf2yp+7Qh9drA= =Mez2 -----END PGP SIGNATURE----- --=-=-=--