From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 18:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------98D5A4BBB6898C0645E95A25" 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) X-SW-Source: 2018-03/txt/msg00995.txt.bz2 --------------98D5A4BBB6898C0645E95A25 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-length: 447 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 --------------98D5A4BBB6898C0645E95A25 Content-Type: text/x-patch; name="og7-toms-ptx-barriers.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="og7-toms-ptx-barriers.diff" Content-length: 2629 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); } } --------------98D5A4BBB6898C0645E95A25--