summaryrefslogtreecommitdiff
path: root/gcc/config/nvptx/nvptx.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2015-11-04 20:48:05 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2015-11-04 20:48:05 +0000
commitccc8282babb2336eab6457a0541a884348c7bafb (patch)
treede1b37438999069c57346d089b4b0fe252206895 /gcc/config/nvptx/nvptx.c
parenta3afde42598578a00cd15c98e70c14f704bc39ae (diff)
downloadgcc-ccc8282babb2336eab6457a0541a884348c7bafb.tar.gz
nvptx.c (nvptx_goacc_validate_dims): Add checking.
gcc/ * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Add checking. libgomp/ * testsuite/libgomp.oacc-fortran/reduction-1.f90: Fix dimensions and reduction copy. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-c-c++-common/par-reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: New. From-SVN: r229780
Diffstat (limited to 'gcc/config/nvptx/nvptx.c')
-rw-r--r--gcc/config/nvptx/nvptx.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 79ef4f703fe..dafb6954690 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -3472,8 +3472,29 @@ nvptx_goacc_validate_dims (tree ARG_UNUSED (decl), int *ARG_UNUSED (dims),
{
bool changed = false;
- /* TODO: Leave dimensions unaltered. Reductions need
- porting before filtering dimensions makes sense. */
+ /* The vector size must be 32, unless this is a SEQ routine. */
+ if (fn_level <= GOMP_DIM_VECTOR
+ && dims[GOMP_DIM_VECTOR] != PTX_VECTOR_LENGTH)
+ {
+ if (dims[GOMP_DIM_VECTOR] >= 0 && fn_level < 0)
+ warning_at (DECL_SOURCE_LOCATION (decl), 0,
+ dims[GOMP_DIM_VECTOR]
+ ? "using vector_length (%d), ignoring %d"
+ : "using vector_length (%d), ignoring runtime setting",
+ PTX_VECTOR_LENGTH, dims[GOMP_DIM_VECTOR]);
+ dims[GOMP_DIM_VECTOR] = PTX_VECTOR_LENGTH;
+ changed = true;
+ }
+
+ /* Check the num workers is not too large. */
+ if (dims[GOMP_DIM_WORKER] > PTX_WORKER_LENGTH)
+ {
+ warning_at (DECL_SOURCE_LOCATION (decl), 0,
+ "using num_workers (%d), ignoring %d",
+ PTX_WORKER_LENGTH, dims[GOMP_DIM_WORKER]);
+ dims[GOMP_DIM_WORKER] = PTX_WORKER_LENGTH;
+ changed = true;
+ }
return changed;
}