From patchwork Thu Jun 4 18:07:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1303681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49dDJr5Hkfz9sSc for ; Fri, 5 Jun 2020 04:07:39 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4C56A388B014; Thu, 4 Jun 2020 18:07:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id D2DAD385DC14; Thu, 4 Jun 2020 18:07:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D2DAD385DC14 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Thomas_Schwinge@mentor.com IronPort-SDR: 1tO/bIZDiM/uzxlnmCXcN2h3IQ+bQqgc9mFWz5MPGz/qkBIiJ4IzFunrpu9iEvPvlNy39zVrDK h4EO2EHxUlCw8NJ3k9lByjXC2uduPr0e0aTO1xv4dAODKUCjXATwsl5rWXWdDd2eKzDGM+rt3W i5+lZ0oXWHbCWQKYss7Q88oQh2vq8SNDzArtK+U7y5ikHXIKraFxJc2XDOuplMj5ToUe65q1G+ LWCmoqfKfWD1+GZiNC0g7+jtz7Fhtn+eRqcO/LU8srY4gkLBjBsoZxF4BYT0Czbpz4OqPmvUkn 4zY= X-IronPort-AV: E=Sophos;i="5.73,472,1583222400"; d="scan'208,223";a="51582762" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 04 Jun 2020 10:07:19 -0800 IronPort-SDR: jVjU8KcvSlYFkhl74aPf6LcyOEjG2I3QjXffvMIxa07eXt87aZ/TUR4p+b3yoEdgHsNeHIIwfu uckd9eyzTBxeUf/AwxWAdRnPZPd8gKSvJmpFK2jUi8iFAZsSTs7dcAsNtP7MZIFkuFabAmiRks L6O90+THm6WpnBuj82VnySrZP2c1GID91Hf0tt/4/bCyDns0CviMdhKTMZmG3Nsefm59NUBuUy t6w4gIFr7LhCjxbKDZH8ol/6SZdpWBnHsIBMgvJxV4/wVeeg58n+0P1U9/Uvmheq3sprIxyvSc SsE= From: Thomas Schwinge To: Julian Brown , Subject: [OpenACC] XFAIL behavior of over-eager 'finalize' clause (was: [PATCH 00/13] OpenACC 2.6 manual deep copy support) In-Reply-To: References: User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Thu, 4 Jun 2020 20:07:09 +0200 Message-ID: <87pnaeso1e.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LOTSOFHASH, SPF_HELO_NONE, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jakub Jelinek , Tobias Burnus , fortran@gcc.gnu.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi! On 2019-12-17T22:02:25-0800, Julian Brown wrote: > This patch series provides support for OpenACC 2.6's manual deep copy > (attach/detach) feature. As I should find, there is a problem with the OpenACC 'finalize' clause: unmapping stuff it isn't supposed to (to be fixed later on), which can easily be made visible when slightly extending... > .../libgomp.oacc-fortran/deep-copy-6.f90 | 61 ++ ... this test case. And then I added some more testing; pushed "[OpenACC] XFAIL behavior of over-eager 'finalize' clause" to master branch in commit 8d7794c0a2aa6696ab1a91ef209e8a9fe2df56ac, and releases/gcc-10 branch in commit d7af812aaca41c3f7425593dcf8c36803e6a1f1e, see attached. Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter From d7af812aaca41c3f7425593dcf8c36803e6a1f1e Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 29 May 2020 21:36:27 +0200 Subject: [PATCH] [OpenACC] XFAIL behavior of over-eager 'finalize' clause libgomp/ * testsuite/libgomp.oacc-fortran/deep-copy-6.f90: XFAIL behavior of over-eager 'finalize' clause. * testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90: New file. * testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-2.F90: Likewise. * testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-2.f90: Likewise. (cherry picked from commit 8d7794c0a2aa6696ab1a91ef209e8a9fe2df56ac) --- .../deep-copy-6-no_finalize.F90 | 8 ++++ .../libgomp.oacc-fortran/deep-copy-6.f90 | 16 +++++++ .../mdc-refcount-1-1-1.f90 | 41 +++++++++++++++++ .../mdc-refcount-1-1-2.F90 | 9 ++++ .../mdc-refcount-1-2-1.f90 | 43 ++++++++++++++++++ .../mdc-refcount-1-2-2.f90 | 43 ++++++++++++++++++ .../mdc-refcount-1-3-1.f90 | 44 +++++++++++++++++++ .../mdc-refcount-1-3-2.f90 | 44 +++++++++++++++++++ .../mdc-refcount-1-4-1.f90 | 44 +++++++++++++++++++ .../mdc-refcount-1-4-2.f90 | 44 +++++++++++++++++++ 10 files changed, 336 insertions(+) create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-2.F90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-2.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-2.f90 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90 b/libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90 new file mode 100644 index 000000000000..ed4f10e7a3f8 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90 @@ -0,0 +1,8 @@ +! { dg-do run } + +/* Nullify the 'finalize' clause, which disturbs reference counting. */ +#define finalize +#include "deep-copy-6.f90" + +! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } +! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6.f90 b/libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6.f90 index 12910d0d6554..a7943d93d542 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6.f90 @@ -3,6 +3,7 @@ ! Test of attachment counters and finalize. program dtype + use openacc implicit none integer, parameter :: n = 512 type mytype @@ -36,7 +37,22 @@ program dtype end do !$acc end parallel loop + if (.not. acc_is_present(var%a(5:n - 5))) stop 11 + if (.not. acc_is_present(var%b(5:n - 5))) stop 12 + if (.not. acc_is_present(var)) stop 13 !$acc exit data copyout(var%a(5:n - 5), var%b(5:n - 5)) finalize + if (acc_get_device_type() .ne. acc_device_host) then + if (acc_is_present(var%a(5:n - 5))) stop 21 + if (acc_is_present(var%b(5:n - 5))) stop 22 + end if + print *, "CheCKpOInT1" + ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } + if (.not. acc_is_present(var)) stop 23 + !TODO { dg-output "STOP 23(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. + print *, "CheCKpOInT2" + ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } !$acc end data diff --git a/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90 new file mode 100644 index 000000000000..449a6cf6894e --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90 @@ -0,0 +1,41 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +! Adapted from 'libgomp.oacc-fortran/deep-copy-6.f90'. + +program main + use openacc + implicit none + integer, parameter :: n = 512 + type mytype + integer, allocatable :: a(:) + end type mytype + type(mytype) :: var + + allocate(var%a(1:n)) + + !$acc data create(var) + + !$acc enter data create(var%a) + + if (.not. acc_is_present(var%a)) stop 1 + if (.not. acc_is_present(var)) stop 2 + + !$acc exit data delete(var%a) finalize + if (acc_is_present(var%a)) stop 3 + print *, "CheCKpOInT1" + ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } + if (.not. acc_is_present(var)) stop 4 + !TODO { dg-output "STOP 4(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. + print *, "CheCKpOInT2" + ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } + + !$acc end data + if (acc_is_present(var%a)) stop 5 + if (acc_is_present(var)) stop 6 + + deallocate(var%a) + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-2.F90 b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-2.F90 new file mode 100644 index 000000000000..7b206ac20428 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-2.F90 @@ -0,0 +1,9 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +/* Nullify the 'finalize' clause, which disturbs reference counting. */ +#define finalize +#include "mdc-refcount-1-1-1.f90" + +! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } +! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90 new file mode 100644 index 000000000000..a7e649d30415 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90 @@ -0,0 +1,43 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +! Adapted from 'libgomp.oacc-fortran/mdc-refcount-1-1-1.f90'. + +program main + use openacc + implicit none + integer, parameter :: n = 512 + type mytype + integer, allocatable :: a(:) + end type mytype + type(mytype) :: var + + allocate(var%a(1:n)) + + !$acc data create(var) + + call acc_create(var%a) + ! After mapping via runtime API call, separately trigger attach action; see . + !$acc enter data attach(var%a) + + if (.not. acc_is_present(var%a)) stop 1 + if (.not. acc_is_present(var)) stop 2 + + !$acc exit data delete(var%a) finalize + if (acc_is_present(var%a)) stop 3 + print *, "CheCKpOInT1" + ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } + if (.not. acc_is_present(var)) stop 4 + !TODO { dg-output "STOP 4(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. + print *, "CheCKpOInT2" + ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } + + !$acc end data + if (acc_is_present(var%a)) stop 5 + if (acc_is_present(var)) stop 6 + + deallocate(var%a) + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90 new file mode 100644 index 000000000000..3402fafc7e28 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90 @@ -0,0 +1,43 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +! Copy of 'libgomp.oacc-fortran/mdc-refcount-1-2-1.f90', without 'finalize' clause. + +program main + use openacc + implicit none + integer, parameter :: n = 512 + type mytype + integer, allocatable :: a(:) + end type mytype + type(mytype) :: var + + allocate(var%a(1:n)) + + !$acc data create(var) + + call acc_create(var%a) + ! After mapping via runtime API call, separately trigger attach action; see . + !$acc enter data attach(var%a) + + if (.not. acc_is_present(var%a)) stop 1 + if (.not. acc_is_present(var)) stop 2 + + !$acc exit data delete(var%a) + if (acc_is_present(var%a)) stop 3 + print *, "CheCKpOInT1" + ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } + if (.not. acc_is_present(var)) stop 4 + !TODO { dg-output "STOP 4(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. + print *, "CheCKpOInT2" + ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } + + !$acc end data + if (acc_is_present(var%a)) stop 5 + if (acc_is_present(var)) stop 6 + + deallocate(var%a) + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90 new file mode 100644 index 000000000000..7504969d9a56 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90 @@ -0,0 +1,44 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +! Adapted from 'libgomp.oacc-fortran/mdc-refcount-1-2-1.f90'. + +program main + use openacc + implicit none + integer, parameter :: n = 512 + type mytype + integer, allocatable :: a(:) + end type mytype + type(mytype) :: var + + allocate(var%a(1:n)) + + !$acc data create(var) + + call acc_create(var%a) + ! After mapping via runtime API call, separately trigger attach action; see . + !$acc enter data attach(var%a) + + if (.not. acc_is_present(var%a)) stop 1 + if (.not. acc_is_present(var)) stop 2 + + !$acc exit data detach(var%a) + !$acc exit data delete(var%a) finalize + if (acc_is_present(var%a)) stop 3 + print *, "CheCKpOInT1" + ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } + if (.not. acc_is_present(var)) stop 4 + !TODO { dg-output "STOP 4(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. + print *, "CheCKpOInT2" + ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } + + !$acc end data + if (acc_is_present(var%a)) stop 5 + if (acc_is_present(var)) stop 6 + + deallocate(var%a) + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-2.f90 new file mode 100644 index 000000000000..3c4bbda7f665 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-2.f90 @@ -0,0 +1,44 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +! Copy of 'libgomp.oacc-fortran/mdc-refcount-1-3-1.f90', without 'finalize' clause. + +program main + use openacc + implicit none + integer, parameter :: n = 512 + type mytype + integer, allocatable :: a(:) + end type mytype + type(mytype) :: var + + allocate(var%a(1:n)) + + !$acc data create(var) + + call acc_create(var%a) + ! After mapping via runtime API call, separately trigger attach action; see . + !$acc enter data attach(var%a) + + if (.not. acc_is_present(var%a)) stop 1 + if (.not. acc_is_present(var)) stop 2 + + !$acc exit data detach(var%a) + print *, "CheCKpOInT1" + ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } + !$acc exit data delete(var%a) + !TODO { dg-output "(\n|\r\n|\r)libgomp: attach count underflow(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. + print *, "CheCKpOInT2" + ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } + if (acc_is_present(var%a)) stop 3 + if (.not. acc_is_present(var)) stop 4 + + !$acc end data + if (acc_is_present(var%a)) stop 5 + if (acc_is_present(var)) stop 6 + + deallocate(var%a) + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90 new file mode 100644 index 000000000000..fedae0db054b --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90 @@ -0,0 +1,44 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +! Adapted from 'libgomp.oacc-fortran/mdc-refcount-1-3-1.f90'. + +program main + use openacc + implicit none + integer, parameter :: n = 512 + type mytype + integer, allocatable :: a(:) + end type mytype + type(mytype) :: var + + allocate(var%a(1:n)) + + !$acc data create(var) + + call acc_create(var%a) + ! After mapping via runtime API call, separately trigger attach action; see . + !$acc enter data attach(var%a) + + if (.not. acc_is_present(var%a)) stop 1 + if (.not. acc_is_present(var)) stop 2 + + !$acc exit data detach(var%a) finalize + print *, "CheCKpOInT1" + ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } + !$acc exit data delete(var%a) + !TODO { dg-output "(\n|\r\n|\r)libgomp: struct not mapped for detach operation(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. + print *, "CheCKpOInT2" + ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } + if (acc_is_present(var%a)) stop 3 + if (.not. acc_is_present(var)) stop 4 + + !$acc end data + if (acc_is_present(var%a)) stop 5 + if (acc_is_present(var)) stop 6 + + deallocate(var%a) + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-2.f90 new file mode 100644 index 000000000000..476cd5c1beea --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-2.f90 @@ -0,0 +1,44 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +! Copy of 'libgomp.oacc-fortran/mdc-refcount-1-4-1.f90', without 'finalize' clause. + +program main + use openacc + implicit none + integer, parameter :: n = 512 + type mytype + integer, allocatable :: a(:) + end type mytype + type(mytype) :: var + + allocate(var%a(1:n)) + + !$acc data create(var) + + call acc_create(var%a) + ! After mapping via runtime API call, separately trigger attach action; see . + !$acc enter data attach(var%a) + + if (.not. acc_is_present(var%a)) stop 1 + if (.not. acc_is_present(var)) stop 2 + + !$acc exit data detach(var%a) + print *, "CheCKpOInT1" + ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } + !$acc exit data delete(var%a) + !TODO { dg-output "(\n|\r\n|\r)libgomp: attach count underflow(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. + print *, "CheCKpOInT2" + ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } + if (acc_is_present(var%a)) stop 3 + if (.not. acc_is_present(var)) stop 4 + + !$acc end data + if (acc_is_present(var%a)) stop 5 + if (acc_is_present(var)) stop 6 + + deallocate(var%a) + +end program main -- 2.26.2