diff options
author | Tom de Vries <tdevries@suse.de> | 2019-01-12 10:27:12 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2019-01-12 10:27:12 +0000 |
commit | 980af7cd8fb385f9bb818e29d08fe4af73cd2788 (patch) | |
tree | 68afdb459fee5d022c8ae35662e2aa2409f293d1 | |
parent | 46dedae6a8ea4a034761910b38f3f510dfa547b9 (diff) | |
download | gcc-980af7cd8fb385f9bb818e29d08fe4af73cd2788.zip gcc-980af7cd8fb385f9bb818e29d08fe4af73cd2788.tar.gz gcc-980af7cd8fb385f9bb818e29d08fe4af73cd2788.tar.bz2 |
[nvptx] Verify dimension limits after applying defaults
There's a problem in oacc_validate_dims that when f.i. the worker dimension
is set using -fopenacc-dim=:32, and the vector_length is set using a
"vector_length (128)" clause, the compiler combines, accepts and emits the
values, while the combination of the two is invalid.
The reason for this is that while oacc_validate_dims validates the dimensions
using targetm.goacc.validate_dims before applying default or minimum values,
it does not do so afterwards.
Work around this in the nvptx port by applying the defaults from
oacc_default_dims at the end of nvptx_goacc_validate_dims_1, as
oacc_validate_dims would do it, and then apply the dimensions limits.
2019-01-12 Tom de Vries <tdevries@suse.de>
PR middle-end/88703
* config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Apply defaults
from oacc_default_dims, as oacc_validate_dims would do it, and apply
dimensions limits.
From-SVN: r267877
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/nvptx/nvptx.c | 17 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d2f3751..80c3bf2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2019-01-12 Tom de Vries <tdevries@suse.de> + PR middle-end/88703 + * config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Apply defaults + from oacc_default_dims, as oacc_validate_dims would do it, and apply + dimensions limits. + +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. diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 89f0e56..a4c7953 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -5703,6 +5703,23 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) dims[GOMP_DIM_GANG] = PTX_DEFAULT_RUNTIME_DIM; nvptx_apply_dim_limits (dims); } + + if (offload_region_p) + { + for (i = 0; i < GOMP_DIM_MAX; i++) + { + if (!(dims[i] < 0)) + continue; + + if ((used & GOMP_DIM_MASK (i)) == 0) + /* Function oacc_validate_dims will apply the minimal dimension. */ + continue; + + dims[i] = oacc_get_default_dim (i); + } + + nvptx_apply_dim_limits (dims); + } } /* Validate compute dimensions of an OpenACC offload or routine, fill |