Commit 46dedae6 by Tom de Vries Committed by Tom de Vries

[openacc] Add used parameter to TARGET_GOACC_VALIDATE_DIMS

Add a used parameter to TARGET_GOACC_VALIDATE_DIMS, allowing a target to make
decisions in the hook implementation based on whether a dimension is used or
not.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1)
	(nvptx_goacc_validate_dims): Add used parameter.
	* doc/tm.texi: Regenerate.
	* omp-offload.c (oacc_parse_default_dims, oacc_validate_dims): Add
	argument to call to targetm.goacc.validate_dims.
	(default_goacc_validate_dims): Add used
	parameter.
	* target.def (validate_dims): Add used parameter in DEFHOOK.
	* targhooks.h (default_goacc_validate_dims): Add used parameter.

From-SVN: r267876
parent fc560ecd
2019-01-12 Tom de Vries <tdevries@suse.de>
* config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1)
(nvptx_goacc_validate_dims): Add used parameter.
* doc/tm.texi: Regenerate.
* omp-offload.c (oacc_parse_default_dims, oacc_validate_dims): Add
argument to call to targetm.goacc.validate_dims.
(default_goacc_validate_dims): Add used
parameter.
* target.def (validate_dims): Add used parameter in DEFHOOK.
* targhooks.h (default_goacc_validate_dims): Add used parameter.
2019-01-11 Jakub Jelinek <jakub@redhat.com>
PR middle-end/85956
......
......@@ -5549,7 +5549,7 @@ has_vector_partitionable_routine_calls_p (tree fndecl)
DIMS has changed. */
static void
nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level)
nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used)
{
bool oacc_default_dims_p = false;
bool oacc_min_dims_p = false;
......@@ -5711,7 +5711,7 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level)
DECL is null, we are validating the default dimensions. */
static bool
nvptx_goacc_validate_dims (tree decl, int dims[], int fn_level)
nvptx_goacc_validate_dims (tree decl, int dims[], int fn_level, unsigned used)
{
int old_dims[GOMP_DIM_MAX];
unsigned int i;
......@@ -5719,7 +5719,7 @@ nvptx_goacc_validate_dims (tree decl, int dims[], int fn_level)
for (i = 0; i < GOMP_DIM_MAX; ++i)
old_dims[i] = dims[i];
nvptx_goacc_validate_dims_1 (decl, dims, fn_level);
nvptx_goacc_validate_dims_1 (decl, dims, fn_level, used);
gcc_assert (dims[GOMP_DIM_VECTOR] != 0);
if (dims[GOMP_DIM_WORKER] > 0 && dims[GOMP_DIM_VECTOR] > 0)
......
......@@ -6097,7 +6097,7 @@ to use it.
Return number of threads in SIMT thread group on the target.
@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}, unsigned @var{used})
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
......
......@@ -644,8 +644,8 @@ oacc_parse_default_dims (const char *dims)
}
/* Allow the backend to validate the dimensions. */
targetm.goacc.validate_dims (NULL_TREE, oacc_default_dims, -1);
targetm.goacc.validate_dims (NULL_TREE, oacc_min_dims, -2);
targetm.goacc.validate_dims (NULL_TREE, oacc_default_dims, -1, 0);
targetm.goacc.validate_dims (NULL_TREE, oacc_min_dims, -2, 0);
}
/* Validate and update the dimensions for offloaded FN. ATTRS is the
......@@ -673,7 +673,7 @@ oacc_validate_dims (tree fn, tree attrs, int *dims, int level, unsigned used)
pos = TREE_CHAIN (pos);
}
bool changed = targetm.goacc.validate_dims (fn, dims, level);
bool changed = targetm.goacc.validate_dims (fn, dims, level, used);
/* Default anything left to 1 or a partitioned default. */
for (ix = 0; ix != GOMP_DIM_MAX; ix++)
......@@ -1717,7 +1717,8 @@ execute_oacc_device_lower ()
bool
default_goacc_validate_dims (tree ARG_UNUSED (decl), int *dims,
int ARG_UNUSED (fn_level))
int ARG_UNUSED (fn_level),
unsigned ARG_UNUSED (used))
{
bool changed = false;
......
......@@ -1686,7 +1686,7 @@ are being validated and unspecified defaults should be filled in.\n\
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, unsigned used),
default_goacc_validate_dims)
DEFHOOK
......
......@@ -121,7 +121,7 @@ extern void default_finish_cost (void *, unsigned *, unsigned *, unsigned *);
extern void default_destroy_cost_data (void *);
/* OpenACC hooks. */
extern bool default_goacc_validate_dims (tree, int [], int);
extern bool default_goacc_validate_dims (tree, int [], int, unsigned);
extern int default_goacc_dim_limit (int);
extern bool default_goacc_fork_join (gcall *, const int [], bool);
extern void default_goacc_reduction (gcall *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment