aboutsummaryrefslogtreecommitdiff
path: root/libgomp
AgeCommit message (Collapse)AuthorFilesLines
2019-12-17libgomp/openacc.f90 – clean-up public/private attributesTobias Burnus4-10/+33
* 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-13Fix potential race condition in OpenACC "exit data" operationsJulian Brown4-20/+68
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-13Update OpenACC tests for amdgcnAndrew Stubbs8-2/+38
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-13libgomp/openacc.f90 – clean-up public/private attributesTobias Burnus2-9/+20
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-12re PR fortran/92899 ([OpenMP] ICE in gfc_trans_omp_atomic, at ↵Jakub Jelinek2-0/+51
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-11[PR92843] [OpenACC] Fix dynamic reference counting for structured ↵Thomas Schwinge6-21/+242
'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[OpenACC] Consolidate 'GOACC_enter_exit_data' and its helper functions in ↵Thomas Schwinge5-263/+281
'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[OpenACC] Consolidate 'async'/'wait' code in 'libgomp/oacc-async.c'Thomas Schwinge5-73/+81
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[PR92854] Add 'libgomp.oacc-c-c++-common/acc_map_data-device_already-*.c', ↵Thomas Schwinge7-0/+210
'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[OpenACC] Initialize 'dynamic_refcount' whenever we initialize 'refcount'Thomas Schwinge2-0/+9
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-11libgomp – spelling fixes, incl. omp_lib.h.inTobias Burnus16-36/+56
* 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[OpenMP/OpenACC/Fortran] Fix mapping of optional (present|absent) argumentsTobias Burnus3-2/+8
* 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-09[PR92116, PR92877] [OpenACC] Replace 'openacc.data_environ' by standard ↵Thomas Schwinge8-112/+64
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[PR92503] [OpenACC] Don't silently 'acc_unmap_data' in 'acc_free'Thomas Schwinge18-30/+242
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[PR92840] [OpenACC] Refuse 'acc_unmap_data' unless mapped by 'acc_map_data'Thomas Schwinge7-17/+126
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[PR92511] More testing for OpenACC "present" subarraysThomas Schwinge10-126/+670
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-09Add 'libgomp.oacc-c-c++-common/map-data-1.c'Thomas Schwinge2-0/+55
libgomp/ * testsuite/libgomp.oacc-c-c++-common/map-data-1.c: New file. From-SVN: r279121
2019-12-09[PR92854] Add 'libgomp.oacc-c-c++-common/pr92854-1.c'Thomas Schwinge2-0/+34
... 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-09Add 'libgomp.oacc-c-c++-common/host_data-6.c'Thomas Schwinge2-0/+49
libgomp/ * testsuite/libgomp.oacc-c-c++-common/host_data-6.c: New file. From-SVN: r279119
2019-12-09In 'libgomp/target.c:gomp_exit_data', remove open-coded 'gomp_remove_var'Thomas Schwinge2-10/+5
libgomp/ * target.c (gomp_exit_data): Use 'gomp_remove_var'. From-SVN: r279118
2019-12-09libgomp/testsuite/*fortran – make 'stop' values uniqueTobias Burnus8-338/+350
* 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-06Fix Fortran linker errors on AMD GCNKwok Cheung Yeung2-0/+6
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[OpenMP/OpenACC/Fortran] Fix mapping of optional (present|absent) argumentsTobias Burnus22-100/+1457
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-05OpenMP] Fix use_device_… with absent optional argTobias Burnus1-12/+39
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-05testsuite/libgomp.oacc-fortran: Update dg-output to fix GCNTobias Burnus4-9/+31
* 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-04re PR fortran/92756 (ICE in lower_omp, at omp-low.c:12988)Jakub Jelinek3-0/+165
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-03Validate acc_device_t usesFrederik Harwath2-8/+54
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-03Enable OpenACC GCN testing.Andrew Stubbs5-0/+66
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-03musl: Fix invalid tls model in libgomp and libitm PR91938Szabolcs Nagy2-0/+8
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-11-29Fortran] OpenACC – permit common blocks in some clausesTobias Burnus2-6/+89
* testsuite/libgomp.oacc-fortran/declare-5.f90: Extend by adding a common-block test case. From-SVN: r278845
2019-11-29re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)Jakub Jelinek2-108/+0
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-29re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)Jakub Jelinek3-0/+222
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-27Fix 'libgomp.fortran/target-print-1.f90', 'libgomp.oacc-fortran/print-1.f90' ↵Thomas Schwinge6-4/+61
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-21Fix failures on Solaris with -fno-common defaultRainer Orth7-27/+36
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-20AMD GCN libgomp plugin queue-full condition locking fixJulian Brown2-13/+20
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-20Fix host-to-device copies from rodata for AMD GCNJulian Brown2-4/+41
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-20OpenACC "present" subarrays: runtime API return value and unmapping fixesJulian Brown8-13/+87
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-20libgomp/test: Add flags to find libatomic in build-tree testingMaciej W. Rozycki2-0/+19
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-18libgomp: Regenerate `testsuite/Makefile.in' for GCC_HEADER_STDINT removalMaciej W. Rozycki2-1/+4
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-15Add tests for print from offload target.Andrew Stubbs5-0/+71
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-13GCN Libgomp PluginAndrew Stubbs7-10/+4156
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-13Optimize GCN OpenMP malloc performanceAndrew Stubbs5-12/+106
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-13GCN libgomp portAndrew Stubbs26-7/+1115
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-13Add device number to GOMP_OFFLOAD_openacc_async_constructAndrew Stubbs5-4/+16
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-13Move generic libgomp files from nvptx to accelAndrew Stubbs21-1/+43
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-12Add OpenACC 2.6 `serial' construct supportMaciej W. Rozycki4-0/+248
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-11Fortran] Support absent optional args with use_device_{ptr,addr}Tobias Burnus3-0/+61
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-11Torture testing: 'libgomp.fortran/target9.f90'Thomas Schwinge2-0/+3
libgomp/ * testsuite/libgomp.fortran/target9.f90: Specify 'dg-do run'. From-SVN: r278045
2019-11-11Torture testing: 'libgomp.fortran/use_device_addr-3.f90', ↵Thomas Schwinge4-0/+13
'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-06Warn about inconsistent OpenACC nested reduction clausesFrederik Harwath5-4/+15
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