Commit d6f528e7 by Tom de Vries Committed by Tom de Vries

[nvptx] Allow default vl to be overridden in nvptx_goacc_validate_dims_1

In nvptx_goacc_validate_dims_1, allow oacc_default_dims[DIM_VECTOR] to be
overridden, by assigning it to a new variable default_vector_length at the
start, and using it at the end.

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

	* config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Add an use new
	variable default_vector_length.

From-SVN: r267878
parent 980af7cd
2019-01-12 Tom de Vries <tdevries@suse.de> 2019-01-12 Tom de Vries <tdevries@suse.de>
* config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Add an use new
variable default_vector_length.
2019-01-12 Tom de Vries <tdevries@suse.de>
PR middle-end/88703 PR middle-end/88703
* config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Apply defaults * config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Apply defaults
from oacc_default_dims, as oacc_validate_dims would do it, and apply from oacc_default_dims, as oacc_validate_dims would do it, and apply
......
...@@ -5556,6 +5556,7 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) ...@@ -5556,6 +5556,7 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used)
bool offload_region_p = false; bool offload_region_p = false;
bool routine_p = false; bool routine_p = false;
bool routine_seq_p = false; bool routine_seq_p = false;
int default_vector_length = -1;
if (decl == NULL_TREE) if (decl == NULL_TREE)
{ {
...@@ -5654,6 +5655,12 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) ...@@ -5654,6 +5655,12 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used)
gcc_assert (dims[GOMP_DIM_GANG] >= -1); gcc_assert (dims[GOMP_DIM_GANG] >= -1);
} }
if (offload_region_p)
default_vector_length = oacc_get_default_dim (GOMP_DIM_VECTOR);
else
/* oacc_default_dims_p. */
default_vector_length = PTX_DEFAULT_VECTOR_LENGTH;
int old_dims[GOMP_DIM_MAX]; int old_dims[GOMP_DIM_MAX];
unsigned int i; unsigned int i;
for (i = 0; i < GOMP_DIM_MAX; ++i) for (i = 0; i < GOMP_DIM_MAX; ++i)
...@@ -5673,12 +5680,12 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) ...@@ -5673,12 +5680,12 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used)
if (dims[GOMP_DIM_VECTOR] == 0) if (dims[GOMP_DIM_VECTOR] == 0)
{ {
vector_reason = G_("using vector_length (%d), ignoring runtime setting"); vector_reason = G_("using vector_length (%d), ignoring runtime setting");
dims[GOMP_DIM_VECTOR] = PTX_DEFAULT_VECTOR_LENGTH; dims[GOMP_DIM_VECTOR] = default_vector_length;
} }
if (dims[GOMP_DIM_VECTOR] > 0 if (dims[GOMP_DIM_VECTOR] > 0
&& !nvptx_welformed_vector_length_p (dims[GOMP_DIM_VECTOR])) && !nvptx_welformed_vector_length_p (dims[GOMP_DIM_VECTOR]))
dims[GOMP_DIM_VECTOR] = PTX_DEFAULT_VECTOR_LENGTH; dims[GOMP_DIM_VECTOR] = default_vector_length;
nvptx_apply_dim_limits (dims); nvptx_apply_dim_limits (dims);
...@@ -5696,7 +5703,7 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) ...@@ -5696,7 +5703,7 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used)
if (oacc_default_dims_p) if (oacc_default_dims_p)
{ {
dims[GOMP_DIM_VECTOR] = PTX_DEFAULT_VECTOR_LENGTH; dims[GOMP_DIM_VECTOR] = default_vector_length;
if (dims[GOMP_DIM_WORKER] < 0) if (dims[GOMP_DIM_WORKER] < 0)
dims[GOMP_DIM_WORKER] = PTX_DEFAULT_RUNTIME_DIM; dims[GOMP_DIM_WORKER] = PTX_DEFAULT_RUNTIME_DIM;
if (dims[GOMP_DIM_GANG] < 0) if (dims[GOMP_DIM_GANG] < 0)
...@@ -5715,7 +5722,9 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) ...@@ -5715,7 +5722,9 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used)
/* Function oacc_validate_dims will apply the minimal dimension. */ /* Function oacc_validate_dims will apply the minimal dimension. */
continue; continue;
dims[i] = oacc_get_default_dim (i); dims[i] = (i == GOMP_DIM_VECTOR
? default_vector_length
: oacc_get_default_dim (i));
} }
nvptx_apply_dim_limits (dims); nvptx_apply_dim_limits (dims);
......
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