mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-26 12:23:59 +08:00
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 <ams@gcc.gnu.org>
This commit is contained in:
parent
0d25989d60
commit
3a4775d440
19
libgfortran/configure
vendored
19
libgfortran/configure
vendored
@ -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
|
||||
# "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 test "x${target_cpu}" = xnvptx; then
|
||||
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
|
||||
|
@ -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
|
||||
# "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, [test "x${target_cpu}" = xnvptx])
|
||||
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
|
||||
|
@ -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.
|
||||
|
@ -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'
|
@ -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
|
||||
|
39
libgomp/testsuite/libgomp.oacc-fortran/error_stop-2-nvptx.f
Normal file
39
libgomp/testsuite/libgomp.oacc-fortran/error_stop-2-nvptx.f
Normal file
@ -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 "" }
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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" }
|
||||
|
36
libgomp/testsuite/libgomp.oacc-fortran/stop-2-nvptx.f
Normal file
36
libgomp/testsuite/libgomp.oacc-fortran/stop-2-nvptx.f
Normal file
@ -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 "" }
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user