From patchwork Thu Jun 6 12:17:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1944606 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=Mi1XQcr4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vw3J76g5rz20PW for ; Thu, 6 Jun 2024 22:17:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 492CD39000F8 for ; Thu, 6 Jun 2024 12:17:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id B423238FF6D2 for ; Thu, 6 Jun 2024 12:17:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B423238FF6D2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B423238FF6D2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717676249; cv=none; b=iQZTUR6QUefm7xzPEI/e5jfzbm7MRqhKBaMO5i36xmfXX3y5IGqi4k1M98FQuDul3Xx5dWLhM9tBLFuaqTTd0mPGvMiSFTBeDghChsofY4vNcr9Eft5GtvgaZj3aUWo9NpACnDsXV3tskPnzcgY7Ajt2yZlR7CJC8PAXlNAgukA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717676249; c=relaxed/simple; bh=O6AfvDITa0ya1P1cHhVzIiL6/VE0dPIOW0AfQ99eTQA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XJmkoswIZeR4C+vRY6Noe61FuD8m0mP69f0tmlvTohOQEYH0/i234xh/HGOytY4d5hOgydm7ClmYWMAvXoCDR34OmGRfURt0FIAToNn5gxs1ATDe2XYbDse9cu5WWG77Qm7tOLFWWzj5MlcPYsFkHT2p6C8FWI4b0GLZxrr4fvU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4215b0c4b7dso9720135e9.0 for ; Thu, 06 Jun 2024 05:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717676244; x=1718281044; darn=gcc.gnu.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=zKrLANPAKfyGUWQ5fX9V6W8roVxyG0favdc9WS22mmI=; b=Mi1XQcr4vbCMD05mg/ycdnKiJWfc7HcHrNus5oHiazOhgRBDEhD9QTKn6PBLiSj49M vIunTVvatxFWZDl2JJJ7VzxQWbKmeS6yWDnH7SvldK54S+++MMxIMmF0HBDvjCiecOsW 2mJxw4zMqBH9x6iv69qpY3RciR83Oxonv5zC2A4DNeHWdbBxdfpGvfJ+zntwLsCW9c3S gS+G3iw5F7KG2/uwZkuBQenPrF1BHSF9GX8m3ffpFXQq6tbMx3MI8FMK6gm826tkvCZY 7HuZKt8ndqomp5VURwbUj60XD9W+ShIv2eAHHNOyBrXuLrB0lpEyaVCDn3LEq3R9CyzB KwZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717676244; x=1718281044; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zKrLANPAKfyGUWQ5fX9V6W8roVxyG0favdc9WS22mmI=; b=ANZAM7KJB1i70RkUHIxUdEpl7WCX9oNqA/9OoY02qzQjE+k60FBvIkzvQhRKw9ctdx rkpK8H1aRk8pY3dmW3RIVu9Qkz2wLR2oyylNNmnFGM2n5emy3iB39G/ltsd9TBIeZKoG CCdgQiDfvCxbNFHucsYzwKEMd5fXs2SECZBpVKZg3P0F+uarDBoTlrBnRy2armwJvzr4 wrxqRKzELJc5+47t6aYpgJ6HQtY81tsaalP6SAp1CfXJ/t16lC3zUe7NFQLAjMpOauDr 8PfPbLpP5EBx040epltTfPPBIcD8iqLlP0+vu/hQvJsNp2MNjh6XiMrwpymkqgLmTPko YXWg== X-Gm-Message-State: AOJu0Yz2p+Pl1/YOYUBobF/A+oVFqOLRp1bpfsShit+EtrkjLrzf3Oo4 Swh566Rpg9xq/fJh92nMtTCHisxHV7z+A0lVEE+QangBP8mPIUgZaDAXegD70BvdilqtIqOl/Gn b/F0= X-Google-Smtp-Source: AGHT+IHmP1tVmefjWa7Ngcf+LiXf+hT2HDgeFH3DSXOAxoaivU3yyyt0WH7laHvuZgXKgpHcuyIjpg== X-Received: by 2002:a05:600c:3b1d:b0:421:2b33:2522 with SMTP id 5b1f17b1804b1-421563388bdmr46568185e9.34.1717676244322; Thu, 06 Jun 2024 05:17:24 -0700 (PDT) Received: from euler.schwinge.ddns.net (p200300c8b735b200abad01548d5b2541.dip0.t-ipconnect.de. [2003:c8:b735:b200:abad:154:8d5b:2541]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c1aad97sm19677685e9.20.2024.06.06.05.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 05:17:23 -0700 (PDT) From: Thomas Schwinge To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Cc: Tom de Vries , Andrew Stubbs , Tobias Burnus Subject: nvptx, libgfortran: Switch out of "minimal" mode In-Reply-To: <87mt6c29gv.fsf@dem-tschwing-1.ger.mentorg.com> References: <87pmb82a0t.fsf@dem-tschwing-1.ger.mentorg.com> <87mt6c29gv.fsf@dem-tschwing-1.ger.mentorg.com> User-Agent: Notmuch/0.30+8~g47a4bad (https://notmuchmail.org) Emacs/29.3 (x86_64-pc-linux-gnu) Date: Thu, 06 Jun 2024 14:17:16 +0200 Message-ID: <87r0damfjn.fsf@euler.schwinge.ddns.net> MIME-Version: 1.0 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! On 2023-01-20T22:16:00+0100, Hi wrote: > On 2023-01-20T22:04:02+0100, I wrote: >> We've been (t)asked to enable (portions of) GCC/Fortran I/O for nvptx >> offloading, which means building a normal (non-'LIBGFOR_MINIMAL') >> configuration of libgfortran. > > This is achieved by 'nvptx, libgfortran: Switch out of "minimal" mode', > see attached, again based on WIP work by Andrew Stubbs. I've recently slightly revised this, in particular: > The OpenACC XFAILs: "[...] overflows the stack [...]" ... I now avoid by use of commit 0d25989d60d15866ef4737d66e02432f50717255 "nvptx offloading: 'GOMP_NVPTX_NATIVE_GPU_THREAD_STACK_SIZE' environment variable [PR97384, PR105274]". The underlying issue remains... > [...] unresolved at this point; see the discussion around > "Handling of large stack objects in GPU code generation -- maybe transform into heap allocation?", > and my "nvptx: '-mframe-malloc-threshold', '-Wframe-malloc-threshold'" > experimenting. (The latter works to some extent, but also has other > issues that I shall detail at some later point in time.) (No progress.) Pushed to trunk branch commit 3a4775d4403f2e88b589e88a9937cc1fd45a0e87 'nvptx, libgfortran: Switch out of "minimal" mode', see attached. This, unsurprisingly, also greatly improves GCC/Fortran test results for nvptx target. Grüße Thomas From 3a4775d4403f2e88b589e88a9937cc1fd45a0e87 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 5 Jun 2024 13:13:24 +0200 Subject: [PATCH] nvptx, libgfortran: Switch out of "minimal" mode ..., in order to enable (portions of) Fortran I/O, for example. libgfortran/ * configure.ac: No longer set 'LIBGFOR_MINIMAL' for nvptx. * configure: Regenerate. libgomp/ * libgomp.texi (nvptx): Update. * testsuite/libgomp.fortran/target-print-1-nvptx.f90: Remove. * testsuite/libgomp.fortran/target-print-1.f90: Adjust. * testsuite/libgomp.oacc-fortran/error_stop-2-nvptx.f: New. * testsuite/libgomp.oacc-fortran/error_stop-2.f: Adjust. * testsuite/libgomp.oacc-fortran/print-1-nvptx.f90: Adjust. * testsuite/libgomp.oacc-fortran/print-1.f90: Adjust. * testsuite/libgomp.oacc-fortran/stop-2-nvptx.f: New. * testsuite/libgomp.oacc-fortran/stop-2.f: Adjust. Co-authored-by: Andrew Stubbs --- libgfortran/configure | 21 ++++------ libgfortran/configure.ac | 17 +++----- libgomp/libgomp.texi | 10 +++-- .../libgomp.fortran/target-print-1-nvptx.f90 | 11 ----- .../libgomp.fortran/target-print-1.f90 | 3 -- .../libgomp.oacc-fortran/error_stop-2-nvptx.f | 39 ++++++++++++++++++ .../libgomp.oacc-fortran/error_stop-2.f | 3 +- .../libgomp.oacc-fortran/print-1-nvptx.f90 | 40 +++++++++++++++---- .../libgomp.oacc-fortran/print-1.f90 | 4 +- .../libgomp.oacc-fortran/stop-2-nvptx.f | 36 +++++++++++++++++ .../testsuite/libgomp.oacc-fortran/stop-2.f | 3 +- 11 files changed, 134 insertions(+), 53 deletions(-) delete mode 100644 libgomp/testsuite/libgomp.fortran/target-print-1-nvptx.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/error_stop-2-nvptx.f create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/stop-2-nvptx.f diff --git a/libgfortran/configure b/libgfortran/configure index 774dd52fc95..11a1bc5f070 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -6207,17 +6207,12 @@ else fi -# For GPU offloading, not everything in libfortran can be supported. -# Currently, the only target that has this problem is nvptx. The -# following is a (partial) list of features that are unsupportable on -# this particular target: -# * Constructors -# * alloca -# * C library support for I/O, with printf as the one notable exception -# * C library support for other features such as signal, environment -# variables, time functions - - if test "x${target_cpu}" = xnvptx; then +# "Minimal" mode is for targets that cannot (yet) support all features of +# libgfortran. It avoids the need for working constructors, alloca, and C +# library support for I/O, signals, environment variables, time functions, etc. +# At present there are no targets that require this mode. + + if false; then LIBGFOR_MINIMAL_TRUE= LIBGFOR_MINIMAL_FALSE='#' else @@ -12852,7 +12847,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12855 "configure" +#line 12850 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12958,7 +12953,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12961 "configure" +#line 12956 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index 46585a3ee14..cca1ea0ea97 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -209,17 +209,12 @@ AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" != xno]) AM_CONDITIONAL(LIBGFOR_USE_SYMVER_GNU, [test "x$gfortran_use_symver" = xgnu]) AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun]) -# For GPU offloading, not everything in libfortran can be supported. -# Currently, the only target that has this problem is nvptx. The -# following is a (partial) list of features that are unsupportable on -# this particular target: -# * Constructors -# * alloca -# * C library support for I/O, with printf as the one notable exception -# * C library support for other features such as signal, environment -# variables, time functions - -AM_CONDITIONAL(LIBGFOR_MINIMAL, [test "x${target_cpu}" = xnvptx]) +# "Minimal" mode is for targets that cannot (yet) support all features of +# libgfortran. It avoids the need for working constructors, alloca, and C +# library support for I/O, signals, environment variables, time functions, etc. +# At present there are no targets that require this mode. + +AM_CONDITIONAL(LIBGFOR_MINIMAL, false) # Some compiler target support may have limited support for integer # or floating point numbers – or may want to reduce the libgfortran size diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index c52bb2672c6..eb608915938 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -6354,7 +6354,7 @@ The used sizes are The implementation remark: @itemize -@item I/O within OpenMP target regions and OpenACC parallel/kernels is supported +@item I/O within OpenMP target regions and OpenACC compute regions is supported using the C library @code{printf} functions and the Fortran @code{print}/@code{write} statements. @item Reverse offload regions (i.e. @code{target} regions with @@ -6429,9 +6429,11 @@ CUDA version and hardware. The implementation remark: @itemize -@item I/O within OpenMP target regions and OpenACC parallel/kernels is supported - using the C library @code{printf} functions. Note that the Fortran - @code{print}/@code{write} statements are not supported, yet. +@item I/O within OpenMP target regions and OpenACC compute regions is supported + using the C library @code{printf} functions. + Additionally, the Fortran @code{print}/@code{write} statements are + supported within OpenMP target regions, but not yet OpenACC compute + regions. @c The latter needs 'GOMP_NVPTX_NATIVE_GPU_THREAD_STACK_SIZE'. @item Compilation OpenMP code that contains @code{requires reverse_offload} requires at least @code{-march=sm_35}, compiling for @code{-march=sm_30} is not supported. diff --git a/libgomp/testsuite/libgomp.fortran/target-print-1-nvptx.f90 b/libgomp/testsuite/libgomp.fortran/target-print-1-nvptx.f90 deleted file mode 100644 index a89c9c33484..00000000000 --- a/libgomp/testsuite/libgomp.fortran/target-print-1-nvptx.f90 +++ /dev/null @@ -1,11 +0,0 @@ -! Ensure that write on the offload device works, nvptx offloading variant. - -! This doesn't compile: for nvptx offloading we're using a minimal libgfortran -! configuration. -! { dg-do link } ! ..., but still apply 'dg-do run' options. -! { dg-xfail-if "minimal libgfortran" { offload_target_nvptx } } - -! Skip duplicated testing. -! { dg-skip-if "separate file" { ! offload_target_nvptx } } - -include 'target-print-1.f90' diff --git a/libgomp/testsuite/libgomp.fortran/target-print-1.f90 b/libgomp/testsuite/libgomp.fortran/target-print-1.f90 index 327bb22cb6d..9ac70e5a85f 100644 --- a/libgomp/testsuite/libgomp.fortran/target-print-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-print-1.f90 @@ -3,9 +3,6 @@ ! { dg-do run } ! { dg-output "The answer is 42(\n|\r\n|\r)+" } -! Separate file 'target-print-1-nvptx.f90' for nvptx offloading. -! { dg-skip-if "separate file" { offload_target_nvptx } } - program main implicit none integer :: var = 42 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2-nvptx.f b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2-nvptx.f new file mode 100644 index 00000000000..ef93e80d9d4 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2-nvptx.f @@ -0,0 +1,39 @@ +! 'error_stop-2.f' nvptx offloading variant + +! { dg-do run { target openacc_nvidia_accel_selected } } +! +! The PTX JIT doesn't understand the 'ERROR STOP' call graph, and therefore: +! warning : Stack size for entry function 'main$_omp_fn$0' cannot be statically determined +! Running with default 1024-bytes GPU thread stack size overflows the stack, +! so raise it to an arbitrarily higher value: +! { dg-set-target-env-var GOMP_NVPTX_NATIVE_GPU_THREAD_STACK_SIZE 3333 } + + PROGRAM MAIN + IMPLICIT NONE + +! Initialize before the checkpoint, in case this produces any output. +!$ACC PARALLEL +!$ACC END PARALLEL + + PRINT *, "CheCKpOInT" +!$ACC PARALLEL + ERROR STOP 35 +!$ACC END PARALLEL + PRINT *, "WrONg WAy" + + END PROGRAM MAIN + +! { dg-output "CheCKpOInT(\n|\r\n|\r)+" } + +! { dg-output "ERROR STOP 35(\n|\r\n|\r)+" } +! +! In gfortran's main program, libfortran's set_options is called - which sets +! compiler_options.backtrace = 1 by default. For an offload libgfortran, this +! is never called and, hence, "Error termination." is never printed. Thus: +! { dg-output "Error termination.*" { target { ! { openacc_nvidia_accel_selected || openacc_radeon_accel_selected } } } } + +! PR85463. The 'exit' implementation used with nvptx +! offloading is a little bit different. +! { dg-output "libgomp: cuStreamSynchronize error.*" { target openacc_nvidia_accel_selected } } + +! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f index 5951e8cbe64..c0762835faa 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f @@ -17,7 +17,8 @@ ! { dg-output "CheCKpOInT(\n|\r\n|\r)+" } -! { dg-output "ERROR STOP 35(\n|\r\n|\r)+" } +! See 'error_stop-2-nvptx.f' regarding the nvptx offloading XFAIL. +! { dg-output "ERROR STOP 35(\n|\r\n|\r)+" { xfail openacc_nvidia_accel_selected } } ! ! In gfortran's main program, libfortran's set_options is called - which sets ! compiler_options.backtrace = 1 by default. For an offload libgfortran, this diff --git a/libgomp/testsuite/libgomp.oacc-fortran/print-1-nvptx.f90 b/libgomp/testsuite/libgomp.oacc-fortran/print-1-nvptx.f90 index 866c8654355..e8080e6c8ac 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/print-1-nvptx.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/print-1-nvptx.f90 @@ -1,11 +1,37 @@ ! Ensure that write on the offload device works, nvptx offloading variant. -! This doesn't compile: for nvptx offloading we're using a minimal libgfortran -! configuration. -! { dg-do link } ! ..., but still apply 'dg-do run' options. -! { dg-xfail-if "minimal libgfortran" { offload_target_nvptx } } +! { dg-do run { target openacc_nvidia_accel_selected } } +! { dg-output "The answer is 42(\n|\r\n|\r)+" } +! +! The PTX JIT doesn't understand the 'write' call graph, and therefore: +! warning : Stack size for entry function 'main$_omp_fn$0' cannot be statically determined +! Running with default 1024-bytes GPU thread stack size overflows the stack, +! so raise it to an arbitrarily higher value: +! { dg-set-target-env-var GOMP_NVPTX_NATIVE_GPU_THREAD_STACK_SIZE 3333 } -! Skip duplicated testing. -! { dg-skip-if "separate file" { ! offload_target_nvptx } } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } -include 'print-1.f90' +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types): +! { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } */ + +! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' +! passed to 'incr' may be unset, and in that case, it will be set to [...]", +! so to maintain compatibility with earlier Tcl releases, we manually +! initialize counter variables: +! { dg-line l_dummy[variable c_compute 0] } +! { dg-message dummy {} { target iN-VAl-Id } l_dummy } to avoid +! "WARNING: dg-line var l_dummy defined, but not used". + +program main + implicit none + integer :: var = 42 + +!$acc parallel ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'dt_parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} {} { target *-*-* } l_compute$c_compute } + write (0, '("The answer is ", I2)') var +!$acc end parallel + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 index d2f89d915f8..00f5c634a20 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 @@ -3,8 +3,8 @@ ! { dg-do run } ! { dg-output "The answer is 42(\n|\r\n|\r)+" } -! Separate file 'print-1-nvptx.f90' for nvptx offloading. -! { dg-skip-if "separate file" { offload_target_nvptx } } +! See 'print-1-nvptx.f90' regarding the nvptx offloading XFAIL. +! { dg-xfail-run-if TODO { openacc_nvidia_accel_selected } } ! { dg-additional-options "-fopt-info-note-omp" } ! { dg-additional-options "-foffload=-fopt-info-note-omp" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/stop-2-nvptx.f b/libgomp/testsuite/libgomp.oacc-fortran/stop-2-nvptx.f new file mode 100644 index 00000000000..3c8b45c102f --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/stop-2-nvptx.f @@ -0,0 +1,36 @@ +! 'stop-2.f' nvptx offloading variant + +! { dg-do run { target openacc_nvidia_accel_selected } } +! +! The PTX JIT doesn't understand the 'STOP' call graph, and therefore: +! warning : Stack size for entry function 'main$_omp_fn$0' cannot be statically determined +! Running with default 1024-bytes GPU thread stack size overflows the stack, +! so raise it to an arbitrarily higher value: +! { dg-set-target-env-var GOMP_NVPTX_NATIVE_GPU_THREAD_STACK_SIZE 3333 } + + PROGRAM MAIN + IMPLICIT NONE + +! Initialize before the checkpoint, in case this produces any output. +!$ACC PARALLEL +!$ACC END PARALLEL + + PRINT *, "CheCKpOInT" +!$ACC PARALLEL + STOP 35 +!$ACC END PARALLEL + PRINT *, "WrONg WAy" + + END PROGRAM MAIN + +! { dg-output "CheCKpOInT(\n|\r\n|\r)+" } + +! { dg-output "STOP 35(\n|\r\n|\r)+" } +! +! PR85463. The 'exit' implementation used with nvptx +! offloading is a little bit different. +! { dg-output "libgomp: cuStreamSynchronize error.*" { target openacc_nvidia_accel_selected } } + +! { dg-output "$" } + +! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/stop-2.f b/libgomp/testsuite/libgomp.oacc-fortran/stop-2.f index fe7ee37813a..e08297eda5d 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/stop-2.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/stop-2.f @@ -17,7 +17,8 @@ ! { dg-output "CheCKpOInT(\n|\r\n|\r)+" } -! { dg-output "STOP 35(\n|\r\n|\r)+" } +! See 'stop-2-nvptx.f' regarding the nvptx offloading XFAIL. +! { dg-output "STOP 35(\n|\r\n|\r)+" { xfail openacc_nvidia_accel_selected } } ! ! PR85463. The 'exit' implementation used with nvptx ! offloading is a little bit different. -- 2.34.1