diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/nvptx/nvptx.c | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index db1f93f..2a2eec2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,8 @@ 2015-11-04 Nathan Sidwell <nathan@codesourcery.com> + + * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Add checking. + +2015-11-04 Nathan Sidwell <nathan@codesourcery.com> Cesar Philippidis <cesar@codesourcery.com> * config/nvptx/nvptx.c: Include gimple headers. diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 79ef4f7..dafb695 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; } |