From patchwork Thu Apr 12 13:41:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 897667 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-476275-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mentor.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="W72tzWsQ"; 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 40MMXF5H3Wz9s32 for ; Thu, 12 Apr 2018 23:42:05 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=iC7nTW7AFjNqwa2+Y6tYdAUzRHoCyaLogZSWYzcdYfLJifF3XT bZEEVs565GRrow2lLPdR4TdNkAwrF0tA9djnSRDeJBhqrN1ecvNWf6cs1AyDyU+Y HOVaNhIgdiMEoo7f0MfPowMJSd5cnHGVV6el62Q6thJ52DcyQMO1yLhHI= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=gBfBH6f4Hb/+i5rx3/EWZvYheXU=; b=W72tzWsQocqdPCJEUQZi uNhbG+2idGkP+KFZtvpnH9iYuDupAWCEeSjmlVQIhjLi/xyqiW4JIXoXa9CgWykb m86TY6++tO1BMQkKm5BXIt56OR01p+mfZuKEPgVQtZOA5uuf/gBERO+YgubeV2Yy 5aPU90GjHXfm9UyFX1I1tWc= Received: (qmail 24884 invoked by alias); 12 Apr 2018 13:41:58 -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 24067 invoked by uid 89); 12 Apr 2018 13:41:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Apr 2018 13:41:57 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1f6cU7-0007Bx-9S from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Thu, 12 Apr 2018 06:41:55 -0700 Received: from [172.30.72.177] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 12 Apr 2018 14:41:51 +0100 To: GCC Patches CC: Cesar Philippidis From: Tom de Vries Subject: [og7, nvptx] Simplifly logic in nvptx_single Message-ID: Date: Thu, 12 Apr 2018 15:41:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Hi, this patch simplifies the logic in nvptx_single. Build x86_64 with nvptx accelerator and tested libgomp. Thanks, - Tom [nvptx] Simplifly logic in nvptx_single 2018-04-12 Tom de Vries * config/nvptx/nvptx.c (nvptx_single): Simplify init of vector variable. Add and use variable use_partitioning_p. --- gcc/config/nvptx/nvptx.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 3c48c14..547022e 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -4305,22 +4305,24 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) we should never have worker mode only. */ broadcast_data_t data; unsigned size = GET_MODE_SIZE (SImode); - bool vector = true; + bool vector = (GOMP_DIM_MASK (GOMP_DIM_VECTOR) == mask) != 0; rtx barrier = GEN_INT (0); int threads = 0; - if (GOMP_DIM_MASK (GOMP_DIM_WORKER) == mask) - vector = false; - data.base = oacc_bcast_sym; data.ptr = 0; - if (vector - && nvptx_mach_max_workers () > 1 - && cfun->machine->bcast_partition) - data.base = cfun->machine->bcast_partition; - + bool use_partitioning_p = (vector + && nvptx_mach_max_workers () > 1 + && cfun->machine->bcast_partition); + if (use_partitioning_p) + { + data.base = cfun->machine->bcast_partition; + barrier = cfun->machine->sync_bar; + threads = nvptx_mach_vector_length (); + } gcc_assert (data.base != NULL); + gcc_assert (barrier); unsigned int psize = ROUND_UP (size, oacc_bcast_align); unsigned int pnum = (nvptx_mach_vector_length () > PTX_WARP_SIZE @@ -4335,14 +4337,6 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) vector), before); - if (vector - && nvptx_mach_max_workers () > 1 - && cfun->machine->sync_bar) - { - barrier = cfun->machine->sync_bar; - threads = nvptx_mach_vector_length (); - } - /* Barrier so other workers can see the write. */ emit_insn_before (nvptx_cta_sync (barrier, threads), tail); data.offset = 0;