Commit Graph

1105 Commits

Author SHA1 Message Date
Andrew Stubbs
14e5e74698 Fix libgomp plugin-gcn bug
2020-01-23  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* plugin/plugin-gcn.c (parse_target_attributes): Use correct mask for
	the device id.
2020-01-23 12:40:04 +00:00
Frederik Harwath
7d593fd672 Add runtime ISA check for amdgcn offloading
The HSA/ROCm runtime rejects binaries not built for the exact GPU device
present. So far, the libgomp amdgcn plugin does not verify that the GPU ISA
and the ISA specified at compile time match before handing over the binary to
the runtime.  In case of a mismatch, the user is confronted with an unhelpful
runtime error.

This commit implements a runtime ISA check. In case of an ISA mismatch, the
execution is aborted with a clear error message and a hint at the correct
compilation parameters for the GPU on which the execution has been attempted.

libgomp/
	* plugin/plugin-gcn.c (EF_AMDGPU_MACH): New enum.
	* (EF_AMDGPU_MACH_MASK): New constant.
	* (gcn_isa): New typedef.
	* (gcn_gfx801_s): New constant.
	* (gcn_gfx803_s): New constant.
	* (gcn_gfx900_s): New constant.
	* (gcn_gfx906_s): New constant.
	* (gcn_isa_name_len): New constant.
	* (elf_gcn_isa_field): New function.
	* (isa_hsa_name): New function.
	* (isa_gcc_name): New function.
	* (isa_code): New function.
	* (struct agent_info): Add field "device_isa" and remove field
	"gfx900_p".
	* (GOMP_OFFLOAD_init_device): Adapt agent init to "agent_info"
	field changes, fail if device has unknown ISA.
	* (parse_target_attributes): Replace "gfx900_p" by "device_isa".
	* (isa_matches_agent): New function ...
	* (create_and_finalize_hsa_program): ... used from here to check
	that the GPU ISA and the code-object ISA match.
2020-01-21 07:41:45 +01:00
Andrew Stubbs
09e0ad6253 Update OpenACC tests for amdgcn
2020-01-20  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Skip test on gcn.
	* testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c (main):
	Adjust test dimensions for amdgcn.
	* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c (main): Adjust
	gang/worker/vector expectations dynamically.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
	(main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c
	(acc_gang): Recognise acc_device_radeon.
	(acc_worker): Likewise.
	(acc_vector): Likewise.
	(main): Set expectations for amdgcn.
	* testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
	(main): Adjust gang/worker/vector expectations dynamically.
	* testsuite/libgomp.oacc-c-c++-common/routine-v-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c (main): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c: Set expectations
	for amdgcn.
2020-01-20 16:51:06 +00:00
Andrew Stubbs
6687d13a87 Rename acc_device_gcn to acc_device_radeon
2020-01-17  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* config/accel/openacc.f90 (openacc_kinds): Rename acc_device_gcn to
	acc_device_radeon.
	(openacc): Likewise.
	* openacc.f90 (openacc_kinds): Likewise.
	(openacc): Likewise.
	* openacc.h (acc_device_t): Likewise.
	* openacc_lib.h: Likewise.
	* testsuite/lib/libgomp.exp
	(check_effective_target_openacc_amdgcn_accel_present): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-1.c
	(cb_compute_construct_end): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c
	(cb_enqueue_launch_start): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-parallel-1.c
	(cb_enter_data_end): Likewise.
	(cb_exit_data_start): Likewise.
	(cb_exit_data_end): Likewise.
	(cb_compute_construct_end): Likewise.
	(cb_enqueue_launch_start): Likewise.
	(cb_enqueue_launch_end): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c
	(main): Likewise.
2020-01-17 18:11:52 +00:00
Thomas Schwinge
6fc0385c0c OpenACC 'acc_get_property' cleanup
include/
	* gomp-constants.h (enum gomp_device_property): Remove.
	libgomp/
	* libgomp-plugin.h (enum goacc_property): New.  Adjust all users
	to use this instead of 'enum gomp_device_property'.
	(GOMP_OFFLOAD_get_property): Rename to...
	(GOMP_OFFLOAD_openacc_get_property): ... this.  Adjust all users.
	* libgomp.h (struct gomp_device_descr): Move
	'GOMP_OFFLOAD_openacc_get_property'...
	(struct acc_dispatch_t): ... here.  Adjust all users.
	* plugin/plugin-hsa.c (GOMP_OFFLOAD_get_property): Remove.
	liboffloadmic/
	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_property):
	Remove.

From-SVN: r280150
2020-01-10 23:24:36 +01:00
Thomas Schwinge
b3b75e664a Further changes for the OpenACC 'if_present' clause on the 'host_data' construct
gcc/
	* tree.h (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT): New definition.
	* tree-core.h: Document it.
	* gimplify.c (gimplify_omp_workshare): Set it.
	* omp-low.c (lower_omp_target): Use it.
	* tree-pretty-print.c (dump_omp_clause): Print it.
	gcc/testsuite/
	* c-c++-common/goacc/host_data-1.c: Extend.
	* gfortran.dg/goacc/host_data-tree.f95: Likewise.

	gcc/
	* omp-low.c (lower_omp_target) <OMP_CLAUSE_USE_DEVICE_PTR etc.>:
	Assert that for OpenACC we always have 'GOMP_MAP_USE_DEVICE_PTR'.

	libgomp/
	* target.c (gomp_map_vars_internal)
	<GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT>: Clean up/elaborate code
	paths.

From-SVN: r280149
2020-01-10 23:23:44 +01:00
Jakub Jelinek
91df4397a1 re PR libgomp/93219 (unused return value in affinity-fmt.c)
PR libgomp/93219
	* libgomp.h (gomp_print_string): Change return type from void to int.
	* affinity-fmt.c (gomp_print_string): Likewise.  Return true if
	not all characters have been written.

From-SVN: r280137
2020-01-10 21:42:00 +01:00
Tobias Burnus
d5c23c6cea OpenACC – support "if" + "if_present" clauses with "host_data"
2020-01-10  Gergö Barany  <gergo@codesourcery.com>
	    Thomas Schwinge <thomas@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>
	    Tobias Burnus  <tobias@codesourcery.com>

        gcc/c/
        * c-parser.c (OACC_HOST_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_IF
        and PRAGMA_OACC_CLAUSE_IF_PRESENT.

        gcc/cp/
        * parser.c (OACC_HOST_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_IF
        and PRAGMA_OACC_CLAUSE_IF_PRESENT.

        gcc/fortran/
        * openmp.c (OACC_HOST_DATA_CLAUSES): Add PRAGMA_OACC_CLAUSE_IF
        and PRAGMA_OACC_CLAUSE_IF_PRESENT.

	gcc/
	* omp-low.c (lower_omp_target): Use GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT
	if PRAGMA_OACC_CLAUSE_IF_PRESENT exist.

	gcc/testsuite/
	* c-c++-common/goacc/host_data-1.c: Added tests of if and if_present
	clauses on host_data.
	* gfortran.dg/goacc/host_data-tree.f95: Likewise.

	include/
	* gomp-constants.h (enum gomp_map_kind): New enumeration constant
	GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT.
        
	libgomp/
	* oacc-parallel.c (GOACC_data_start): Handle
	GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT.
	* target.c (gomp_map_vars_async): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/host_data-7.c: New.
	* testsuite/libgomp.oacc-fortran/host_data-5.F90: New.

From-SVN: r280115
2020-01-10 16:08:41 +01:00
Tobias Burnus
c1030b5cd3 libgomp.texi: Fix typos, use https (actual change)
From-SVN: r280008
2020-01-08 16:00:39 +01:00
Tobias Burnus
df2c0d3620 libgomp.texi: Fix typos, use https.
From-SVN: r280007
2020-01-08 15:58:31 +01:00
Tobias Burnus
f760c0c77f Fortran] OpenMP/OpenACC – fix more issues with OPTIONAL
gcc/fortran/
        * trans-openmp.c (gfc_omp_check_optional_argument): Always return a
        Boolean expression; handle unallocated/disassociated actual arguments
        as absent if passed to nonallocatable/nonpointer dummy array arguments.
        (gfc_build_cond_assign): Change to assume a Boolean expr not a pointer.
        (gfc_omp_finish_clause, gfc_trans_omp_clauses): Assign NULL to generated
        array-data variable if the argument is absent. Simplify code as
        'present' is now a Boolean expression.

        libgomp/
        * testsuite/libgomp.fortran/optional-map.f90: Add test for
        unallocated/disassociated actual arguments to nonallocatable/nonpointer
        dummy arguments; those are/shall be regarded as absent arguments.
        * testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: Ditto.
        * testsuite/libgomp.fortran/use_device_ptr-optional-3.f90: New.

From-SVN: r279858
2020-01-03 13:56:46 +01:00
Jakub Jelinek
8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Jakub Jelinek
7e7065b976 gcc.c (process_command): Update copyright notice dates.
* gcc.c (process_command): Update copyright notice dates.
	* gcov-dump.c (print_version): Ditto.
	* gcov.c (print_version): Ditto.
	* gcov-tool.c (print_version): Ditto.
	* gengtype.c (create_file): Ditto.
	* doc/cpp.texi: Bump @copying's copyright year.
	* doc/cppinternals.texi: Ditto.
	* doc/gcc.texi: Ditto.
	* doc/gccint.texi: Ditto.
	* doc/gcov.texi: Ditto.
	* doc/install.texi: Ditto.
	* doc/invoke.texi: Ditto.
gcc/fortran/ 
	* gfortranspec.c (lang_specific_driver): Update copyright notice
	dates.
	* gfc-internals.texi: Bump @copying's copyright year.
	* gfortran.texi: Ditto.
	* intrinsic.texi: Ditto.
	* invoke.texi: Ditto.
gcc/d/
	* gdc.texi: Bump @copyrights-d year.
gcc/go/
	* gccgo.texi: Bump @copyrights-go year.
gcc/ada/
  	* gnat_ugn.texi: Bump @copying's copyright year.
  	* gnat_rm.texi: Likewise.
libitm/
	* libitm.texi: Bump @copying's copyright year.
libgomp/
	* libgomp.texi: Bump @copying's copyright year.
libquadmath/
	* libquadmath.texi: Bump @copying's copyright year.

From-SVN: r279811
2020-01-01 12:14:37 +01:00
Ayush Mittal
2c8297996a re PR libgomp/93065 (libgomp: destructor missing to delete goacc_cleanup_key)
PR libgomp/93065
	* oacc-init.c (goacc_runtime_deinitialize): New function.

From-SVN: r279803
2019-12-31 11:34:34 +01:00
Jakub Jelinek
e9dcb75e40 re PR bootstrap/93074 (build FAIL with --enable-offload-targets=nvptx-none)
PR bootstrap/93074
	* plugin/cuda/cuda.h (cuDeviceGetName, cuDriverGetVersion): Declare.
	(cuDeviceTotalMem, cuMemGetInfo): Likewise.  Define to *_v2.

From-SVN: r279747
2019-12-28 10:26:03 +01:00
Maciej W. Rozycki
6c84c8bf9b Add OpenACC 2.6 `acc_get_property' support
Add generic support for the OpenACC 2.6 `acc_get_property' and
`acc_get_property_string' routines, as well as full handlers for the
host and the NVPTX offload targets and minimal handlers for the HSA,
Intel MIC, and AMD GCN offload targets.

Included are C/C++ and Fortran tests that, in particular, print
the property values for acc_property_vendor, acc_property_memory,
acc_property_free_memory, acc_property_name, and acc_property_driver.
The output looks as follows:

Vendor: GNU
Name: GOMP
Total memory: 0
Free memory: 0
Driver: 1.0

with the host driver (where the memory related properties are not
supported for the host device and yield 0, conforming to the standard)
and output like:

Vendor: Nvidia
Total memory: 12651462656
Free memory: 12202737664
Name: TITAN V
Driver: CUDA Driver 9.1

with the NVPTX driver.

2019-12-22  Maciej W. Rozycki  <macro@codesourcery.com>
	    Frederik Harwath  <frederik@codesourcery.com>
	    Thomas Schwinge  <tschwinge@codesourcery.com>

	include/
	* gomp-constants.h (gomp_device_property): New enum.

	libgomp/
	* libgomp.h (gomp_device_descr): Add `get_property_func' member.
	* libgomp-plugin.h (gomp_device_property_value): New union.
	(gomp_device_property_value): New prototype.
	* openacc.h (acc_device_t): Add `acc_device_current' enumeration
	constant.
	(acc_device_property_t): New enum.
	(acc_get_property, acc_get_property_string): New prototypes.
	* oacc-init.c (acc_get_device_type): Also assert that result
	is not `acc_device_current'.
	(get_property_any, acc_get_property, acc_get_property_string):
	New functions.
	* openacc.f90 (openacc_kinds): Add `acc_device_current' and
	`acc_property_memory', `acc_property_free_memory',
	`acc_property_name', `acc_property_vendor' and
	`acc_property_driver' constants.  Add `acc_device_property' data
	type.
	(openacc_internal): Add `acc_get_property' and
	`acc_get_property_string' interfaces.  Add `acc_get_property_h',
	`acc_get_property_string_h', `acc_get_property_l' and
	`acc_get_property_string_l'.
	* oacc-host.c (host_get_property): New function.
	(host_dispatch): Wire it.
	* target.c (gomp_load_plugin_for_device): Handle `get_property'.
	* libgomp.map (OACC_2.6): Add `acc_get_property', `acc_get_property_h_',
	`acc_get_property_string' and `acc_get_property_string_h_' symbols.
	* libgomp.texi (OpenACC Runtime Library Routines): Add
	`acc_get_property'.
	(acc_get_property): New node.
	* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_property): New
	function (stub).
	* plugin/plugin-hsa.c (GOMP_OFFLOAD_get_property): New function.
	* plugin/plugin-nvptx.c (CUDA_CALLS): Add `cuDeviceGetName',
	`cuDeviceTotalMem', `cuDriverGetVersion' and `cuMemGetInfo'
	calls.
	(GOMP_OFFLOAD_get_property): New function.
	(struct ptx_device): Add new field "name".
	(cuda_driver_version_s): Add new static variable ...
	(nvptx_init): ... and init from here.

	* testsuite/libgomp.oacc-c-c++-common/acc_get_property.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/acc_get_property-2.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/acc_get_property-3.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c: New file
	with test helper functions.

	* testsuite/libgomp.oacc-fortran/acc_get_property.f90: New test.

	liboffloadmic/
	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_property):
	New function.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>


