From patchwork Tue Dec 1 15:28:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Monakov X-Patchwork-Id: 550932 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 CC9AE14018C for ; Wed, 2 Dec 2015 02:29:54 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=qW3AbrNN; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=X6vxpC4jm/4ygmy6eFJZ4Bv41SLGw3iN0HsWLSWugMDWPyhce7aGj uRfLorjmqmrAFwpwyp5WM60oVn9KsiJbgMGeqL0w/v6NuiCUAcf4ucX/w1QBB9tY tyKWtu9sJteb6/11PjbY8jma8cftgQHzoxEZ++GVuef+Cl52NmDXao= 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:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=ugRlGuCGo9kqUDu3UUD2wix9+mM=; b=qW3AbrNNYOqn2CAmo4xY qeiMWX+70ySK5uKTuLZg6lh5Y4qPiT0FuixbytVwYLJJ2coCAQip02zCAYJn33ce WUc0ySz2YHl/5fDmDaO7swNsplvUHhLj95imlImIc47Inj4dOqTFnvwg381BXaMO 2UrYjCnyF8zJRxlj8oLR+PA= Received: (qmail 15085 invoked by alias); 1 Dec 2015 15:28:45 -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 14618 invoked by uid 89); 1 Dec 2015 15:28:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: smtp.ispras.ru Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.199.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Dec 2015 15:28:31 +0000 Received: from condor.intra.ispras.ru (unknown [83.149.199.91]) by smtp.ispras.ru (Postfix) with ESMTP id 6B56B20412; Tue, 1 Dec 2015 18:28:28 +0300 (MSK) Received: by condor.intra.ispras.ru (Postfix, from userid 23246) id 2D4CE1225DD5; Tue, 1 Dec 2015 18:28:28 +0300 (MSK) From: Alexander Monakov To: gcc-patches@gcc.gnu.org Cc: Jakub Jelinek , Bernd Schmidt , Dmitry Melnik Subject: [gomp-nvptx 5/9] new target hook: TARGET_SIMT_VF Date: Tue, 1 Dec 2015 18:28:23 +0300 Message-Id: <1448983707-18854-6-git-send-email-amonakov@ispras.ru> In-Reply-To: <1448983707-18854-1-git-send-email-amonakov@ispras.ru> References: <1448983707-18854-1-git-send-email-amonakov@ispras.ru> X-IsSubscribed: yes This patch adds a new target hook and implements it in a straightforward manner on NVPTX to indicate that the target is running in SIMT fashion with 32 threads in a synchronous group ("warp"). For use in OpenMP transforms. --- gcc/config/nvptx/nvptx.c | 12 ++++++++++++ gcc/doc/tm.texi | 4 ++++ gcc/doc/tm.texi.in | 2 ++ gcc/target.def | 12 ++++++++++++ 4 files changed, 30 insertions(+) diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 48ee96e..eb3b67e 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -3684,10 +3684,19 @@ nvptx_expand_builtin (tree exp, rtx target, rtx ARG_UNUSED (subtarget), } } + /* Define dimension sizes for known hardware. */ #define PTX_VECTOR_LENGTH 32 #define PTX_WORKER_LENGTH 32 +/* Implement TARGET_SIMT_VF target hook: number of threads in a warp. */ + +static int +nvptx_simt_vf () +{ + return PTX_VECTOR_LENGTH; +} + /* Validate compute dimensions of an OpenACC offload or routine, fill in non-unity defaults. FN_LEVEL indicates the level at which a routine might spawn a loop. It is negative for non-routines. */ @@ -4258,6 +4267,9 @@ nvptx_goacc_reduction (gcall *call) #undef TARGET_BUILTIN_DECL #define TARGET_BUILTIN_DECL nvptx_builtin_decl +#undef TARGET_SIMT_VF +#define TARGET_SIMT_VF nvptx_simt_vf + #undef TARGET_GOACC_VALIDATE_DIMS #define TARGET_GOACC_VALIDATE_DIMS nvptx_goacc_validate_dims diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f394db7..e54944d 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5765,6 +5765,10 @@ usable. In that case, the smaller the number is, the more desirable it is to use it. @end deftypefn +@deftypefn {Target Hook} int TARGET_SIMT_VF (void) +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}) This hook should check the launch dimensions provided for an OpenACC compute region, or routine. Defaulted values are represented as -1 diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index d188c57..44ba697c 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4260,6 +4260,8 @@ address; but often a machine-dependent strategy can generate better code. @hook TARGET_SIMD_CLONE_USABLE +@hook TARGET_SIMT_VF + @hook TARGET_GOACC_VALIDATE_DIMS @hook TARGET_GOACC_DIM_LIMIT diff --git a/gcc/target.def b/gcc/target.def index c7ec292..f5a03d6 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1639,6 +1639,18 @@ int, (struct cgraph_node *), NULL) HOOK_VECTOR_END (simd_clone) +/* Functions relating to OpenMP SIMT vectorization transform. */ +#undef HOOK_PREFIX +#define HOOK_PREFIX "TARGET_SIMT_" +HOOK_VECTOR (TARGET_SIMT, simt) + +DEFHOOK +(vf, +"Return number of threads in SIMT thread group on the target.", +int, (void), NULL) + +HOOK_VECTOR_END (simt) + /* Functions relating to openacc. */ #undef HOOK_PREFIX #define HOOK_PREFIX "TARGET_GOACC_"