This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [OpenACC 3/11] new target hook


On 10/22/15 01:15, Jakub Jelinek wrote:
On Wed, Oct 21, 2015 at 03:13:26PM -0400, Nathan Sidwell wrote:
2015-10-20  Nathan Sidwell  <nathan@codesourcery.com>

	* target.def (fork_join): New GOACC hook.
	* targhooks.h (default_goacc_fork_join): Declare.
	* omp-low.c (default_goacc_forkjoin): New.
	* doc/tm.texi.in (TARGET_GOACC_FORK_JOIN): Add.
	* doc/tm.texi: Regenerate.
	* config/nvptx/nvptx.c (nvptx_xform_fork_join): New.
	(TARGET_GOACC_FOR_JOIN): Override.

this is  what I've committed.  Other than nits, the changes are
1) use targetm.have_... rather than #ifdef HAVE_...

2) don't include the nvptx hunk. I'll apply that with the nvptx bits to turn all this stuff on.

nathan

2015-10-27  Nathan Sidwell  <nathan@codesourcery.com>

	* target-insns.def (oacc_fork, oacc_join): Define.
	* target.def (goacc.validate_dims): Adjust doc to avoid warning.
	(goacc.fork_join): New GOACC hook.
	* targhooks.h (default_goacc_fork_join): Declare.
	* omp-low.c (default_goacc_forkjoin): New.
	* doc/tm.texi.in (TARGET_GOACC_FORK_JOIN): Add.
	* doc/tm.texi: Regenerate.

Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 229447)
+++ gcc/doc/tm.texi	(working copy)
@@ -5754,7 +5754,7 @@ usable.  In that case, the smaller the n
 to use it.
 @end deftypefn
 
-@deftypefn {Target Hook} bool TARGET_GOACC_VALIDATE_DIMS (tree @var{decl}, int @var{dims[]}, int @var{fn_level})
+@deftypefn {Target Hook} bool TARGET_GOACC_VALIDATE_DIMS (tree @var{decl}, int *@var{dims}, int @var{fn_level})
 This hook should check the launch dimensions provided for an OpenACC
 compute region, or routine.  Defaulted values are represented as -1
 and non-constant values as 0. The @var{fn_level} is negative for the
@@ -5766,6 +5766,14 @@ true, if changes have been made.  You mu
 provide dimensions larger than 1.
 @end deftypefn
 
+@deftypefn {Target Hook} bool TARGET_GOACC_FORK_JOIN (gcall *@var{call}, const int *@var{dims}, bool @var{is_fork})
+This hook should convert IFN_GOACC_FORK and IFN_GOACC_JOIN function
+calls to target-specific gimple.  It is executed during the
+oacc_device_lower pass.  It should return true, if the functions
+should be deleted.  The default hook returns true, if there are no
+RTL expanders for them.
+@end deftypefn
+
 @node Anchored Addresses
 @section Anchored Addresses
 @cindex anchored addresses
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 229447)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -4251,6 +4251,8 @@ address;  but often a machine-dependent
 
 @hook TARGET_GOACC_VALIDATE_DIMS
 
+@hook TARGET_GOACC_FORK_JOIN
+
 @node Anchored Addresses
 @section Anchored Addresses
 @cindex anchored addresses
Index: gcc/omp-low.c
===================================================================
--- gcc/omp-low.c	(revision 229462)
+++ gcc/omp-low.c	(working copy)
@@ -17571,6 +17642,19 @@ oacc_validate_dims (tree fn, tree attrs,
   return fn_level;
 }
 
+/* Default fork/join early expander.  Delete the function calls if
+   there is no RTL expander.  */
+
+bool
+default_goacc_fork_join (gcall *ARG_UNUSED (call),
+			 const int *ARG_UNUSED (dims), bool is_fork)
+{
+  if (is_fork)
+    return targetm.have_oacc_fork ();
+  else
+    return targetm.have_oacc_join ();
+}
+
 /* Main entry point for oacc transformations which run on the device
    compiler after LTO, so we know what the target device is at this
    point (including the host fallback).  */
Index: gcc/target-insns.def
===================================================================
--- gcc/target-insns.def	(revision 229459)
+++ gcc/target-insns.def	(working copy)
@@ -64,6 +64,8 @@ DEF_TARGET_INSN (memory_barrier, (void))
 DEF_TARGET_INSN (movstr, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (nonlocal_goto, (rtx x0, rtx x1, rtx x2, rtx x3))
 DEF_TARGET_INSN (nonlocal_goto_receiver, (void))
+DEF_TARGET_INSN (oacc_fork, (rtx x0, rtx x1, rtx x2))
+DEF_TARGET_INSN (oacc_join, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (prefetch, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (probe_stack, (rtx x0))
 DEF_TARGET_INSN (probe_stack_address, (rtx x0))
Index: gcc/target.def
===================================================================
--- gcc/target.def	(revision 229447)
+++ gcc/target.def	(working copy)
@@ -1655,9 +1655,19 @@ should fill in anything that needs to de
 non-defaults.  Diagnostics should be issued as appropriate.  Return\n\
 true, if changes have been made.  You must override this hook to\n\
 provide dimensions larger than 1.",
-bool, (tree decl, int dims[], int fn_level),
+bool, (tree decl, int *dims, int fn_level),
 default_goacc_validate_dims)
 
+DEFHOOK
+(fork_join,
+"This hook should convert IFN_GOACC_FORK and IFN_GOACC_JOIN function\n\
+calls to target-specific gimple.  It is executed during the\n\
+oacc_device_lower pass.  It should return true, if the functions\n\
+should be deleted.  The default hook returns true, if there are no\n\
+RTL expanders for them.",
+bool, (gcall *call, const int *dims, bool is_fork),
+default_goacc_fork_join)
+
 HOOK_VECTOR_END (goacc)
 
 /* Functions relating to vectorization.  */
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h	(revision 229447)
+++ gcc/targhooks.h	(working copy)
@@ -110,6 +110,7 @@ extern void default_destroy_cost_data (v
 
 /* OpenACC hooks.  */
 extern bool default_goacc_validate_dims (tree, int [], int);
+extern bool default_goacc_fork_join (gcall *, const int [], bool);
 
 /* These are here, and not in hooks.[ch], because not all users of
    hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]