Co-Authored-By: Frederik Harwath <frederik@codesourcery.com>
Co-Authored-By: Thomas Schwinge <tschwinge@codesourcery.com>

From-SVN: r279710
2019-12-22 19:54:09 +00:00
Maciej W. Rozycki
c8e759b421 libgomp/test: Fix compilation for build sysroot
Fix a problem with the libgomp testsuite using a method to determine
the compiler to use resulting in the tool being different from one the
library has been built with, and causing a catastrophic failure from the
lack of a suitable `--sysroot=' option where the `--with-build-sysroot='
configuration option has been used to build the compiler resulting in
the inability to link executables.

Address this problem by defining the compiler to use, via the
GCC_UNDER_TEST TCL variable, set in the DejaGNU configuration file from
$CC by autoconf, which will have all the required options set for the
target compiler to build executables in the environment configured,
removing failures like:

.../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
.../bin/riscv64-linux-gnu-ld: cannot find -lm
.../bin/riscv64-linux-gnu-ld: cannot find -lpthread
.../bin/riscv64-linux-gnu-ld: cannot find -lc
.../bin/riscv64-linux-gnu-ld: cannot find -latomic
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: libgomp.c/../libgomp.c-c++-common/atomic-18.c (test for excess errors)
Excess errors:
.../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
.../bin/riscv64-linux-gnu-ld: cannot find -lm
.../bin/riscv64-linux-gnu-ld: cannot find -lpthread
.../bin/riscv64-linux-gnu-ld: cannot find -lc
.../bin/riscv64-linux-gnu-ld: cannot find -latomic

UNRESOLVED: libgomp.c/../libgomp.c-c++-common/atomic-18.c compilation failed to produce executable

and bringing overall test results for the `riscv64-linux-gnu' target
(here with the `x86_64-linux-gnu' host and RISC-V QEMU in the Linux user
emulation mode as the target board) from:

		=== libgomp Summary ===

# of expected passes		44
# of unexpected failures	3274
# of unresolved testcases	3241
# of unsupported tests		548

to:

		=== libgomp Summary ===

# of expected passes		6834
# of unexpected failures	4
# of expected failures		4
# of unsupported tests		518

	libgomp/
	* testsuite/libgomp-test-support.exp.in (GCC_UNDER_TEST): New
	variable.

From-SVN: r279708
2019-12-22 00:41:36 +00:00
Thomas Schwinge
b092fb3b67 [OMP] Restore 'omp declare target link' handling
PASS: libgomp.c/target-link-1.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/target-link-1.c execution test

We need to revert one line of code change from r279625.

	libgomp/
	* target.c (gomp_map_vars_internal): Restore 'omp declare target
	link' handling.

From-SVN: r279701
2019-12-21 23:58:43 +01:00
Julian Brown
9be3ac5d63 Fortran polymorphic class-type support for OpenACC
gcc/fortran/
	* openmp.c (resolve_oacc_data_clauses): Don't disallow allocatable
	polymorphic types for OpenACC.
	* trans-openmp.c (gfc_trans_omp_clauses): Support polymorphic class
	types.

	libgomp/
	* testsuite/libgomp.oacc-fortran/class-ptr-param.f95: New test.
	* testsuite/libgomp.oacc-fortran/classtypes-1.f95: New test.
	* testsuite/libgomp.oacc-fortran/classtypes-2.f95: New test.

From-SVN: r279631
2019-12-20 01:39:49 +00:00
Julian Brown
02817027ca OpenACC 2.6 deep copy: Fortran execution tests
libgomp/
	* testsuite/libgomp.oacc-fortran/deep-copy-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-2.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-3.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-4.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-5.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-7.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-8.f90: New test.
	* testsuite/libgomp.oacc-fortran/derived-type-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/derivedtype-1.f95: New test.
	* testsuite/libgomp.oacc-fortran/derivedtype-2.f95: New test.
	* testsuite/libgomp.oacc-fortran/multidim-slice.f95: New test.
	* testsuite/libgomp.oacc-fortran/update-2.f90: New test.

Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>

From-SVN: r279630
2019-12-20 01:39:46 +00:00
Julian Brown
c2eb021fd2 OpenACC 2.6 deep copy: C and C++ execution tests
libgomp/
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-1.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-2.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-4.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-6.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-9.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-11.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-14.c: New test.
	* testsuite/libgomp.oacc-c++/deep-copy-12.C: New test.
	* testsuite/libgomp.oacc-c++/deep-copy-13.C: New test.

From-SVN: r279629
2019-12-20 01:39:42 +00:00
Julian Brown
8e7e71ff24 OpenACC 2.6 deep copy: libgomp parts
include/
	* gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_4, GOMP_MAP_DEEP_COPY):
	Define.
	(gomp_map_kind): Add GOMP_MAP_ATTACH, GOMP_MAP_DETACH,
	GOMP_MAP_FORCE_DETACH.

	libgomp/
	* libgomp.h (struct target_var_desc): Add do_detach flag.
	* oacc-init.c (acc_shutdown_1): Free aux block if present.
	* oacc-mem.c (find_group_last): Add SIZES parameter. Support
	struct components.  Tidy up and add some new checks.
	(goacc_enter_data_internal): Update call to find_group_last.
	(goacc_exit_data_internal): Support detach operations and
	GOMP_MAP_STRUCT.
	(GOACC_enter_exit_data): Handle initial GOMP_MAP_STRUCT or
	GOMP_MAP_FORCE_PRESENT in finalization detection code.  Handle
	attach/detach in enter/exit data detection code.
	* target.c (gomp_map_vars_existing): Initialise do_detach field of
	tgt_var_desc.
	(gomp_map_vars_internal): Support attach.
	(gomp_unmap_vars_internal): Support detach.

