From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16801 invoked by alias); 12 Oct 2015 17:19:22 -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 16783 invoked by uid 89); 12 Oct 2015 17:19:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 12 Oct 2015 17:19:20 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53946) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1Zlgkn-0003fy-KQ for gcc-patches@gnu.org; Mon, 12 Oct 2015 13:19:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zlgkj-0006bI-8y for gcc-patches@gnu.org; Mon, 12 Oct 2015 13:19:17 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:54154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlgkj-0006Zn-3Z for gcc-patches@gnu.org; Mon, 12 Oct 2015 13:19:13 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Zlgkh-0004Sr-9G from Tom_deVries@mentor.com ; Mon, 12 Oct 2015 10:19:11 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Mon, 12 Oct 2015 18:19:09 +0100 Subject: Re: [committed, gomp4] Handle sequential code in kernels region patch series To: "gcc-patches@gnu.org" References: <561BEA02.6010808@mentor.com> CC: Jakub Jelinek From: Tom de Vries Message-ID: <561BEB5F.8090605@mentor.com> Date: Mon, 12 Oct 2015 17:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <561BEA02.6010808@mentor.com> Content-Type: multipart/mixed; boundary="------------030009000701060307020401" X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 X-SW-Source: 2015-10/txt/msg01155.txt.bz2 --------------030009000701060307020401 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 729 On 12/10/15 19:12, Tom de Vries wrote: > Hi, > > I've committed the following patch series. > > 1 Add get_bbs_in_oacc_kernels_region > 2 Handle sequential code in kernels region > 3 Handle sequential code in kernels region - Testcases > > The patch series adds detection of whether sequential code (that is, > code in the oacc kernels region before and after the loop that is to be > parallelized), is safe to execute in parallel. > > Bootstrapped and reg-tested on x86_64. > > I'll post the patches individually, in reply to this email. This patch adds an oacc kernels infrastructure function: extern vec get_bbs_in_oacc_kernels_region (basic_block, basic_block); Thanks, - Tom --------------030009000701060307020401 Content-Type: text/x-patch; name="0001-Add-get_bbs_in_oacc_kernels_region.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-Add-get_bbs_in_oacc_kernels_region.patch" Content-length: 2452 Add get_bbs_in_oacc_kernels_region 2015-10-12 Tom de Vries * omp-low.c (get_bbs_in_oacc_kernels_region): New function. * omp-low.h (get_bbs_in_oacc_kernels_region): Declare. --- gcc/omp-low.c | 40 ++++++++++++++++++++++++++++++++++++++++ gcc/omp-low.h | 2 ++ 2 files changed, 42 insertions(+) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 2289486..f6e0247 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -9959,6 +9959,46 @@ mark_loops_in_oacc_kernels_region (basic_block region_entry, loop->in_oacc_kernels_region = true; } +/* Return blocks in oacc kernels region delimited by REGION_ENTRY and + REGION_EXIT. */ + +vec +get_bbs_in_oacc_kernels_region (basic_block region_entry, + basic_block region_exit) +{ + bitmap excludes_bitmap = BITMAP_GGC_ALLOC (); + unsigned di; + basic_block bb; + + bitmap_clear (excludes_bitmap); + + /* Get all the blocks dominated by the region entry. That will include the + entire region. */ + vec dominated + = get_all_dominated_blocks (CDI_DOMINATORS, region_entry); + + bitmap_set_bit (excludes_bitmap, region_entry->index); + + /* Exclude all the blocks which are not in the region: the blocks dominated by + the region exit. */ + if (region_exit != NULL) + { + vec excludes + = get_all_dominated_blocks (CDI_DOMINATORS, region_exit); + FOR_EACH_VEC_ELT (excludes, di, bb) + bitmap_set_bit (excludes_bitmap, bb->index); + bitmap_clear_bit (excludes_bitmap, region_exit->index); + } + + vec bbs = vNULL; + + FOR_EACH_VEC_ELT (dominated, di, bb) + if (!bitmap_bit_p (excludes_bitmap, bb->index)) + bbs.safe_push (bb); + + return bbs; +} + /* Return the entry basic block of the oacc kernels region containing LOOP. */ basic_block diff --git a/gcc/omp-low.h b/gcc/omp-low.h index 62a7d4a..9f09bbc 100644 --- a/gcc/omp-low.h +++ b/gcc/omp-low.h @@ -34,6 +34,8 @@ extern tree get_omp_data_i (basic_block); extern bool oacc_kernels_region_entry_p (basic_block, gomp_target **); extern basic_block get_oacc_kernels_region_exit (basic_block); extern basic_block loop_get_oacc_kernels_region_entry (struct loop *); +extern vec get_bbs_in_oacc_kernels_region (basic_block, + basic_block); extern void replace_oacc_fn_attrib (tree, tree); extern tree build_oacc_routine_dims (tree); extern tree get_oacc_fn_attrib (tree); -- 1.9.1 --------------030009000701060307020401--