From patchwork Wed Jul 15 16:58:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 495911 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 B6D141402A0 for ; Thu, 16 Jul 2015 02:58:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=qCfilKlI; 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=GS/IY0Y5WucF1UA/H poYkddZ06sXUi44KDcRme6zMm6z83fpCjsm5FbM57PpRUO6DJ+adfPvDAk6Hm/Nw LVIFabz8/4Yj3Stwu1vCjo1R4MidgxK38yD2U0v5p9d1QFUG4PEAOfoqnsO7V81X DKpRAyyi39f9wbGVrw+WrR02AY= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=8wvz0cs8P/Y30RLWjnZetni EWUc=; b=qCfilKlInoYE2XYzhc7i/jhgY4XO6yrZ9MTnfazFjo2y6HW6NjY9eBD mZKVOHN4vmtyo7sRtmIKS59FPMizpcLX6TlzN6yDddNfE41eS7EqhTnnBRDQViqg v3KNwCseiH5sEXKhP+J7Bv37tS35eDi3Z68d9XKSIvqLG6Hr9xIk= Received: (qmail 66630 invoked by alias); 15 Jul 2015 16:58:32 -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 66618 invoked by uid 89); 15 Jul 2015 16:58:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 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; Wed, 15 Jul 2015 16:58:30 +0000 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 1ZFQ0o-0002NS-HV from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Wed, 15 Jul 2015 09:58:26 -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; Wed, 15 Jul 2015 17:58:24 +0100 Message-ID: <55A69126.3050608@mentor.com> Date: Wed, 15 Jul 2015 18:58:14 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Thomas Schwinge , James Norris , Tom de Vries CC: Subject: [committed] Add kernels-loop-nest-independent.f95 References: <55A55E89.9020601@codesourcery.com> <87wpy13h2n.fsf@schwinge.name> <55A63939.1080402@mentor.com> In-Reply-To: <55A63939.1080402@mentor.com> [ was: Re: [gomp4] New test loop independent clause ] On 15/07/15 12:43, Tom de Vries wrote: > I'm not sure if I mentioned it at the meeting, but marking the outer > loop of that example as independent does not result in parallelization > either. So that's something to be investigated. I've got it working now. Committed to gomp-4_0-branch. Thanks, - Tom Add kernels-loop-nest-independent.f95 2015-07-15 Tom de Vries * gfortran.dg/goacc/kernels-loop-nest-independent.f95: New test. * testsuite/libgomp.oacc-fortran/kernels-loop-nest-independent.f95: New test. diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-nest-independent.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-nest-independent.f95 new file mode 100644 index 0000000..436048e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-nest-independent.f95 @@ -0,0 +1,41 @@ +! { dg-do compile } +! { dg-additional-options "-O2" } +! { dg-additional-options "-ftree-parallelize-loops=32" } +! { dg-additional-options "-fdump-tree-parloops_oacc_kernels-all" } +! { dg-additional-options "-fdump-tree-optimized" } + +! Based on autopar/outer-1.c. + +program main + implicit none + integer, parameter :: n = 500 + integer, dimension (0:n-1, 0:n-1) :: x + integer :: i, j, ii, jj + + + !$acc kernels copyout (x) + !$acc loop independent + do ii = 0, n - 1 + do jj = 0, n - 1 + x(jj, ii) = ii + jj + 3 + end do + end do + !$acc end kernels + + do i = 0, n - 1 + do j = 0, n - 1 + if (x(i, j) .ne. i + j + 3) call abort + end do + end do + +end program main + +! Check that only one loop is analyzed, and that it can be parallelized. +! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized, marked independent" 1 "parloops_oacc_kernels" } } +! { dg-final { scan-tree-dump-not "FAILED:" "parloops_oacc_kernels" } } +! { dg-final { scan-tree-dump-times "parallelizing outer loop" 1 "parloops_oacc_kernels" } } + +! Check that the loop has been split off into a function. +! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } } + +! { dg-final { scan-tree-dump-times "(?n)pragma omp target oacc_parallel.*num_gangs\\(32\\)" 1 "parloops_oacc_kernels" } } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-nest-independent.f95 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-nest-independent.f95 new file mode 100644 index 0000000..87a3d23 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-nest-independent.f95 @@ -0,0 +1,28 @@ +! { dg-do run } +! { dg-options "-ftree-parallelize-loops=32" } + +! Based on autopar/outer-1.c. + +program main + implicit none + integer, parameter :: n = 500 + integer, dimension (0:n-1, 0:n-1) :: x + integer :: i, j, ii, jj + + + !$acc kernels copyout (x) + !$acc loop independent + do ii = 0, n - 1 + do jj = 0, n - 1 + x(jj, ii) = ii + jj + 3 + end do + end do + !$acc end kernels + + do i = 0, n - 1 + do j = 0, n - 1 + if (x(i, j) .ne. i + j + 3) call abort + end do + end do + +end program main -- 1.9.1