From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 4F06E395B059; Wed, 24 Feb 2021 21:57:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4F06E395B059 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Julian_Brown@mentor.com IronPort-SDR: k4jHu2x6RFZ7RbgjMM2jz7ihL14n3S2ooR2vVgAOg+L/XRdKYjPyhUtiu3cfk+0QcuU+ASCsGV Izxo+2xGfKEiudJVzMbEIihuiBN/2dHiU/ebszW6DRGz9Xjp+xhhPrx/rEGAvP1Kxh8KGg3kpP mneqQ/hoNCrSxzGujAYq8kpHkSwWkYO2Bzt3X+batdENFxsSBczuuvIdL548Sik/z79IcHVMRC tXO3pdzP9gwIMNqi7jdmPmEcLX4cKFqwCCWSnUofYHqPHnzvqTMXKHitcpWoa/Z5JrUiuvw0g+ pAY= X-IronPort-AV: E=Sophos;i="5.81,203,1610438400"; d="scan'208";a="58597698" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 24 Feb 2021 13:57:48 -0800 IronPort-SDR: eTrWruJxUY8fdsq+DSIzXFKimBsPJRB65UCUu907ZGuJp7IQfolaM8i0XtWYbSEjGATL09suJc l0tUoe+VdRd+MXMZG1zfQk1vz+Mgamu9qFIGd0S2U/xIjXhFqQBJafNH0PTPD/uzLEKyZMhZDF ZrhpVSG3+6fYguJlDzZPG/9E+q5PGoXsM7xqN+fKvaNp4yv0MuakXoPBzic0UsbEJt1Twzjet8 qIQ9Lc8Bshqwzv4UKqzRnvpfsMNpZ/WVPhChHbVdLwD26JfYphl7ctio3sh9b+hyu/z6WrBCcX FBc= From: Julian Brown To: CC: , Tobias Burnus Subject: [PATCH 3/7] [og10] openacc: Character types and mixed arrays/derived type tests Date: Wed, 24 Feb 2021 13:57:24 -0800 Message-ID: <20210224215726.129681-4-julian@codesourcery.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210224215726.129681-1-julian@codesourcery.com> References: <20210224215726.129681-1-julian@codesourcery.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2021 21:57:51 -0000 This patch adds some tests for character types that are components of derived types used in OpenACC data-movement clauses (some of which currently fail and are thus XFAILed), and tests (also XFAILed) mixing arrays and derived types. The XFAILs are addressed by follow-on patches. Originally a combination of several mainline patches. (cherry picked from commit b2d84e9f9cccbe4ee662f7002b83105629d09939) (cherry picked from commit 9a4d32f85ccebc0ee4b24e6d9d7a4f11c04d7146) (cherry picked from commit b0fb2720d88d680af18981a2097397196b505a1f) (cherry picked from commit f7fb2f662fe12f327ece8b034ab76b36fdca4696) gcc/testsuite/ * gfortran.dg/goacc/array-with-dt-2.f90: New test. * gfortran.dg/goacc/derived-chartypes-1.f90: Likewise. * gfortran.dg/goacc/derived-chartypes-2.f90: Likewise. * gfortran.dg/goacc/derived-chartypes-3.f90: Likewise. * gfortran.dg/goacc/derived-chartypes-4.f90: Likewise. libgomp/ * testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: New test. --- gcc/testsuite/ChangeLog.omp | 10 ++ .../gfortran.dg/goacc/array-with-dt-2.f90 | 11 ++ .../gfortran.dg/goacc/derived-chartypes-1.f90 | 132 ++++++++++++++++++ .../gfortran.dg/goacc/derived-chartypes-2.f90 | 132 ++++++++++++++++++ .../gfortran.dg/goacc/derived-chartypes-3.f90 | 38 +++++ .../gfortran.dg/goacc/derived-chartypes-4.f90 | 38 +++++ libgomp/ChangeLog.omp | 6 + .../array-stride-dt-1.f90 | 45 ++++++ 8 files changed, 412 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 create mode 100644 gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 create mode 100644 gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 create mode 100644 gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90 diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index 8caef33f95e4..e04a4ee3ebff 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,3 +1,13 @@ +2021-02-24 Julian Brown + + Backport from mainline + + * gfortran.dg/goacc/array-with-dt-2.f90: New test. + * gfortran.dg/goacc/derived-chartypes-1.f90: Likewise. + * gfortran.dg/goacc/derived-chartypes-2.f90: Likewise. + * gfortran.dg/goacc/derived-chartypes-3.f90: Likewise. + * gfortran.dg/goacc/derived-chartypes-4.f90: Likewise. + 2021-02-24 Julian Brown Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 new file mode 100644 index 000000000000..e4a6f319772c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 @@ -0,0 +1,11 @@ +type t + integer, allocatable :: A(:,:) +end type t + +type(t), allocatable :: b(:) + +! TODO: Remove expected errors when this is supported. +!$acc update host(b(::2)) ! { dg-error "Stride should not be specified for array section in MAP clause" } +!$acc update host(b(1)%A(::3,::4)) ! { dg-error "Stride should not be specified for array section in MAP clause" } +end + diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 new file mode 100644 index 000000000000..f7aafbfc036f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 @@ -0,0 +1,132 @@ +! This currently ICEs. Avoid that. +! { dg-skip-if "PR98979" { *-*-* } } + +type :: type1 + character(len=35) :: a +end type type1 + +type :: type2 + character(len=35), pointer :: b +end type type2 + +type :: aux1 + character(len=22) :: y +end type aux1 + +type, extends(aux1) :: aux + character(len=33) :: x +end type aux + +type :: type3 + class(aux), pointer :: c(:) +end type type3 + +type :: type4 + integer, pointer :: d(:) +end type type4 + +type :: type5 + type(aux1) :: e +end type type5 + +type :: type6 + type(aux1), pointer :: f +end type type6 + +type :: type7 + class(aux), pointer :: g +end type type7 + +type(type1) :: foo +type(type2) :: bar +type(type3) :: qux +type(type4) :: quux +type(type5) :: fred +type(type6) :: jim +type(type7) :: shiela + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar +type(type3), pointer :: pqux +type(type4), pointer :: pquux +type(type5), pointer :: pfred +type(type6), pointer :: pjim +type(type7), pointer :: pshiela + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar +class(type3), pointer :: cqux +class(type4), pointer :: cquux +class(type5), pointer :: cfred +class(type6), pointer :: cjim +class(type7), pointer :: cshiela + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar +class(type3), allocatable :: acqux +class(type4), allocatable :: acquux +class(type5), allocatable :: acfred +class(type6), allocatable :: acjim +class(type7), allocatable :: acshiela + +!$acc enter data copyin(foo) +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar) +!$acc enter data copyin(bar%b) +!$acc enter data copyin(qux) +!$acc enter data copyin(qux%c) +!$acc enter data copyin(quux) +!$acc enter data copyin(quux%d) +!$acc enter data copyin(fred) +!$acc enter data copyin(fred%e) +!$acc enter data copyin(jim) +!$acc enter data copyin(jim%f) +!$acc enter data copyin(shiela) +!$acc enter data copyin(shiela%g) + +!$acc enter data copyin(pfoo) +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar) +!$acc enter data copyin(pbar%b) +!$acc enter data copyin(pqux) +!$acc enter data copyin(pqux%c) +!$acc enter data copyin(pquux) +!$acc enter data copyin(pquux%d) +!$acc enter data copyin(pfred) +!$acc enter data copyin(pfred%e) +!$acc enter data copyin(pjim) +!$acc enter data copyin(pjim%f) +!$acc enter data copyin(pshiela) +!$acc enter data copyin(pshiela%g) + +!$acc enter data copyin(cfoo) +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar) +!$acc enter data copyin(cbar%b) +!$acc enter data copyin(cqux) +!$acc enter data copyin(cqux%c) +!$acc enter data copyin(cquux) +!$acc enter data copyin(cquux%d) +!$acc enter data copyin(cfred) +!$acc enter data copyin(cfred%e) +!$acc enter data copyin(cjim) +!$acc enter data copyin(cjim%f) +!$acc enter data copyin(cshiela) +!$acc enter data copyin(cshiela%g) + +!$acc enter data copyin(acfoo) +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar) +!$acc enter data copyin(acbar%b) +!$acc enter data copyin(acqux) +!$acc enter data copyin(acqux%c) +!$acc enter data copyin(acquux) +!$acc enter data copyin(acquux%d) +!$acc enter data copyin(acfred) +!$acc enter data copyin(acfred%e) +!$acc enter data copyin(acjim) +!$acc enter data copyin(acjim%f) +!$acc enter data copyin(acshiela) +!$acc enter data copyin(acshiela%g) + +end diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 new file mode 100644 index 000000000000..e22fc679df2b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 @@ -0,0 +1,132 @@ +! This currently ICEs. Avoid that. +! { dg-skip-if "PR98979" { *-*-* } } + +type :: type1 + character(len=35,kind=4) :: a +end type type1 + +type :: type2 + character(len=35,kind=4), pointer :: b +end type type2 + +type :: aux1 + character(len=22,kind=4) :: y +end type aux1 + +type, extends(aux1) :: aux + character(len=33,kind=4) :: x +end type aux + +type :: type3 + class(aux), pointer :: c(:) +end type type3 + +type :: type4 + integer, pointer :: d(:) +end type type4 + +type :: type5 + type(aux1) :: e +end type type5 + +type :: type6 + type(aux1), pointer :: f +end type type6 + +type :: type7 + class(aux), pointer :: g +end type type7 + +type(type1) :: foo +type(type2) :: bar +type(type3) :: qux +type(type4) :: quux +type(type5) :: fred +type(type6) :: jim +type(type7) :: shiela + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar +type(type3), pointer :: pqux +type(type4), pointer :: pquux +type(type5), pointer :: pfred +type(type6), pointer :: pjim +type(type7), pointer :: pshiela + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar +class(type3), pointer :: cqux +class(type4), pointer :: cquux +class(type5), pointer :: cfred +class(type6), pointer :: cjim +class(type7), pointer :: cshiela + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar +class(type3), allocatable :: acqux +class(type4), allocatable :: acquux +class(type5), allocatable :: acfred +class(type6), allocatable :: acjim +class(type7), allocatable :: acshiela + +!$acc enter data copyin(foo) +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar) +!$acc enter data copyin(bar%b) +!$acc enter data copyin(qux) +!$acc enter data copyin(qux%c) +!$acc enter data copyin(quux) +!$acc enter data copyin(quux%d) +!$acc enter data copyin(fred) +!$acc enter data copyin(fred%e) +!$acc enter data copyin(jim) +!$acc enter data copyin(jim%f) +!$acc enter data copyin(shiela) +!$acc enter data copyin(shiela%g) + +!$acc enter data copyin(pfoo) +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar) +!$acc enter data copyin(pbar%b) +!$acc enter data copyin(pqux) +!$acc enter data copyin(pqux%c) +!$acc enter data copyin(pquux) +!$acc enter data copyin(pquux%d) +!$acc enter data copyin(pfred) +!$acc enter data copyin(pfred%e) +!$acc enter data copyin(pjim) +!$acc enter data copyin(pjim%f) +!$acc enter data copyin(pshiela) +!$acc enter data copyin(pshiela%g) + +!$acc enter data copyin(cfoo) +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar) +!$acc enter data copyin(cbar%b) +!$acc enter data copyin(cqux) +!$acc enter data copyin(cqux%c) +!$acc enter data copyin(cquux) +!$acc enter data copyin(cquux%d) +!$acc enter data copyin(cfred) +!$acc enter data copyin(cfred%e) +!$acc enter data copyin(cjim) +!$acc enter data copyin(cjim%f) +!$acc enter data copyin(cshiela) +!$acc enter data copyin(cshiela%g) + +!$acc enter data copyin(acfoo) +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar) +!$acc enter data copyin(acbar%b) +!$acc enter data copyin(acqux) +!$acc enter data copyin(acqux%c) +!$acc enter data copyin(acquux) +!$acc enter data copyin(acquux%d) +!$acc enter data copyin(acfred) +!$acc enter data copyin(acfred%e) +!$acc enter data copyin(acjim) +!$acc enter data copyin(acjim%f) +!$acc enter data copyin(acshiela) +!$acc enter data copyin(acshiela%g) + +end diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 new file mode 100644 index 000000000000..2bab497cef5d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 @@ -0,0 +1,38 @@ +! { dg-additional-options "-fdump-tree-gimple" } + +type :: type1 + character(len=35) :: a +end type type1 + +type :: type2 + character(len=46), pointer :: b +end type type2 + +type(type1) :: foo +type(type2) :: bar + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar + +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar%b) + +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar%b) + +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar%b) + +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar%b) + +! { dg-final { scan-tree-dump-times "to:\[^\\\[\]*\\\[len: 35\\\]" 4 "gimple" } } +! { dg-final { scan-tree-dump-times "to:\[^\\\[\]*\\\[len: 46\\\]" 4 "gimple" } } + +end diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 new file mode 100644 index 000000000000..cfe40066a595 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 @@ -0,0 +1,38 @@ +! { dg-additional-options "-fdump-tree-gimple" } + +type :: type1 + character(len=35,kind=4) :: a +end type type1 + +type :: type2 + character(len=46,kind=4), pointer :: b +end type type2 + +type(type1) :: foo +type(type2) :: bar + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar + +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar%b) + +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar%b) + +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar%b) + +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar%b) + +! { dg-final { scan-tree-dump-times "to:\[^\\\[\]*\\\[len: 140\\\]" 4 "gimple" } } +! { dg-final { scan-tree-dump-times "to:\[^\\\[\]*\\\[len: 184\\\]" 4 "gimple" } } + +end diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index addab7d05c5f..db6ac79fe123 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,9 @@ +2021-02-24 Julian Brown + + Backport from mainline + + * testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: New test. + 2021-02-09 Kwok Cheung Yeung Backport from mainline diff --git a/libgomp/testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90 new file mode 100644 index 000000000000..61250708197d --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90 @@ -0,0 +1,45 @@ +! { dg-do run } + +type t + integer, allocatable :: A(:,:) +end type t + +type(t), allocatable :: b(:) + +integer :: i + +allocate(b(1:20)) +do i=1,20 + allocate(b(i)%A(1:20,1:20)) +end do + +do i=1,20 + b(i)%A(:,:) = 0 +end do + +!$acc enter data copyin(b) +do i=1,20 + !$acc enter data copyin(b(i)%A) +end do + +b(1)%A(:,:) = 5 + +! TODO: Remove expected errors once this is supported. +!$acc update device(b(::2)) ! { dg-error "Stride should not be specified for array section in MAP clause" } +!$acc update device(b(1)%A(::3,::4)) ! { dg-error "Stride should not be specified for array section in MAP clause" } + +do i=1,20 + !$acc exit data copyout(b(i)%A) +end do +!$acc exit data copyout(b) + +! This is necessarily conservative because the "update" is allowed to copy +! e.g. the whole of the containing block for a discontinuous update. +! Try to ensure that the update covers a sufficient portion of the array. + +if (any(b(1)%A(::3,::4) .ne. 5)) stop 1 +do i=2,20 + if (any(b(i)%A(:,:) .ne. 0)) stop 2 +end do + +end -- 2.29.2