From patchwork Tue Mar 20 18:27:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cesar Philippidis X-Patchwork-Id: 888390 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-475059-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="B4BQJF9R"; 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 405Lz00pqdz9s12 for ; Wed, 21 Mar 2018 05:28:10 +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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=kAGUEWEyPZbVgXOMItWeu2nSbvsp34QON0TAa9zpup/TzSEIug u5S89+FG2yaF/VxIhNn/75LRGMg5dTYSTBRZ5ItnJ932lm+d7U4jGoqDxxTBGv6r DcFdE2b1HO441loXPe/YKwp1FDoeXNohVOjbVRjV3SX5ozTOq2d0OaIwQ= 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=/K+6E3RUgVhN2tgOp7/RcH1b/yI=; b=B4BQJF9RLVfsMV6GUfCT zDfjCqW8uaGp9pY3xQnjvhtf+79bs8j/03thKVPlm0kDgFyr9sy9eTbialPDa9oj fOzRlG6Y3uyeUEBA6/qJPLEpmvJFi1V1WuGFwU3YNX6+9i3m57DToQCyerdFLnq8 +zSmqDSQ3OpbjFWHJaJ5g6k= Received: (qmail 54046 invoked by alias); 20 Mar 2018 18:28:04 -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 53163 invoked by uid 89); 20 Mar 2018 18:28:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=his 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; Tue, 20 Mar 2018 18:28:01 +0000 Received: from svr-orw-mbx-04.mgc.mentorg.com ([147.34.90.204]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1eyLzL-0004sF-Uu from Cesar_Philippidis@mentor.com for gcc-patches@gcc.gnu.org; Tue, 20 Mar 2018 11:27:59 -0700 Received: from [127.0.0.1] (147.34.91.1) by SVR-ORW-MBX-04.mgc.mentorg.com (147.34.90.204) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 20 Mar 2018 11:27:57 -0700 To: "gcc-patches@gcc.gnu.org" CC: Tom de Vries From: Cesar Philippidis Subject: [og7] backport fix for PR84952 Message-ID: Date: Tue, 20 Mar 2018 11:27:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 X-ClientProxiedBy: SVR-ORW-MBX-07.mgc.mentorg.com (147.34.90.207) To SVR-ORW-MBX-04.mgc.mentorg.com (147.34.90.204) I've applied this patch to openacc-gcc-7-branch which backports Tom's fix for the nvptx bar.sync placement bug in PR84952. This patch also reverts some changes I introduced in git revision 7445a4d40. Tom's patch didn't apply cleanly because of the recent I renamed nvptx_wsync to nvptx_cta_sync so that function can be used for both large vector_lengths along with workers. Other than that, I didn't have to make any changes to his patch. Cesar 2018-03-20 Cesar Philippidis gcc/ * config/nvptx/nvptx.c (nvptx_single): Revert changes from 7445a4d40. Backport from trunk: 2018-03-20 Tom de Vries PR target/84952 * config/nvptx/nvptx.c (nvptx_single): Don't neuter bar.sync. (nvptx_process_pars): Emit bar.sync asap and alap. diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 070d236fa87..b7e3f59fed7 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -3988,7 +3988,9 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) while (true) { /* Find first insn of from block. */ - while (head != BB_END (from) && !INSN_P (head)) + while (head != BB_END (from) + && (!INSN_P (head) + || recog_memoized (head) == CODE_FOR_nvptx_barsync)) head = NEXT_INSN (head); if (from == to) @@ -4037,6 +4039,7 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) { default: break; + case CODE_FOR_nvptx_barsync: case CODE_FOR_nvptx_fork: case CODE_FOR_nvptx_forked: case CODE_FOR_nvptx_joining: @@ -4056,15 +4059,6 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) return; } - /* NVPTX_BARSYNC barriers are placed immediately before NVPTX_JOIN - in order to ensure that all of the threads in a CTA reach the - barrier. Don't nueter BLOCK if head is NVPTX_BARSYNC and tail is - NVPTX_JOIN. */ - if (from == to - && recog_memoized (head) == CODE_FOR_nvptx_barsync - && recog_memoized (tail) == CODE_FOR_nvptx_join) - return; - /* Insert the vector test inside the worker test. */ unsigned mode; rtx_insn *before = tail; @@ -4112,17 +4106,7 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) br = gen_br_true (pred, label); else br = gen_br_true_uni (pred, label); - - if (recog_memoized (head) == CODE_FOR_nvptx_forked - && recog_memoized (NEXT_INSN (head)) == CODE_FOR_nvptx_barsync) - { - head = NEXT_INSN (head); - emit_insn_after (br, head); - } - else if (recog_memoized (head) == CODE_FOR_nvptx_barsync) - emit_insn_after (br, head); - else - emit_insn_before (br, head); + emit_insn_before (br, head); LABEL_NUSES (label)++; if (tail_branch) @@ -4348,7 +4332,7 @@ nvptx_process_pars (parallel *par) if (!empty || !is_call) { /* Insert begin and end synchronizations. */ - emit_insn_after (nvptx_cta_sync (false), par->forked_insn); + emit_insn_before (nvptx_cta_sync (false), par->forked_insn); emit_insn_before (nvptx_cta_sync (true), par->join_insn); } }