From patchwork Sat Jan 12 10:29:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 1023879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-493921-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="C+A3hX+E"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43cGF83jpSz9s9h for ; Sat, 12 Jan 2019 21:29:29 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=Ya4E1QkZQ6+QPlVhlav3wEpxmDWvrEUkLf3N3rr+Ga+OSZ54G5 VOalK9xu284nz1cHxbEsCuzRt1VaNvmSj4vXVgn2ZffG115oxUbeh/NJPbpDssOS urBVbwcuEp5PQp10LEQFmBSyl5UDfOYEWkLdcSGZCD9SNVu8yvHNFJ+M4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=/Xf9Xgx6+L1Zm+dzW/6fdAf7Tjo=; b=C+A3hX+EUUfsOVS1lhj2 2EFRmP8sj04oeHPTFvWVjZ+lL2y9V1uxYDpPDETSNcsXnbhczl4dPnFEe8V/p/Ui Uq8RrcCg2xLf0CjUA7kVqKZx0tEg5aNa2SaEcyMnoENORz05hO2UNIToE4T7y+TX wqEM1j2/k5q//pWFvT8ictU= Received: (qmail 101897 invoked by alias); 12 Jan 2019 10:29:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101878 invoked by uid 89); 12 Jan 2019 10:29:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=target.def, UD:target.def, partitioned, targetdef X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 12 Jan 2019 10:29:19 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 07D06AD0F; Sat, 12 Jan 2019 10:29:17 +0000 (UTC) Date: Sat, 12 Jan 2019 11:29:37 +0100 From: Tom de Vries To: gcc-patches@gcc.gnu.org Cc: Thomas Schwinge Subject: [committed][openacc] Add used parameter to TARGET_GOACC_VALIDATE_DIMS Message-ID: <20190112102936.GA11343@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, Add a used parameter to TARGET_GOACC_VALIDATE_DIMS, allowing a target to make decisions in the hook implementation based on whether a dimension is used or not. Committed to trunk. Thanks, - Tom [openacc] Add used parameter to TARGET_GOACC_VALIDATE_DIMS 2019-01-11 Tom de Vries * config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1) (nvptx_goacc_validate_dims): Add used parameter. * doc/tm.texi: Regenerate. * omp-offload.c (oacc_parse_default_dims, oacc_validate_dims): Add argument to call to targetm.goacc.validate_dims. (default_goacc_validate_dims): Add used parameter. * target.def (validate_dims): Add used parameter in DEFHOOK. * targhooks.h (default_goacc_validate_dims): Add used parameter. --- gcc/config/nvptx/nvptx.c | 6 +++--- gcc/doc/tm.texi | 2 +- gcc/omp-offload.c | 9 +++++---- gcc/target.def | 2 +- gcc/targhooks.h | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index b37010ff58e..89f0e560910 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -5549,7 +5549,7 @@ has_vector_partitionable_routine_calls_p (tree fndecl) DIMS has changed. */ static void -nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level) +nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used) { bool oacc_default_dims_p = false; bool oacc_min_dims_p = false; @@ -5711,7 +5711,7 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level) DECL is null, we are validating the default dimensions. */ static bool -nvptx_goacc_validate_dims (tree decl, int dims[], int fn_level) +nvptx_goacc_validate_dims (tree decl, int dims[], int fn_level, unsigned used) { int old_dims[GOMP_DIM_MAX]; unsigned int i; @@ -5719,7 +5719,7 @@ nvptx_goacc_validate_dims (tree decl, int dims[], int fn_level) for (i = 0; i < GOMP_DIM_MAX; ++i) old_dims[i] = dims[i]; - nvptx_goacc_validate_dims_1 (decl, dims, fn_level); + nvptx_goacc_validate_dims_1 (decl, dims, fn_level, used); gcc_assert (dims[GOMP_DIM_VECTOR] != 0); if (dims[GOMP_DIM_WORKER] > 0 && dims[GOMP_DIM_VECTOR] > 0) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index ddde4a7287b..355fd5917af 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6071,7 +6071,7 @@ to use it. Return number of threads in SIMT thread group on the target. @end deftypefn -@deftypefn {Target Hook} bool TARGET_GOACC_VALIDATE_DIMS (tree @var{decl}, int *@var{dims}, int @var{fn_level}) +@deftypefn {Target Hook} bool TARGET_GOACC_VALIDATE_DIMS (tree @var{decl}, int *@var{dims}, int @var{fn_level}, unsigned @var{used}) This hook should check the launch dimensions provided for an OpenACC compute region, or routine. Defaulted values are represented as -1 and non-constant values as 0. The @var{fn_level} is negative for the diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c index 9cac5655c63..201c459fa1f 100644 --- a/gcc/omp-offload.c +++ b/gcc/omp-offload.c @@ -644,8 +644,8 @@ oacc_parse_default_dims (const char *dims) } /* Allow the backend to validate the dimensions. */ - targetm.goacc.validate_dims (NULL_TREE, oacc_default_dims, -1); - targetm.goacc.validate_dims (NULL_TREE, oacc_min_dims, -2); + targetm.goacc.validate_dims (NULL_TREE, oacc_default_dims, -1, 0); + targetm.goacc.validate_dims (NULL_TREE, oacc_min_dims, -2, 0); } /* Validate and update the dimensions for offloaded FN. ATTRS is the @@ -673,7 +673,7 @@ oacc_validate_dims (tree fn, tree attrs, int *dims, int level, unsigned used) pos = TREE_CHAIN (pos); } - bool changed = targetm.goacc.validate_dims (fn, dims, level); + bool changed = targetm.goacc.validate_dims (fn, dims, level, used); /* Default anything left to 1 or a partitioned default. */ for (ix = 0; ix != GOMP_DIM_MAX; ix++) @@ -1717,7 +1717,8 @@ execute_oacc_device_lower () bool default_goacc_validate_dims (tree ARG_UNUSED (decl), int *dims, - int ARG_UNUSED (fn_level)) + int ARG_UNUSED (fn_level), + unsigned ARG_UNUSED (used)) { bool changed = false; diff --git a/gcc/target.def b/gcc/target.def index 2aeb1ff8445..32830a1b33c 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1686,7 +1686,7 @@ are being validated and unspecified defaults should be filled in.\n\ Diagnostics should be issued as appropriate. Return\n\ true, if changes have been made. You must override this hook to\n\ provide dimensions larger than 1.", -bool, (tree decl, int *dims, int fn_level), +bool, (tree decl, int *dims, int fn_level, unsigned used), default_goacc_validate_dims) DEFHOOK diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 3b6e404f080..fb133fd3f3f 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -121,7 +121,7 @@ extern void default_finish_cost (void *, unsigned *, unsigned *, unsigned *); extern void default_destroy_cost_data (void *); /* OpenACC hooks. */ -extern bool default_goacc_validate_dims (tree, int [], int); +extern bool default_goacc_validate_dims (tree, int [], int, unsigned); extern int default_goacc_dim_limit (int); extern bool default_goacc_fork_join (gcall *, const int [], bool); extern void default_goacc_reduction (gcall *);