From-SVN: r279625
2019-12-20 01:20:30 +00:00
Julian Brown
5d5be7bfb5 OpenACC 2.6 deep copy: attach/detach API routines
libgomp/
	* libgomp.h (struct splay_tree_aux): Add attach_count field.
	(gomp_attach_pointer, gomp_detach_pointer): Add prototypes.
	* libgomp.map (OACC_2.6): New section. Add acc_attach,
	acc_attach_async, acc_detach, acc_detach_async, acc_detach_finalize,
	acc_detach_finalize_async.
	* oacc-mem.c (acc_attach_async, acc_attach, goacc_detach_internal,
	acc_detach, acc_detach_async, acc_detach_finalize,
	acc_detach_finalize_async): New functions.
	* openacc.h (acc_attach, acc_attach_async, acc_detach,
	(acc_detach_async, acc_detach_finalize, acc_detach_finalize_async): Add
	prototypes.
	* target.c (gomp_attach_pointer, gomp_detach_pointer): New functions.
	(gomp_remove_var_internal): Free attachment counts if present.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-3.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-5.c: New test.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>

From-SVN: r279624
2019-12-20 01:20:27 +00:00
Julian Brown
5bcd470bf0 Use gomp_map_val for OpenACC host-to-device address translation
libgomp/
	* libgomp.h (gomp_map_val): Add prototype.
	* oacc-parallel.c (GOACC_parallel_keyed): Use gomp_map_val instead of
	open-coding device-address calculation.
	* target.c (gomp_map_val): Make global. Use OFFSET_POINTER in
	non-present case.

Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>

From-SVN: r279622
2019-12-20 01:20:19 +00:00
Julian Brown
378da98fcc OpenACC reference count overhaul
libgomp/
	* libgomp.h (struct splay_tree_key_s): Substitute dynamic_refcount
	field for virtual_refcount.
	(enum gomp_map_vars_kind): Add GOMP_MAP_VARS_OPENACC_ENTER_DATA.
	(gomp_free_memmap): Remove prototype.
	* oacc-init.c (acc_shutdown_1): Iteratively call gomp_remove_var
	instead of calling gomp_free_memmap.
	* oacc-mem.c (acc_map_data): Use virtual_refcount instead of
	dynamic_refcount.
	(acc_unmap_data): Open code instead of forcing target_mem_desc's
	to_free field to NULL then calling gomp_unmap_vars.  Handle
	REFCOUNT_INFINITY on target blocks.
	(goacc_enter_data): Rename to...
	(goacc_enter_datum): ...this.  Remove MAPNUM parameter and special
	handling for mapping groups.  Use virtual_refcount instead of
	dynamic_refcount.  Use GOMP_MAP_VARS_OPENACC_ENTER_DATA for
	map_map_vars_async call.  Re-do lookup for target pointer return value.
	(acc_create, acc_create_async, acc_copyin, acc_copyin_async): Call
	renamed goacc_enter_datum function.
	(goacc_exit_data): Rename to...
	(goacc_exit_datum): ...this.  Update for virtual_refcount semantics.
	(acc_delete, acc_delete_async, acc_delete_finalize,
	acc_delete_finalize_async, acc_copyout, acc_copyout_async,
	acc_copyout_finalize, acc_copyout_finalize_async): Call renamed
	goacc_exit_datum function.
	(gomp_acc_remove_pointer, find_pointer): Remove functions.
	(find_group_last, goacc_enter_data_internal, goacc_exit_data_internal):
	New functions.
	(GOACC_enter_exit_data): Use goacc_enter_data_internal and
	goacc_exit_data_internal helper functions.
	* target.c (gomp_map_vars_internal): Handle
	GOMP_MAP_VARS_OPENACC_ENTER_DATA.  Update for virtual_refcount
	semantics.
	(gomp_unmap_vars_internal): Update for virtual_refcount semantics.
	(gomp_load_image_to_device, omp_target_associate_ptr): Zero-initialise
	virtual_refcount field instead of dynamic_refcount.
	(gomp_free_memmap): Remove function.
	* testsuite/libgomp.oacc-c-c++-common/unmap-infinity-1.c: New test.
	* testsuite/libgomp.c-c++-common/unmap-infinity-2.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/pr92843-1.c: Add XFAIL.

From-SVN: r279621
2019-12-20 01:20:16 +00:00
Julian Brown
2a656a9359 Use aux struct in libgomp for infrequently-used/API-specific data
libgomp/
	* libgomp.h (struct splay_tree_aux): New.
	(struct splay_tree_key_s): Replace link_key field with aux pointer.
	* target.c (gomp_map_vars_internal): Adjust for link_key being moved
	to aux struct.
	(gomp_remove_var_internal): Free aux block if present.
	(gomp_load_image_to_device): Zero-initialise aux field instead of
	link_key field.
	(omp_target_associate_pointer): Zero-initialise aux field.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>

From-SVN: r279620
2019-12-20 01:20:13 +00:00
Jakub Jelinek
601399c0df re PR middle-end/86416 ([OpenMP] Offloading - better lto1 error message if mode not supported on offloading target)
PR middle-end/86416
	* testsuite/libgomp.c/pr86416-1.c (main): Use L suffixes rather than
	q or none.
	* testsuite/libgomp.c/pr86416-2.c (main): Use Q suffixes rather than
	L or none.

From-SVN: r279552
2019-12-19 00:27:28 +01:00
Julian Brown
a6163563f2 Add OpenACC 2.6's no_create
The clause makes any device code use the local memory address for each
of the variables specified unless the given variable is already present
on the current device.

2019-12-19  Julian Brown  <julian@codesourcery.com>
            Maciej W. Rozycki  <macro@codesourcery.com>
            Tobias Burnus  <tobias@codesourcery.com>
            Thomas Schwinge  <thomas@codesourcery.com>

        gcc/
        * omp-low.c (lower_omp_target): Support GOMP_MAP_NO_ALLOC.
        * tree-pretty-print.c (dump_omp_clause): Likewise.

        gcc/c-family/
        * c-pragma.h (pragma_omp_clause): Add
        PRAGMA_OACC_CLAUSE_NO_CREATE.

        gcc/c/
        * c-parser.c (c_parser_omp_clause_name): Support no_create.
        (c_parser_oacc_data_clause): Likewise.
        (c_parser_oacc_all_clauses): Likewise.
        (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
        (OACC_PARALLEL_CLAUSE_MASK, OACC_SERIAL_CLAUSE_MASK): Add
        PRAGMA_OACC_CLAUSE_NO_CREATE.
        * c-typeck.c (handle_omp_array_sections): Support
        GOMP_MAP_NO_ALLOC.

        gcc/cp/
        * parser.c (cp_parser_omp_clause_name): Support no_create.
        (cp_parser_oacc_data_clause): Likewise.
        (cp_parser_oacc_all_clauses): Likewise.
        (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
        (OACC_PARALLEL_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_NO_CREATE.
        * semantics.c (handle_omp_array_sections): Support no_create.

        gcc/fortran/
        * gfortran.h (gfc_omp_map_op): Add OMP_MAP_NO_ALLOC.
        * openmp.c (omp_mask2): Add OMP_CLAUSE_NO_CREATE.
        (gfc_match_omp_clauses): Support no_create.
        (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES)
        (OACC_DATA_CLAUSES): Add OMP_CLAUSE_NO_CREATE.
        * trans-openmp.c (gfc_trans_omp_clauses_1): Support
        OMP_MAP_NO_ALLOC.

        gcc/testsuite/
        * gfortran.dg/goacc/common-block-1.f90: Add no_create-clause tests.
        * gfortran.dg/goacc/common-block-1.f90: Likewise.
        * gfortran.dg/goacc/data-clauses.f95: Likewise.
        * gfortran.dg/goacc/data-tree.f95: Likewise.
        * gfortran.dg/goacc/kernels-tree.f95: Likewise.
        * gfortran.dg/goacc/parallel-tree.f95: Likewise.

        include/
        * gomp-constants.h (gomp_map_kind): Support GOMP_MAP_NO_ALLOC.

        libgomp/
        * target.c (gomp_map_vars_async): Support GOMP_MAP_NO_ALLOC.
        * testsuite/libgomp.oacc-c-c++-common/no_create-1.c: New test.
        * testsuite/libgomp.oacc-c-c++-common/no_create-2.c: New test.
        * testsuite/libgomp.oacc-c-c++-common/no_create-3.c: New test.
        * testsuite/libgomp.oacc-c-c++-common/no_create-4.c: New test.
        * testsuite/libgomp.oacc-c-c++-common/no_create-5.c: New test.
        * testsuite/libgomp.oacc-fortran/no_create-1.f90: New test.
        * testsuite/libgomp.oacc-fortran/no_create-2.f90: New test.
        * testsuite/libgomp.oacc-fortran/no_create-3.F90: New test.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

Co-Authored-By: Maciej W. Rozycki <macro@codesourcery.com>
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Co-Authored-By: Tobias Burnus <tobias@codesourcery.com>

From-SVN: r279551
2019-12-19 00:10:08 +01:00
Thomas Schwinge
77ce555548 [OpenACC] Refactor 'goacc_enter_data' so that it can be called from 'goacc_insert_pointer', "present" case, and simplify
No functional changes.

	libgomp/
	* oacc-mem.c (goacc_enter_data): Refactor, so that it can be
	called...
	(goacc_insert_pointer): ... from here, "present" case.
	(goacc_insert_pointer): Inline function into...
	(GOACC_enter_exit_data): ... here, and simplify.

From-SVN: r279540
2019-12-18 18:02:37 +01:00
Thomas Schwinge
9444a299fa [OpenACC] Refactor 'goacc_enter_data' so that it can be called from 'goacc_insert_pointer', "not present" case
No functional changes.

	libgomp/
	* oacc-mem.c (goacc_enter_data): Refactor, so that it can be
	called...
	(goacc_insert_pointer): ... from here, "not present" case.

From-SVN: r279539
2019-12-18 18:02:27 +01:00
Thomas Schwinge
5031b6199f [OpenACC] Refactor 'goacc_remove_pointer' interface
No functional changes.

	libgomp/
	* oacc-mem.c (goacc_remove_pointer): Refactor interface.  Adjust
	all users.

From-SVN: r279538
2019-12-18 18:02:18 +01:00
Thomas Schwinge
1a79b5788d [OpenACC] Refactor 'GOACC_enter_exit_data' to call 'goacc_enter_data', 'goacc_exit_data'
No functional changes.

	libgomp/
	* oacc-mem.c (GOACC_enter_exit_data): Refactor code to call
	'goacc_enter_data', 'goacc_exit_data'.

From-SVN: r279537
2019-12-18 18:02:10 +01:00
Thomas Schwinge
34cfe31e1d [OpenACC] Refactor 'delete_copyout' into 'goacc_exit_data'
Change 'FLAG_COPYOUT', 'FLAG_FINALIZE' into the usual map kind.

No functional changes.

	libgomp/
	* oacc-mem.c (delete_copyout): Refactor into...
	(goacc_exit_data): ... this.  Adjust all users.

From-SVN: r279536
2019-12-18 18:02:00 +01:00
Thomas Schwinge
aaf0e9d708 [OpenACC] Refactor 'present_create_copy' into 'goacc_enter_data'
Every caller passes in 'FLAG_PRESENT', 'FLAG_CREATE'.  Change the remaining
'FLAG_COPY' into the usual map kind.

No functional changes.

	libgomp/
	* oacc-mem.c (present_create_copy): Refactor into...
	(goacc_enter_data): ... this.  Adjust all users.

From-SVN: r279535
2019-12-18 18:01:51 +01:00
Thomas Schwinge
83d1d065df Assert in 'libgomp/target.c:gomp_unmap_vars_internal' that we're not unmapping 'tgt' while it's still in use
libgomp/
	* target.c (gomp_unmap_vars_internal): Add a safeguard to
	'gomp_remove_var'.

From-SVN: r279534
2019-12-18 18:01:33 +01:00
Thomas Schwinge
cc3f11f5f5 [OpenACC] In 'libgomp/target.c:gomp_to_device_kind_p', handle 'GOMP_MAP_FORCE_FROM' like 'GOMP_MAP_FROM'
Fix oversight from r254194 "Coalesce host to device transfers in libgomp".

	libgomp/
	* target.c (gomp_to_device_kind_p): Handle 'GOMP_MAP_FORCE_FROM'
	like 'GOMP_MAP_FROM'.

From-SVN: r279533
2019-12-18 18:01:22 +01:00
Thomas Schwinge
ddb25eb9ca [PR92726, PR92970, PR92984] [OpenACC] Clarify 'acc_delete' etc. for 'NULL'-in, non-present data, or size zero
PR92970 "OpenACC 2.5: 'acc_delete' etc. on non-present data is a no-op" is an
actual bug fix, and the other ones are fall-out, currently undefined behavior.

	libgomp/
	PR libgomp/92726
	PR libgomp/92970
	PR libgomp/92984
	* oacc-mem.c (delete_copyout): No-op behavior if 'lookup_host'
	fails.
	(GOACC_enter_exit_data): Simplify accordingly.
	* testsuite/libgomp.oacc-c-c++-common/pr92970-1.c: New file,
	subsuming...
	* testsuite/libgomp.oacc-c-c++-common/lib-17.c: ... this file...
	* testsuite/libgomp.oacc-c-c++-common/lib-18.c: ..., and this
	file.
	* testsuite/libgomp.oacc-c-c++-common/pr92984-1.c: New file,
	subsuming...
	* testsuite/libgomp.oacc-c-c++-common/lib-21.c: ... this file...
	* testsuite/libgomp.oacc-c-c++-common/lib-29.c: ..., and this
	file.
	* testsuite/libgomp.oacc-c-c++-common/pr92726-1.c: New file,
	subsuming...
	* testsuite/libgomp.oacc-c-c++-common/lib-28.c: ... this file.

From-SVN: r279532
2019-12-18 18:01:11 +01:00
Thomas Schwinge
32128577ae [OpenACC] Elaborate/simplify 'exit data' 'finalize' handling
No functional changes.

	gcc/
	* gimplify.c (gimplify_omp_target_update): Elaborate 'exit data'
	'finalize' handling.
	gcc/testsuite/
	* c-c++-common/goacc/finalize-1.c: Extend.
	* gfortran.dg/goacc/finalize-1.f: Likewise.
	libgomp/
	* oacc-mem.c (GOACC_enter_exit_data): Simplify 'exit data'
	'finalize' handling.

From-SVN: r279531
2019-12-18 18:00:51 +01:00
Thomas Schwinge
ba40277f6a [PR92848] [OpenACC] Use 'GOMP_MAP_VARS_ENTER_DATA' for dynamic data lifetimes
libgomp/
	PR libgomp/92848
	* oacc-mem.c (acc_map_data, present_create_copy)
	(goacc_insert_pointer): Use 'GOMP_MAP_VARS_ENTER_DATA'.
	(acc_unmap_data, delete_copyout, goacc_remove_pointer): Adjust.
	* testsuite/libgomp.oacc-c-c++-common/lib-50.c: Remove.
	* testsuite/libgomp.oacc-c-c++-common/pr92848-1-d-a.c: New file
	* testsuite/libgomp.oacc-c-c++-common/pr92848-1-d-p.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/pr92848-1-r-a.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/pr92848-1-r-p.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/subset-subarray-mappings-1-r-p.c:
	Remove "XFAIL"s.

From-SVN: r279530
2019-12-18 18:00:39 +01:00
Thomas Schwinge
6278b54922 Make 'libgomp/target.c:gomp_unmap_tgt' 'static' again
This got changed to 'attribute_hidden' in r271128, but it's not actually used
outside of 'libgomp/target.c'.

	libgomp/
	* target.c (gomp_unmap_tgt): Make it 'static'.
	* libgomp.h (gomp_unmap_tgt): Remove.

From-SVN: r279529
2019-12-18 18:00:28 +01:00
Tobias Burnus
c80c9e26de PR 86416 – improve lto1 diagnostic if a mode does not exist
PR middle-end/86416
        *  Makefile.in (CFLAGS-lto-streamer-in.o): Pass target_noncanonical on.
        * lto-streamer-in.c (lto_input_mode_table): Improve unsupported-mode
        diagnostic.

        PR middle-end/86416
        * testsuite/libgomp.c/pr86416-1.c: New.
        * testsuite/libgomp.c/pr86416-2.c: New.

From-SVN: r279528
2019-12-18 17:51:08 +01:00
Tobias Burnus
0b8499a480 libgomp/openacc.f90 – clean-up public/private attributes
* config/accel/openacc.f90 (module openacc_kinds): Use 'PUBLIC' to mark
        all symbols as public except for the 'use …, only' imported symbol,
        which is private. 
        (module openacc): Default to 'PRIVATE' to exclude openacc_internal; mark
        all symbols from module openacc_kinds as PUBLIC
        * openacc.f90: Add comment with crossref to that file and openmp_lib.h;
        fix comment typo.
        * openacc_lib.h (acc_device_gcn): Add this PARAMETER.

From-SVN: r279456
2019-12-17 12:19:32 +01:00
Julian Brown
1cbd94e834 Fix potential race condition in OpenACC "exit data" operations
PR libgomp/92881

	libgomp/
	* libgomp.h (gomp_remove_var_async): Add prototype.
	* oacc-mem.c (delete_copyout): Call gomp_remove_var_async instead of
	gomp_remove_var.
	* target.c (gomp_unref_tgt): Change return type to bool, indicating
	whether target_mem_desc was unmapped.
	(gomp_unref_tgt_void): New.
	(gomp_remove_var): Reimplement in terms of...
	(gomp_remove_var_internal): ...this new helper function.
	(gomp_remove_var_async): New, implemented using above helper function.
	(gomp_unmap_vars_internal): Use gomp_unref_tgt_void instead of
	gomp_unref_tgt.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

From-SVN: r279388
2019-12-13 23:14:15 +00:00
Andrew Stubbs
26b74ed022 Update OpenACC tests for amdgcn
2019-12-13  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-1.c: Handle gcn.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-parallel-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/function-not-offloaded.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/async_queue-1.c: Disable on GCN.
	* testsuite/libgomp.oacc-c-c++-common/tile-1.c: Likewise.

From-SVN: r279378
2019-12-13 17:40:06 +00:00
Tobias Burnus
7858bb9693 libgomp/openacc.f90 – clean-up public/private attributes
libgomp/
        * openacc.f90 (module openacc_kinds): Use 'PUBLIC' to mark all symbols
        as public except for the 'use …, only' imported symbol, which is
        private.
        (module openacc): Default to 'PRIVATE' to exclude openacc_internal; mark
        all symbols from module openacc_kinds as PUBLIC; add missing PUBLIC
        attributes for acc_copyout_finalize and acc_delete_finalize.

From-SVN: r279337
2019-12-13 08:58:53 +01:00
Jakub Jelinek
f8ac7d8f35 re PR fortran/92899 ([OpenMP] ICE in gfc_trans_omp_atomic, at fortran/trans-openmp.c:3769)
PR fortran/92899
	* trans-openmp.c (gfc_trans_omp_atomic): For GFC_OMP_ATOMIC_SWAP,
	do look through conversion on expr2 if any.

	* testsuite/libgomp.fortran/atomic1.f90: New test.

From-SVN: r279266
2019-12-12 00:58:04 +01:00
Thomas Schwinge
d6e8c01cff [PR92843] [OpenACC] Fix dynamic reference counting for structured 'REFCOUNT_INFINITY'
libgomp/
	PR libgomp/92843
	* oacc-mem.c (present_create_copy, delete_copyout): Fix dynamic
	reference counting for structured 'REFCOUNT_INFINITY'.  Add some
	assertions.
	(goacc_insert_pointer, goacc_remove_pointer): Adjust accordingly.
	* testsuite/libgomp.oacc-c-c++-common/pr92843-1.c: New file.
	* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Fix OpenACC.
	* testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise.

From-SVN: r279234
2019-12-11 17:49:27 +01:00
Thomas Schwinge
57963e3934 [OpenACC] Consolidate 'GOACC_enter_exit_data' and its helper functions in 'libgomp/oacc-mem.c'
libgomp/
	* oacc-parallel.c (find_pointer, GOACC_enter_exit_data): Move...
	* oacc-mem.c: ... here.
	(gomp_acc_insert_pointer, gomp_acc_remove_pointer): Rename to
	'goacc_insert_pointer', 'goacc_remove_pointer', and make 'static'.
	* libgomp.h (gomp_acc_insert_pointer, gomp_acc_remove_pointer):
	Remove.
	* libgomp_g.h: Update.

From-SVN: r279233
2019-12-11 17:49:17 +01:00
Thomas Schwinge
c5578b56b6 [OpenACC] Consolidate 'async'/'wait' code in 'libgomp/oacc-async.c'
libgomp/
	* oacc-parallel.c (GOACC_wait, goacc_wait): Move...
	* oacc-async.c: ... here.
	* oacc-int.h (goacc_wait): Declare.
	* libgomp_g.h: Update

From-SVN: r279232
2019-12-11 17:49:08 +01:00
Thomas Schwinge
3d1b5e710e [PR92854] Add 'libgomp.oacc-c-c++-common/acc_map_data-device_already-*.c', 'libgomp.oacc-c-c++-common/acc_map_data-host_already-*.c'
... to document the status quo.

	libgomp/
	PR libgomp/92854
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c:
	New file.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-3.c:
	Likewise.

From-SVN: r279231
2019-12-11 17:48:59 +01:00
Thomas Schwinge
5e93943822 [OpenACC] Initialize 'dynamic_refcount' whenever we initialize 'refcount'
Cases missed in r261813 "Update OpenACC data clause semantics to the 2.5
behavior".

	libgomp/
	* target.c (gomp_load_image_to_device, omp_target_associate_ptr):
	Initialize 'dynamic_refcount' whenever we initialize 'refcount'.

Co-Authored-By: Julian Brown <julian@codesourcery.com>

From-SVN: r279230
2019-12-11 17:48:44 +01:00
Tobias Burnus
93d9021987 libgomp – spelling fixes, incl. omp_lib.h.in
* omp_lib.h.in: Fix spelling of function declaration
        omp_get_cancell(l)ation.
        * libgomp.texi (acc_is_present, acc_async_test, acc_async_test_all):
        Fix typos.
        * env.c: Fix comment typos.
        * oacc-host.c: Likewise.
        * ordered.c: Likewise.
        * task.c: Likewise.
        * team.c: Likewise.
        * config/gcn/task.c: Likewise.
        * config/gcn/team.c: Likewise.
        * config/nvptx/task.c: Likewise.
        * config/nvptx/team.c: Likewise.
        * plugin/plugin-gcn.c: Likewise.
        * testsuite/libgomp.fortran/jacobi.f: Likewise.
        * testsuite/libgomp.hsa.c/tiling-2.c: Likewise.
        * testsuite/libgomp.oacc-c-c++-common/enter_exit-lib.c: Likewise.

From-SVN: r279218
2019-12-11 12:45:49 +01:00
Tobias Burnus
a0221aeebd [OpenMP/OpenACC/Fortran] Fix mapping of optional (present|absent) arguments
* testsuite/libgomp.oacc-fortran/optional-cache.f95: Add 'dg-do run'.
        * testsuite/libgomp.oacc-fortran/optional-reduction.f90: Remove
        unnecessary 'dg-additional-options "-w"'.

From-SVN: r279217
2019-12-11 11:40:11 +01:00
Thomas Schwinge
47afc7b4dd [PR92116, PR92877] [OpenACC] Replace 'openacc.data_environ' by standard libgomp mechanics
libgomp/
	PR libgomp/92116
	PR libgomp/92877
	* oacc-mem.c (lookup_dev): Reimplement.  Adjust all users.
	* libgomp.h (struct acc_dispatch_t): Remove 'data_environ' member.
	Adjust all users.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-4-2.c:
	Remove XFAIL.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-4.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/pr92877-1.c: New file.

Co-Authored-By: Julian Brown <julian@codesourcery.com>

From-SVN: r279147
2019-12-09 23:52:56 +01:00
Thomas Schwinge
cec41816c1 [PR92503] [OpenACC] Don't silently 'acc_unmap_data' in 'acc_free'
libgomp/
	PR libgomp/92503
	* oacc-mem.c (acc_free): Error out instead of 'acc_unmap_data'.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-1.c: New
	file.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-3-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-4-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-4.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Adjust.
	* testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise.

From-SVN: r279146
2019-12-09 23:52:47 +01:00
Thomas Schwinge
e103542bc8 [PR92840] [OpenACC] Refuse 'acc_unmap_data' unless mapped by 'acc_map_data'
libgomp/
	PR libgomp/92840
	* oacc-mem.c (acc_map_data): Clarify reference counting behavior.
	(acc_unmap_data): Add error case for 'REFCOUNT_INFINITY'.
	* testsuite/libgomp.oacc-c-c++-common/acc_unmap_data-pr92840-1.c:
	New file.
	* testsuite/libgomp.oacc-c-c++-common/acc_unmap_data-pr92840-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_unmap_data-pr92840-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Adjust.
	* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Adjust.

From-SVN: r279145
2019-12-09 23:52:36 +01:00
Thomas Schwinge
41f36f22f3 [PR92511] More testing for OpenACC "present" subarrays
In particular, "subset subarrays".

	libgomp/
	PR libgomp/92511
	* testsuite/libgomp.oacc-c-c++-common/copyin-devptr-1.c: Remove
	this file...
	* testsuite/libgomp.oacc-c-c++-common/copyin-devptr-2.c: ..., and
	this file...
	* testsuite/libgomp.oacc-c-c++-common/lib-22.c: ..., and this
	file...
	* testsuite/libgomp.oacc-c-c++-common/lib-30.c: ..., and this
	file...
	* testsuite/libgomp.oacc-c-c++-common/subset-subarray-mappings-1-r-p.c:
	... with their content moved into, and extended in this new file.
	* testsuite/libgomp.oacc-c-c++-common/subset-subarray-mappings-1-d-a.c:
	New file.
	* testsuite/libgomp.oacc-c-c++-common/subset-subarray-mappings-1-d-p.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/subset-subarray-mappings-1-r-a.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/subset-subarray-mappings-2.c:
	Likewise.

From-SVN: r279122
2019-12-09 12:40:36 +01:00
Thomas Schwinge
6effebe10b Add 'libgomp.oacc-c-c++-common/map-data-1.c'
libgomp/
	* testsuite/libgomp.oacc-c-c++-common/map-data-1.c: New file.

From-SVN: r279121
2019-12-09 12:40:27 +01:00
Thomas Schwinge
7d02047320 [PR92854] Add 'libgomp.oacc-c-c++-common/pr92854-1.c'
... to document the status quo.

	libgomp/
	PR libgomp/92854
	* testsuite/libgomp.oacc-c-c++-common/pr92854-1.c: New file.

From-SVN: r279120
2019-12-09 12:40:17 +01:00
Thomas Schwinge
1e1fb715cd Add 'libgomp.oacc-c-c++-common/host_data-6.c'
libgomp/
	* testsuite/libgomp.oacc-c-c++-common/host_data-6.c: New file.

From-SVN: r279119
2019-12-09 12:40:08 +01:00
Thomas Schwinge
b5859e4002 In 'libgomp/target.c:gomp_exit_data', remove open-coded 'gomp_remove_var'
libgomp/
	* target.c (gomp_exit_data): Use 'gomp_remove_var'.

From-SVN: r279118
2019-12-09 12:39:57 +01:00
Tobias Burnus
11586ed9c9 libgomp/testsuite/*fortran – make 'stop' values unique
* testsuite/libgomp.fortran/use_device_addr-3.f90: Make 'stop' codes
        unique.
        * testsuite/libgomp.fortran/use_device_addr-4.f90: Ditto.
        * testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/declare-5.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/optional-data-copyin-by-value.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/optional-firstprivate.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/optional-update-host.f90: Ditto.

From-SVN: r279117
2019-12-09 12:21:22 +01:00
Kwok Cheung Yeung
3ad4a03ac6 Fix Fortran linker errors on AMD GCN
2019-12-06  Kwok Cheung Yeung  <kcy@codesourcery.com>

	libgomp/
	* config/accel/proc.c (omp_get_num_procs): Apply ialias macro.

From-SVN: r279060
2019-12-06 18:33:19 +00:00
Tobias Burnus
6e4d01d61f [OpenMP/OpenACC/Fortran] Fix mapping of optional (present|absent) arguments
2019-12-06  Tobias Burnus  <tobias@codesourcery.com>
            Kwok Cheung Yeung <kcy@codesourcery.com>

        gcc/fortran/
        * trans-openmp.c (gfc_build_conditional_assign,
        gfc_build_conditional_assign_expr): New static functions.
        (gfc_omp_finish_clause, gfc_trans_omp_clauses): Handle mapping of
        absent optional arguments and fix mapping of present optional args.

        gcc/
        * omp-low.c (lower_omp_target): For optional arguments, deref once
        more to obtain the type.

        libgomp/
        * oacc-mem.c (update_dev_host, gomp_acc_insert_pointer): Just return
        if input it a NULL pointer.
        * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Remove; dependent on
        diagnostic of NULL pointer.
        * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Ditto.
        * testsuite/libgomp.fortran/optional-map.f90: New.
        * testsuite/libgomp.fortran/use_device_addr-1.f90
        (test_dummy_opt_callee_1_absent): New.
        (test_dummy_opt_call_1): Call it.
        * testsuite/libgomp.fortran/use_device_addr-2.f90: Likewise.
        * testsuite/libgomp.fortran/use_device_addr-3.f90: Likewise.
        * testsuite/libgomp.fortran/use_device_addr-4.f90: Likewise.
        * testsuite/libgomp.oacc-fortran/optional-cache.f95: New.
        * testsuite/libgomp.oacc-fortran/optional-data-copyin-by-value.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-data-copyin.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-data-copyout.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-data-enter-exit.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-declare.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-firstprivate.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-host_data.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-nested-calls.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-private.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-reduction.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-update-device.f90: New.
        * testsuite/libgomp.oacc-fortran/optional-update-host.f90: New.


Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com>

From-SVN: r279043
2019-12-06 14:06:53 +01:00
Tobias Burnus
c3cb71ef35 OpenMP] Fix use_device_… with absent optional arg
gcc/fortran/
        * trans-openmp.c (gfc_omp_is_optional_argument,
        gfc_omp_check_optional_argument): Handle type(c_ptr),value which uses a
        hidden argument for the is-present check.

        gcc/
        * omp-low.c (lower_omp_target): For use_device_ptr/use_derice_addr
        and Fortran's optional arguments, unconditionally add the is-present
        condition before the libgomp call.

        libgomp/
        * testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: Add
        'type(c_ptr), value' test case. Conditionally map the per-value
        passed arguments.

From-SVN: r279004
2019-12-05 16:18:39 +01:00
Tobias Burnus
ad80ec460b testsuite/libgomp.oacc-fortran: Update dg-output to fix GCN
* testsuite/libgomp.oacc-fortran/error_stop-1.f: Also don't
        expect dg-output of 'Error termination.' for GCN.
        * testsuite/libgomp.oacc-fortran/error_stop-2.f: Likewise.
        * testsuite/libgomp.oacc-fortran/error_stop-3.f: Likewise.

Plus: Fix date of a previous commit in:
        * gcc/fortran/ChangeLog
        * gcc/testsuite/ChangeLog

From-SVN: r278986
2019-12-05 09:38:53 +01:00
Jakub Jelinek
a8a5f4cc04 re PR fortran/92756 (ICE in lower_omp, at omp-low.c:12988)
PR fortran/92756
	* trans-openmp.c (gfc_trans_omp_teams): Wrap OMP_TEAMS body into a
	BIND_EXPR with a forced BLOCK.

	* gfortran.dg/gomp/teams1.f90: New test.

	* testsuite/libgomp.fortran/teams1.f90: New test.
	* testsuite/libgomp.fortran/teams2.f90: New test.

From-SVN: r278956
2019-12-04 09:47:13 +01:00
Frederik Harwath
d8f0024b57 Validate acc_device_t uses
Check that function arguments of type acc_device_t
are valid enumeration values in all publicly visible
functions from oacc-init.c.

2019-12-03  Frederik Harwath  <frederik@codesourcery.com>

	libgomp/
	* oacc-init.c (acc_known_device_type): Add function.
	(unknown_device_type_error): Add function.
 	(name_of_acc_device_t): Change to call unknown_device_type_error
	on unknown type.
	(resolve_device): Use acc_known_device_type.
 	(acc_init): Fail if acc_device_t argument is not valid.
 	(acc_shutdown): Likewise.
 	(acc_get_num_devices): Likewise.
 	(acc_set_device_type): Likewise.
	(acc_get_device_num): Likewise.
	(acc_set_device_num): Likewise.
 	(acc_on_device): Add comment that argument validity is not checked.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

From-SVN: r278937
2019-12-03 14:38:54 +00:00
Andrew Stubbs
83caa34e2a Enable OpenACC GCN testing.
2019-12-03  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type):
	Recognize amdgcn.
	(check_effective_target_openacc_amdgcn_accel_present): New proc.
	(check_effective_target_openacc_amdgcn_accel_selected): New proc.
	* testsuite/libgomp.oacc-c++/c++.exp: Add support for amdgcn.
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

From-SVN: r278935
2019-12-03 12:53:53 +00:00
Szabolcs Nagy
004843655a musl: Fix invalid tls model in libgomp and libitm PR91938
Musl does not support initial-exec tls in dynamically loaded shared
libraries.

libgomp/ChangeLog:

2019-12-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	PR libgomp/91938
	* configure.tgt: Avoid IE tls on *-*-musl*.

libitm/ChangeLog:

2019-12-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	PR libgomp/91938
	* configure.tgt: Avoid IE tls on *-*-musl*.

From-SVN: r278932
2019-12-03 11:13:38 +00:00
Tobias Burnus
9909a05940 Fortran] OpenACC – permit common blocks in some clauses
* testsuite/libgomp.oacc-fortran/declare-5.f90: Extend by
        adding a common-block test case.

From-SVN: r278845
2019-11-29 14:59:21 +01:00
Jakub Jelinek
52702016ad re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)
PR c++/60228
	* parser.c (cp_parser_omp_declare_reduction_exprs): If
	processing_template_decl, wrap the combiner or initializer
	into EXPR_STMT.
	* decl.c (start_preparsed_function): Don't start a lambda scope
	for DECL_OMP_DECLARE_REDUCTION_P functions.
	(finish_function): Don't finish a lambda scope for
	DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function
	them nor cp_genericize them.
	* mangle.c (decl_mangling_context): Look through
	DECL_OMP_DECLARE_REDUCTION_P functions.
	* semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P
	functions, use tentative linkage, don't keep their bodies with
	-fkeep-inline-functions and return false at the end.

	* g++.dg/gomp/openmp-simd-2.C: Don't expect bodies for
	DECL_OMP_DECLARE_REDUCTION_P functions.

	* testsuite/libgomp.c++/udr-20.C: New test.
	* testsuite/libgomp.c++/udr-21.C: New test.

From-SVN: r278832
2019-11-29 10:10:44 +01:00
Jakub Jelinek
b3f44388f3 re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)
PR c++/60228
	* parser.c (cp_parser_omp_declare_reduction_exprs): If
	processing_template_decl, wrap the combiner or initializer
	into EXPR_STMT.
	* decl.c (start_preparsed_function): Don't start a lambda scope
	for DECL_OMP_DECLARE_REDUCTION_P functions.
	(finish_function): Don't finish a lambda scope for
	DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function
	them nor cp_genericize them.
	* mangle.c (decl_mangling_context): Look through
	DECL_OMP_DECLARE_REDUCTION_P functions.
	* semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P
	functions, use tentative linkage, don't keep their bodies with
	-fkeep-inline-functions and return false at the end.

	* g++.dg/gomp/openmp-simd-2.C: Don't expect bodies for
	DECL_OMP_DECLARE_REDUCTION_P functions.

	* testsuite/libgomp.c++/udr-20.C: New test.
	* testsuite/libgomp.c++/udr-21.C: New test.

From-SVN: r278831
2019-11-29 10:08:46 +01:00
Thomas Schwinge
b1a73b4894 Fix 'libgomp.fortran/target-print-1.f90', 'libgomp.oacc-fortran/print-1.f90' for offload target nvptx
libgomp/
	* testsuite/lib/libgomp.exp
	(check_effective_target_offload_target_nvptx): New proc.
	* testsuite/libgomp.fortran/target-print-1.f90: Use it with
	'dg-skip-if'.
	* testsuite/libgomp.oacc-fortran/print-1.f90: Likewise.
	* testsuite/libgomp.fortran/target-print-1-nvptx.f90: New file.
	* testsuite/libgomp.oacc-fortran/print-1-nvptx.f90: Likewise.

From-SVN: r278779
2019-11-27 18:50:55 +01:00
Rainer Orth
b8e724465b Fix failures on Solaris with -fno-common default
gcc/testsuite:
	* gcc.c-torture/execute/20030913-1.c: Rename glob to g.
	* gcc.c-torture/execute/960218-1.c: Rename glob to gl.
	* gcc.c-torture/execute/complex-6.c: Rename err to e.
	* gcc.dg/torture/ssa-pta-fn-1.c: Rename glob to g.

	libgomp:
	* testsuite/libgomp.c/pr39591-1.c: Rename err to e.
	* testsuite/libgomp.c/pr39591-2.c: Likewise.
	* testsuite/libgomp.c/pr39591-3.c: Likewise.
	* testsuite/libgomp.c/private-1.c: Likewise.
	* testsuite/libgomp.c/task-1.c: Likewise.
	* testsuite/libgomp.c/task-5.c: Renamed err to serr.

From-SVN: r278571
2019-11-21 16:14:21 +00:00
Julian Brown
d88b27daa1 AMD GCN libgomp plugin queue-full condition locking fix
libgomp/
	* plugin/plugin-gcn.c (wait_for_queue_nonfull): Don't lock/unlock
	aq->mutex here.
	(queue_push_launch): Lock aq->mutex before calling
	wait_for_queue_nonfull.
	(queue_push_callback): Likewise.
	(queue_push_asyncwait): Likewise.
	(queue_push_placeholder): Likewise.

Reviewed-by: Andrew Stubbs <ams@codesourcery.com>

From-SVN: r278517
2019-11-20 17:56:30 +00:00
Julian Brown
8d2f4ddfd7 Fix host-to-device copies from rodata for AMD GCN
libgomp/
	* plugin/plugin-gcn.c (hsa_memory_copy_wrapper): New.
	(copy_data, GOMP_OFFLOAD_host2dev): Use above function.
	(GOMP_OFFLOAD_dev2host, GOMP_OFFLOAD_dev2dev): Check hsa_memory_copy
	return code.

Reviewed-by: Andrew Stubbs <ams@codesourcery.com>

From-SVN: r278516
2019-11-20 17:53:31 +00:00
Julian Brown
e307b05f43 OpenACC "present" subarrays: runtime API return value and unmapping fixes
PR libgomp/92511

	libgomp/
	* oacc-mem.c (present_create_copy): Fix device pointer return value in
	case of "present" subarray.  Use tgt->tgt_start instead of tgt->to_free
	in non-present/create case.
	(delete_copyout): Change error condition to fail only on copies outside
	of mapped block.  Adjust error message accordingly.
	* testsuite/libgomp.oacc-c-c++-common/copyin-devptr-1.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/copyin-devptr-2.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/lib-20.c: Adjust expected error
	message.
	* testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-22.c: Allow test to pass now.
	* testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

From-SVN: r278514
2019-11-20 17:51:09 +00:00
Maciej W. Rozycki
83115e9eb8 libgomp/test: Add flags to find libatomic in build-tree testing
Add flags to find libatomic in build-tree testing, fixing a catastrophic
libgomp testsuite failure with `riscv*-*-linux*' targets, which imply
`-latomic' with the `-pthread' GCC option, implied in turn by the
`-fopenacc' and `-fopenmp' options, removing failures like:

.../bin/riscv64-linux-gnu-ld: cannot find -latomic
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: libgomp.c/../libgomp.c-c++-common/atomic-18.c (test for excess errors)
Excess errors:
.../bin/riscv64-linux-gnu-ld: cannot find -latomic

UNRESOLVED: libgomp.c/../libgomp.c-c++-common/atomic-18.c compilation failed to produce executable

and bringing overall test results for the `riscv64-linux-gnu' target
(here with the `x86_64-linux-gnu' host and RISC-V QEMU in the Linux user
emulation mode as the target board) from:

		=== libgomp Summary ===

# of expected passes		90
# of unexpected failures	3267
# of expected failures		2
# of unresolved testcases	3247
# of unsupported tests		548

to:

		=== libgomp Summary ===

# of expected passes		6834
# of unexpected failures	4
# of expected failures		4
# of unsupported tests		518

	libgomp/
	* testsuite/lib/libgomp.exp (libgomp_init): Add flags to find
	libatomic in build-tree testing.

From-SVN: r278505
2019-11-20 15:49:23 +00:00
Maciej W. Rozycki
a128988785 libgomp: Regenerate `testsuite/Makefile.in' for GCC_HEADER_STDINT removal
Commit r276389 ("configure.ac: Remove GCC_HEADER_STDINT(gstdint.h)") has
not regenerated `testsuite/Makefile.in'.  Fix it.

	libgomp/
	* testsuite/Makefile.in: Regenerate.

From-SVN: r278384
2019-11-18 00:33:37 +00:00
Andrew Stubbs
8916ba874d Add tests for print from offload target.
2019-11-15  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* testsuite/libgomp.c/target-print-1.c: New file.
	* testsuite/libgomp.fortran/target-print-1.f90: New file.
	* testsuite/libgomp.oacc-c/print-1.c: New file.
	* testsuite/libgomp.oacc-fortran/print-1.f90: New file.

From-SVN: r278284
2019-11-15 10:49:10 +00:00
Andrew Stubbs
237957cc2c GCN Libgomp Plugin
2019-11-13  Andrew Stubbs  <ams@codesourcery.com>
	    Kwok Cheung Yeung  <kcy@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>
	    Tom de Vries  <tom@codesourcery.com>

	libgomp/
	* plugin/Makefrag.am: Add amdgcn plugin support.
	* plugin/configfrag.ac: Likewise.
	* plugin/plugin-gcn.c: New file.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>

From-SVN: r278138
2019-11-13 12:38:18 +00:00
Andrew Stubbs
cee1645106 Optimize GCN OpenMP malloc performance
2019-11-13  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* config/gcn/team.c (gomp_gcn_enter_kernel): Set up the team arena
	and use team_malloc variants.
	(gomp_gcn_exit_kernel): Use team_free.
	* libgomp.h (TEAM_ARENA_SIZE): Define.
	(TEAM_ARENA_START): Define.
	(TEAM_ARENA_FREE): Define.
	(TEAM_ARENA_END): Define.
	(team_malloc): New function.
	(team_malloc_cleared): New function.
	(team_free): New function.
	* team.c (gomp_new_team): Initialize and use team_malloc.
	(free_team): Use team_free.
	(gomp_free_thread): Use team_free.
	(gomp_pause_host): Use team_free.
	* work.c (gomp_init_work_share): Use team_malloc.
	(gomp_fini_work_share): Use team_free.

From-SVN: r278136
2019-11-13 12:38:09 +00:00
Andrew Stubbs
fa4999953d GCN libgomp port
2019-11-13  Andrew Stubbs  <ams@codesourcery.com>
	    Kwok Cheung Yeung  <kcy@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>
	    Tom de Vries  <tom@codesourcery.com>

	include/
	* gomp-constants.h (GOMP_DEVICE_GCN): Define.
	(GOMP_VERSION_GCN): Define.

	libgomp/
	* Makefile.am (libgomp_la_SOURCES): Add oacc-target.c.
	* Makefile.in: Regenerate.
	* config.h.in (PLUGIN_GCN): Add new undef.
	* config/accel/openacc.f90 (acc_device_gcn): New parameter.
	* config/gcn/affinity-fmt.c: New file.
	* config/gcn/bar.c: New file.
	* config/gcn/bar.h: New file.
	* config/gcn/doacross.h: New file.
	* config/gcn/icv-device.c: New file.
	* config/gcn/oacc-target.c: New file.
	* config/gcn/simple-bar.h: New file.
	* config/gcn/target.c: New file.
	* config/gcn/task.c: New file.
	* config/gcn/team.c: New file.
	* config/gcn/time.c: New file.
	* configure.ac: Add amdgcn*-*-*.
	* configure: Regenerate.
	* configure.tgt: Add amdgcn*-*-*.
	* libgomp-plugin.h (offload_target_type): Add OFFLOAD_TARGET_TYPE_GCN.
	* libgomp.h (gcn_thrs): Add amdgcn variant.
	(set_gcn_thrs): Likewise.
	(gomp_thread): Likewise.
	* oacc-int.h (goacc_thread): Likewise.
	* oacc-target.c: New file.
	* openacc.f90 (acc_device_gcn): New parameter.
	* openacc.h (acc_device_t): Add acc_device_gcn.
	* team.c (gomp_free_pool_helper): Add amdgcn support.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>

From-SVN: r278135
2019-11-13 12:38:04 +00:00
Andrew Stubbs
d2903ce05b Add device number to GOMP_OFFLOAD_openacc_async_construct
2019-11-13  Andrew Stubbs  <ams@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>

	libgomp/
	* libgomp-plugin.h (GOMP_OFFLOAD_openacc_async_construct): Add int
	parameter.
	* oacc-async.c (lookup_goacc_asyncqueue): Pass device number to the
	queue constructor.
	* oacc-host.c (host_openacc_async_construct): Add device parameter.
	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_openacc_async_construct): Add
	device parameter.

Co-Authored-By: Julian Brown <julian@codesourcery.com>

From-SVN: r278134
2019-11-13 12:37:59 +00:00
Andrew Stubbs
b3d14b3aa3 Move generic libgomp files from nvptx to accel
2019-11-13  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* configure.tgt (nvptx*-*-*): Add "accel" directory.
	* config/nvptx/libgomp-plugin.c: Move ...
	* config/accel/libgomp-plugin.c: ... to here.
	* config/nvptx/lock.c: Move ...
	* config/accel/lock.c: ... to here.
	* config/nvptx/mutex.c: Move ...
	* config/accel/mutex.c: ... to here.
	* config/nvptx/mutex.h: Move ...
	* config/accel/mutex.h: ... to here.
	* config/nvptx/oacc-async.c: Move ...
	* config/accel/oacc-async.c: ... to here.
	* config/nvptx/oacc-cuda.c: Move ...
	* config/accel/oacc-cuda.c: ... to here.
	* config/nvptx/oacc-host.c: Move ...
	* config/accel/oacc-host.c: ... to here.
	* config/nvptx/oacc-init.c: Move ...
	* config/accel/oacc-init.c: ... to here.
	* config/nvptx/oacc-mem.c: Move ...
	* config/accel/oacc-mem.c: ... to here.
	* config/nvptx/oacc-plugin.c: Move ...
	* config/accel/oacc-plugin.c: ... to here.
	* config/nvptx/omp-lock.h: Move ...
	* config/accel/omp-lock.h: ... to here.
	* config/nvptx/openacc.f90: Move ...
	* config/accel/openacc.f90: ... to here.
	* config/nvptx/pool.h: Move ...
	* config/accel/pool.h: ... to here.
	* config/nvptx/proc.c: Move ...
	* config/accel/proc.c: ... to here.
	* config/nvptx/ptrlock.c: Move ...
	* config/accel/ptrlock.c: ... to here.
	* config/nvptx/ptrlock.h: Move ...
	* config/accel/ptrlock.h: ... to here.
	* config/nvptx/sem.c: Move ...
	* config/accel/sem.c: ... to here.
	* config/nvptx/sem.h: Move ...
	* config/accel/sem.h: ... to here.
	* config/nvptx/thread-stacksize.h: Move ...
	* config/accel/thread-stacksize.h: ... to here.

From-SVN: r278132
2019-11-13 12:37:50 +00:00
Maciej W. Rozycki
62aee289e4 Add OpenACC 2.6 `serial' construct support
The `serial' construct (cf. section 2.5.3 of the OpenACC 2.6 standard)
    is equivalent to a `parallel' construct with clauses `num_gangs(1)
    num_workers(1) vector_length(1)' implied.
    These clauses are therefore not supported with the `serial'
    construct. All the remaining clauses accepted with `parallel' are also
    accepted with `serial'.

    The `serial' construct is implemented like `parallel', except for
    hardcoding dimensions rather than taking them from the relevant
    clauses, in `expand_omp_target'.

    Separate codes are used to denote the `serial' construct throughout the
    middle end, even though the mapping of `serial' to an equivalent
    `parallel' construct could have been done in the individual language
    frontends. In particular, this allows to distinguish between compute
    constructs in warnings, error messages, dumps etc.

    2019-11-12  Maciej W. Rozycki  <macro@codesourcery.com>
                Tobias Burnus  <tobias@codesourcery.com>
                Frederik Harwath  <frederik@codesourcery.com>
                Thomas Schwinge  <thomas@codesourcery.com>

    gcc/
    * gimple.h (gf_mask): Add GF_OMP_TARGET_KIND_OACC_SERIAL
    enumeration constant.
    (is_gimple_omp_oacc): Handle GF_OMP_TARGET_KIND_OACC_SERIAL.
    (is_gimple_omp_offloaded): Likewise.
    * gimplify.c (omp_region_type): Add ORT_ACC_SERIAL enumeration
    constant.  Adjust the value of ORT_NONE accordingly.
    (is_gimple_stmt): Handle OACC_SERIAL.
    (oacc_default_clause): Handle ORT_ACC_SERIAL.
    (gomp_needs_data_present): Likewise.
    (gimplify_adjust_omp_clauses): Likewise.
    (gimplify_omp_workshare): Handle OACC_SERIAL.
    (gimplify_expr): Likewise.
    * omp-expand.c (expand_omp_target):
    Handle GF_OMP_TARGET_KIND_OACC_SERIAL.
    (build_omp_regions_1, omp_make_gimple_edges): Likewise.
    * omp-low.c (is_oacc_parallel): Rename function to...
    (is_oacc_parallel_or_serial): ... this.
    Handle GF_OMP_TARGET_KIND_OACC_SERIAL.
    (scan_sharing_clauses): Adjust accordingly.
    (scan_omp_for): Likewise.
    (lower_oacc_head_mark): Likewise.
    (convert_from_firstprivate_int): Likewise.
    (lower_omp_target): Likewise.
    (check_omp_nesting_restrictions): Handle
    GF_OMP_TARGET_KIND_OACC_SERIAL.
    (lower_oacc_reductions): Likewise.
    (lower_omp_target): Likewise.
    * tree.def (OACC_SERIAL): New tree code.
    * tree-pretty-print.c (dump_generic_node): Handle OACC_SERIAL.

    * doc/generic.texi (OpenACC): Document OACC_SERIAL.

    gcc/c-family/
    * c-pragma.h (pragma_kind): Add PRAGMA_OACC_SERIAL enumeration
    constant.
    * c-pragma.c (oacc_pragmas): Add "serial" entry.

    gcc/c/
    * c-parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
    (c_parser_oacc_kernels_parallel): Rename function to...
    (c_parser_oacc_compute): ... this.  Handle PRAGMA_OACC_SERIAL.
    (c_parser_omp_construct): Update accordingly.

    gcc/cp/
    * constexpr.c (potential_constant_expression_1): Handle
    OACC_SERIAL.
    * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
    (cp_parser_oacc_kernels_parallel): Rename function to...
    (cp_parser_oacc_compute): ... this.  Handle PRAGMA_OACC_SERIAL.
    (cp_parser_omp_construct): Update accordingly.
    (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL.  Fix alphabetic
    order.
    * pt.c (tsubst_expr): Handle OACC_SERIAL.

    gcc/fortran/
    * gfortran.h (gfc_statement): Add ST_OACC_SERIAL_LOOP,
    ST_OACC_END_SERIAL_LOOP, ST_OACC_SERIAL and ST_OACC_END_SERIAL
    enumeration constants.
    (gfc_exec_op): Add EXEC_OACC_SERIAL_LOOP and EXEC_OACC_SERIAL
    enumeration constants.
    * match.h (gfc_match_oacc_serial): New prototype.
    (gfc_match_oacc_serial_loop): Likewise.
    * dump-parse-tree.c (show_omp_node, show_code_node): Handle
    EXEC_OACC_SERIAL_LOOP and EXEC_OACC_SERIAL.
    * match.c (match_exit_cycle): Handle EXEC_OACC_SERIAL_LOOP.
    * openmp.c (OACC_SERIAL_CLAUSES): New macro.
    (gfc_match_oacc_serial_loop): New function.
    (gfc_match_oacc_serial): Likewise.
    (oacc_is_loop): Handle EXEC_OACC_SERIAL_LOOP.
    (resolve_omp_clauses): Handle EXEC_OACC_SERIAL.
    (oacc_code_to_statement): Handle EXEC_OACC_SERIAL and
    EXEC_OACC_SERIAL_LOOP.
    (gfc_resolve_oacc_directive): Likewise.
    * parse.c (decode_oacc_directive) <'s'>: Add case for "serial"
    and "serial loop".
    (next_statement): Handle ST_OACC_SERIAL_LOOP and ST_OACC_SERIAL.
    (gfc_ascii_statement): Likewise.  Handle ST_OACC_END_SERIAL_LOOP
    and ST_OACC_END_SERIAL.
    (parse_oacc_structured_block): Handle ST_OACC_SERIAL.
    (parse_oacc_loop): Handle ST_OACC_SERIAL_LOOP and
    ST_OACC_END_SERIAL_LOOP.
    (parse_executable): Handle ST_OACC_SERIAL_LOOP and
    ST_OACC_SERIAL.
    (is_oacc): Handle EXEC_OACC_SERIAL_LOOP and EXEC_OACC_SERIAL.
    * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Likewise.
    * st.c (gfc_free_statement): Likewise.
    * trans-openmp.c (gfc_trans_oacc_construct): Handle
    EXEC_OACC_SERIAL.
    (gfc_trans_oacc_combined_directive): Handle
    EXEC_OACC_SERIAL_LOOP.
    (gfc_trans_oacc_directive): Handle EXEC_OACC_SERIAL_LOOP and
    EXEC_OACC_SERIAL.
    * trans.c (trans_code): Likewise.

    gcc/testsuite/
    * c-c++-common/goacc/parallel-dims.c: New test.
    * gfortran.dg/goacc/parallel-dims.f90: New test.

    libgomp/
    * testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: New test.
    * testsuite/libgomp.oacc-fortran/parallel-dims-aux.c: New test.
    * testsuite/libgomp.oacc-fortran/parallel-dims.f89: New test.
    * testsuite/libgomp.oacc-fortran/parallel-dims-2.f90: New test.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>


Co-Authored-By: Frederik Harwath <frederik@codesourcery.com>
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Co-Authored-By: Tobias Burnus <tobias@codesourcery.com>

From-SVN: r278082
2019-11-12 08:45:35 +00:00
Tobias Burnus
a2c26c5031 Fortran] Support absent optional args with use_device_{ptr,addr}
2019-11-11  Tobias Burnus  <tobias@codesourcery.com>
            Kwok Cheung Yeung  <kcy@codesourcery.com>

        gcc/
        * langhooks-def.h (LANG_HOOKS_OMP_CHECK_OPTIONAL_ARGUMENT):
        Renamed from LANG_HOOKS_OMP_IS_OPTIONAL_ARGUMENT; update define.
        (LANG_HOOKS_DECLS): Rename also here.
        * langhooks.h (lang_hooks_for_decls): Rename
        omp_is_optional_argument to omp_check_optional_argument; take
        additional bool argument.
        * omp-general.h (omp_check_optional_argument): Likewise.
        * omp-general.h (omp_check_optional_argument): Likewise.
        * omp-low.c (lower_omp_target): Update calls; handle absent
        Fortran optional arguments with USE_DEVICE_ADDR/USE_DEVICE_PTR.

        gcc/fortran/
        * trans-expr.c (gfc_conv_expr_present): Check for DECL_ARTIFICIAL
        for the VALUE hidden argument avoiding -fallow-underscore issues.
        * trans-decl.c (create_function_arglist): Also set
        GFC_DECL_OPTIONAL_ARGUMENT for per-value arguments.
        * f95-lang.c (LANG_HOOKS_OMP_CHECK_OPTIONAL_ARGUMENT):
        Renamed from LANG_HOOKS_OMP_IS_OPTIONAL_ARGUMENT; point
        to gfc_omp_check_optional_argument.
        * trans.h (gfc_omp_check_optional_argument): Subsitutes
        gfc_omp_is_optional_argument declaration.
        * trans-openmp.c (gfc_omp_is_optional_argument): Make static.
        (gfc_omp_check_optional_argument): New function.

        libgomp/
        * testsuite/libgomp.fortran/use_device_ptr-optional-1.f90: Extend.
        * testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: New.


Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com>

From-SVN: r278046
2019-11-11 10:19:29 +01:00
Thomas Schwinge
bfa1837b01 Torture testing: 'libgomp.fortran/target9.f90'
libgomp/
	* testsuite/libgomp.fortran/target9.f90: Specify 'dg-do run'.

From-SVN: r278045
2019-11-11 09:50:40 +01:00
Thomas Schwinge
6d4868f3a1 Torture testing: 'libgomp.fortran/use_device_addr-3.f90', 'libgomp.fortran/use_device_addr-4.f90', 'libgomp.fortran/use_device_ptr-1.f90'
libgomp/
	* testsuite/libgomp.fortran/use_device_addr-3.f90: Specify 'dg-do
	run'.
	* testsuite/libgomp.fortran/use_device_addr-4.f90: Likewise.
	* testsuite/libgomp.fortran/use_device_ptr-1.f90: Likewise.

From-SVN: r278044
2019-11-11 09:50:29 +01:00
Frederik Harwath
5d183d1740 Warn about inconsistent OpenACC nested reduction clauses
OpenACC (cf. OpenACC 2.7, section 2.9.11. "reduction clause";
	this was first clarified by OpenACC 2.6) requires that, if a
	variable is used in reduction clauses on two nested loops, then
	there must be reduction clauses for that variable on all loops
	that are nested in between the two loops and all these reduction
	clauses must use the same operator.
	This commit introduces a check for that property which reports
	warnings if it is violated.

	2019-11-06  Gergö Barany  <gergo@codesourcery.com>
	            Frederik Harwath  <frederik@codesourcery.com>
	            Thomas Schwinge  <thomas@codesourcery.com>

	gcc/
	* omp-low.c (struct omp_context): New fields
	local_reduction_clauses, outer_reduction_clauses.
	(new_omp_context): Initialize these.
	(scan_sharing_clauses): Record reduction clauses on OpenACC constructs.
	(scan_omp_for): Check reduction clauses for incorrect nesting.
	gcc/testsuite/
	* c-c++-common/goacc/nested-reductions-warn.c: New test.
	* c-c++-common/goacc/nested-reductions.c: New test.
	* gfortran.dg/goacc/nested-reductions-warn.f90: New test.
	* gfortran.dg/goacc/nested-reductions.f90: New test.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-1.c:
	Add expected warnings about missing reduction clauses.
	* testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c:
	Likewise.

	Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

From-SVN: r277875
2019-11-06 10:43:52 +00:00
Tobias Burnus
d8f03b0341 libgomp - remove dg-run if dg-options O2 is used
* testsuite/libgomp.fortran/pr66199-1.f90: Remove
	'dg-do run' (implies torture test) as 'dg-options "O2"' is used.
	* testsuite/libgomp.fortran/pr66199-2.f90: Ditto.
	* testsuite/libgomp.fortran/taskloop2.f90: Ditto.
	* testsuite/libgomp.fortran/taskloop3.f90: Ditto.
	* testsuite/libgomp.fortran/taskloop4.f90: Ditto.

From-SVN: r277776
2019-11-04 14:18:50 +01:00
Tobias Burnus
12fd2ec5ae libgomp/testsuite - use unique numbers with Fortran's 'stop'
PR fortran/92305
        * testsuite/libgomp.fortran/allocatable2.f90: Use
        unique numbers with 'stop'.
        * testsuite/libgomp.fortran/use_device_addr-1.f90: Ditto.
        * testsuite/libgomp.fortran/use_device_addr-2.f90: Ditto.
        * testsuite/libgomp.fortran/use_device_ptr-1.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/lib-15.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/pset-1.f90: Ditto.

From-SVN: r277769
2019-11-04 11:01:22 +01:00
Tobias Burnus
92e63bd2df OpenMP] use_device_addr/use_device_ptr with Fortran allocatable/pointer arrays
gcc/fortran/
        * f95-lang.c (LANG_HOOKS_OMP_ARRAY_DATA): Set to gfc_omp_array_data.
        * trans-array.c (gfc_conv_descriptor_data_get): Handle also
        REFERENCE_TYPE.
        * trans-openmp.c (gfc_omp_array_data): New.
        * trans.h (gfc_omp_array_data): New prototype.

        gcc/
        * hooks.c (hook_tree_tree_bool_null): New.
        * hooks.h (hook_tree_tree_bool_null): Declare.
        * langhooks-def.h (LANG_HOOKS_OMP_ARRAY_DATA): Define.
        (LANG_HOOKS_DECLS): Add it.
        * langhooks.h (lang_hooks_for_decls): Add omp_array_data.
        * omp-low.c (install_var_field): New mode for Fortran descriptor arrays.
        (lower_omp_target): Handle Fortran array with descriptor in
        OMP_CLAUSE_USE_DEVICE_ADDR/OMP_CLAUSE_USE_DEVICE_PTR.

        libgomp/
        * testsuite/libgomp.fortran/use_device_addr-1.f90 (test_nullptr_1,
        test_dummy_opt_nullptr_callee_1): Add present but unallocated test.
        * testsuite/libgomp.fortran/use_device_addr-2.f90: Likewise.
        * testsuite/libgomp.fortran/use_device_addr-3.f90: New.
        * testsuite/libgomp.fortran/use_device_addr-4.f90: New.
        * testsuite/testsuite/libgomp.fortran/use_device_ptr-1.f90: New.

From-SVN: r277705
2019-11-01 08:59:23 +01:00
Tobias Burnus
91ae0a46fd Fortran/OpenMP] Don't create "alloc:" for 'target exit data'
gcc/
        * gimplify.c (gimplify_scan_omp_clauses): Remove FE-generated
        GOMP_MAP_TO_PSET and GOMP_MAP_POINTER mapping for 'target update'
        and 'target exit data'.

        libgomp/
        * testsuite/libgomp.fortran/target9.f90: New.

From-SVN: r277631
2019-10-30 17:32:38 +01:00
Tobias Burnus
c425e66b27 libgomp/testsuite – use 'stop'
libgomp/
	* testsuite/libgomp.fortran/: Replace 'STOP' by 'stop'.

From-SVN: r277609
2019-10-30 12:44:54 +01:00
Tobias Burnus
01509e2f04 libgomp/testsuite – use 'stop' and 'dg-do run'
libgomp/
        * testsuite/libgomp.fortran/target-simd.f90: Use stop not abort.
        * testsuite/libgomp.fortran/use_device_ptr-optional-1.f90:
        Ditto; add 'dg-do run' for torture testing.
        * testsuite/libgomp.fortran/lastprivate1.f90:  Add 'dg-do run'.
        * testsuite/libgomp.fortran/lastprivate2.f90: Ditto.
        * testsuite/libgomp.fortran/nestedfn4.f90: Ditto.
        * testsuite/libgomp.fortran/pr25219.f90: Ditto.
        * testsuite/libgomp.fortran/pr28390.f: Ditto.
        * testsuite/libgomp.fortran/pr35130.f90: Ditto.
        * testsuite/libgomp.fortran/pr90779.f90: Ditto.
        * testsuite/libgomp.fortran/task2.f90: Ditto.
        * testsuite/libgomp.fortran/taskgroup1.f90: Ditto.
        * testsuite/libgomp.fortran/taskloop1.f90: Ditto.
        * testsuite/libgomp.fortran/use_device_addr-1.f90: Ditto.
        * testsuite/libgomp.fortran/use_device_addr-2.f90: Ditto.
        * testsuite/libgomp.fortran/workshare1.f90: Ditto.
        * testsuite/libgomp.fortran/workshare2.f90: Ditto.

From-SVN: r277606
2019-10-30 11:33:58 +01:00
Tobias Burnus
ffbdd78a4a Fortran] OpenACC – libgomp/testsuite – use 'stop' and 'dg-do run'
* testsuite/libgomp.oacc-fortran/abort-1.f90: Add 'dg-do run'.
        * testsuite/libgomp.oacc-fortran/abort-2.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/lib-1.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/common-block-1.f90:
        Use 'stop' not abort().
        * testsuite/libgomp.oacc-fortran/common-block-2.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/common-block-3.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/data-1.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/data-2.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/data-5.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/dummy-array.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/gemm-2.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/gemm.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/host_data-2.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/host_data-3.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/host_data-4.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-collapse-3.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-collapse-4.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-independent.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-loop-1.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-map-1.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-parallel-loop-data-enter-exit.f95:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-vector-1.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-vector-2.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-1.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-2.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-3.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-4.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-5.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-6.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-7.f90:
        Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-reduction-1.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/lib-12.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/lib-13.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/lib-14.f90: Ditto.
        * testsuite/libgomp.oacc-fortran/kernels-acc-loop-reduction-2.f90:
        Likewise and also add 'dg-do run'.
        * testsuite/libgomp.oacc-fortran/kernels-acc-loop-reduction.f90:
        Ditto.

From-SVN: r277503
2019-10-28 08:39:26 +01:00
Cesar Philippidis
ec0846134e [Fortran] OpenACC – permit common blocks in some clauses
2019-10-25  Cesar Philippidis <cesar@codesourcery.com>
	    Tobias Burnus  <tobias@codesourcery.com>

	gcc/fortran/
	* openmp.c (gfc_match_omp_map_clause): Add and pass allow_commons
	argument.
	(gfc_match_omp_clauses): Update calls to permit common blocks for
	OpenACC's copy/copyin/copyout, create/delete, host,
	pcopy/pcopy_in/pcopy_out, present_or_copy, present_or_copy_in,
	present_or_copy_out, present_or_create and self.

	gcc/
	* gimplify.c (oacc_default_clause): Privatize fortran common blocks.
	(omp_notice_variable): Defer the expansion of DECL_VALUE_EXPR for
	common block decls.
    
	gcc/testsuite/
	* gfortran.dg/goacc/common-block-1.f90: New test.
	* gfortran.dg/goacc/common-block-2.f90: New test.
	* gfortran.dg/goacc/common-block-3.f90: New test.
    
	libgomp/
	* testsuite/libgomp.oacc-fortran/common-block-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/common-block-2.f90: New test.
	* testsuite/libgomp.oacc-fortran/common-block-3.f90: New test.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

Co-Authored-By: Tobias Burnus <tobias@codesourcery.com>

From-SVN: r277451
2019-10-25 16:28:40 +02:00
Jakub Jelinek
77ef339456 re PR libgomp/92081 (FAIL: libgomp.fortran/target-simd.f90 execution test)
PR libgomp/92081
	* testsuite/libgomp.fortran/target-simd.f90: Iterate from 1 rather
	than 0.

From-SVN: r276956
2019-10-14 10:48:42 +02:00