From: Tom de Vries Date: Sat, 12 Jan 2019 10:27:23 +0000 (+0000) Subject: [nvptx] Allow default vl to be overridden in nvptx_goacc_validate_dims_1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d6f528e70ad88ddcc9786e6050d92e003d19d0a3;p=gcc.git [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 * config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Add an use new variable default_vector_length. From-SVN: r267878 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 80c3bf25fe0..87697c47ac1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-01-12 Tom de Vries + + * config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Add an use new + variable default_vector_length. + 2019-01-12 Tom de Vries PR middle-end/88703 diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index a4c79532a1d..95d72d0a4e0 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -5556,6 +5556,7 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) bool offload_region_p = false; bool routine_p = false; bool routine_seq_p = false; + int default_vector_length = -1; if (decl == NULL_TREE) { @@ -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); } + 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]; unsigned int 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) if (dims[GOMP_DIM_VECTOR] == 0) { 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 && !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); @@ -5696,7 +5703,7 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) 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) dims[GOMP_DIM_WORKER] = PTX_DEFAULT_RUNTIME_DIM; if (dims[GOMP_DIM_GANG] < 0) @@ -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. */ 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);