Commit Graph

915 Commits

Author SHA1 Message Date
Feng Xue c29c92c789 PR tree-optimization/89713 - Assume loop with an exit is finite
gcc/ChangeLog:

        * doc/invoke.texi (-ffinite-loops): Document new option.
        * common.opt (-ffinite-loops): New option.
        * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Mark
        IFN_GOACC_LOOP calls as necessary.
        * tree-ssa-loop-niter.c (finite_loop_p): Assume loop with an exit
        is finite.
        * omp-offload.c (oacc_xform_loop): Skip lowering if return value of
        IFN_GOACC_LOOP call is not used.
        * opts.c (default_options_table): Enable -ffinite-loops at -O2+.

gcc/testsuite/ChangeLog:

        * g++.dg/tree-ssa/empty-loop.C: New test.
        * gcc.dg/tree-ssa/dce-2.c: New test.
        * gcc.dg/const-1.c: Add -fno-finite-loops option.
        * gcc.dg/graphite/graphite.exp: Likewise.
        * gcc.dg/loop-unswitch-1.c: Likewise.
        * gcc.dg/predict-9.c: Likewise.
        * gcc.dg/pure-2.c: Likewise.
        * gcc.dg/tree-ssa/20040211-1.c: Likewise.
        * gcc.dg/tree-ssa/loop-10.c: Likewise.
        * gcc.dg/tree-ssa/split-path-6.c: Likewise.
        * gcc.dg/tree-ssa/ssa-thread-12.c: Likewise.

libgomp/ChangeLog:

        * testsuite/libgomp.oacc-c-c++-common/pr84955-1.c: New test.

From-SVN: r272234
2019-06-13 04:17:42 +00:00
Jakub Jelinek ce9c4ec3c5 re PR target/90811 ([nvptx] ptxas error on OpenMP offloaded code)
PR target/90811
	* config/nvptx/nvptx.c (nvptx_output_softstack_switch): Use and.b%d
	instead of and.u%d.

	* testsuite/libgomp.c/pr90811.c: New test.

From-SVN: r272161
2019-06-11 18:40:10 +02:00
Jakub Jelinek 28b3a77ca0 omp-low.c (lower_rec_input_clauses): For lastprivate conditional references...
* omp-low.c (lower_rec_input_clauses): For lastprivate conditional
	references, lookup in in hash map MEM_REF operand instead of the
	MEM_REF itself.
	(lower_omp_1): When looking for lastprivate conditional assignments,
	handle MEM_REFs with REFERENCE_TYPE operands.

	* testsuite/libgomp.c++/lastprivate-conditional-1.C: New test.
	* testsuite/libgomp.c++/lastprivate-conditional-2.C: New test.

From-SVN: r271948
2019-06-05 09:37:40 +02:00
Jakub Jelinek 7855700e63 gimplify.c (gimplify_scan_omp_clauses): Don't sorry_at on lastprivate conditional on combined for simd.
* gimplify.c (gimplify_scan_omp_clauses): Don't sorry_at on lastprivate
	conditional on combined for simd.
	* omp-low.c (struct omp_context): Add combined_into_simd_safelen0
	member.
	(lower_rec_input_clauses): For gimple_omp_for_combined_into_p max_vf 1
	constructs, don't remove lastprivate_conditional_map, but instead set
	ctx->combined_into_simd_safelen0 and adjust hash_map, so that it points
	to parent construct temporaries.
	(lower_lastprivate_clauses): Handle ctx->combined_into_simd_safelen0
	like !ctx->lastprivate_conditional_map.
	(lower_omp_1) <case GIMPLE_ASSIGN>: If up->combined_into_simd_safelen0,
	use up->outer context instead of up.
	* omp-expand.c (expand_omp_for_generic): Perform cond_var bump even if
	gimple_omp_for_combined_p.
	(expand_omp_for_static_nochunk): Likewise.
	(expand_omp_for_static_chunk): Add forgotten cond_var bump that was
	probably moved over into expand_omp_for_generic rather than being copied
	there.
gcc/cp/
	* cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
	instead of only up to linear.
gcc/testsuite/
	* c-c++-common/gomp/lastprivate-conditional-2.c (foo): Don't expect
	a sorry_at on any of the clauses.
libgomp/
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c: New test.
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c: New test.
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-9.c: New test.
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-10.c: New test.

From-SVN: r271907
2019-06-04 14:49:03 +02:00
Rainer Orth a7155c2e0b Generalize getconf _NPROCESSORS_ONLN
libgomp:
	* configure.ac: Call AX_COUNT_CPUS.
	Substitute CPU_COUNT.
	* testsuite/Makefile.am (check-am): Use CPU_COUNT as processor
	count fallback.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* Makefile.in, testsuite/Makefile.in: Regenerate.

	config:
	* ax_count_cpus.m4: New file.

From-SVN: r271769
2019-05-30 09:06:48 +00:00
Jakub Jelinek 7e47198b80 gimplify.c (struct gimplify_omp_ctx): Add clauses member.
* gimplify.c (struct gimplify_omp_ctx): Add clauses member.
	(gimplify_scan_omp_clauses): Initialize ctx->clauses.
	(gimplify_adjust_omp_clauses_1): Transform lastprivate conditional
	explicit clause on combined parallel into implicit shared clause.
	(gimplify_adjust_omp_clauses): Move lastprivate conditional clause
	and firstprivate if the decl has one too from combined parallel to
	the worksharing construct.
gcc/testsuite/
	* c-c++-common/gomp/lastprivate-conditional-2.c (foo): Don't expect
	sorry on lastprivate conditional on parallel for.
	* c-c++-common/gomp/lastprivate-conditional-3.c (foo): Add tests for
	lastprivate conditional warnings on parallel for constructs.
	* c-c++-common/gomp/lastprivate-conditional-4.c: New test.
libgomp/
	* testsuite/libgomp.c-c++-common/lastprivate_conditional_4.c: Rename
	to ...
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-4.c: ... this.
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-5.c: New test.
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-6.c: New test.

From-SVN: r271733
2019-05-29 09:51:43 +02:00
Jakub Jelinek 8e7757ba17 gimplify.c (gimplify_scan_omp_clauses): Allow lastprivate conditional on sections construct.
* gimplify.c (gimplify_scan_omp_clauses): Allow lastprivate conditional
	on sections construct.
	* omp-low.c (lower_lastprivate_conditional_clauses): Handle sections
	construct.
	(lower_omp_sections): Handle lastprivate conditional.
	(lower_omp_1) <case GIMPLE_ASSIGN>: Handle sections construct with
	lastprivate_conditional_map.
	* omp-expand.c (expand_omp_sections): Handle lastprivate conditional.
libgomp/
	* testsuite/libgomp.c-c++-common/lastprivate_conditional_4.c: New test.

From-SVN: r271673
2019-05-27 23:33:37 +02:00
Jakub Jelinek 36c7a3fff9 omp-low.c (lower_omp_1): Look through ordered...
* omp-low.c (lower_omp_1) <case GIMPLE_ASSIGN>: Look through ordered,
	critical, taskgroup and section regions when looking for a region
	with non-NULL lastprivate_conditional_map.

	* testsuite/libgomp.c-c++-common/lastprivate-conditional-3.c: New test.

From-SVN: r271672
2019-05-27 23:31:40 +02:00
Jakub Jelinek fcfb80325f re PR libgomp/90641 (libgomp.c-c++-common/lastprivate-conditional-1.c etc FAIL)
PR libgomp/90641
	* work.c (gomp_init_work_share): Instead of aligning final ordered
	value to multiples of long long alignment, align to that the
	first part (ordered team ids) and if inline_ordered_team_ids
	is not on a long long alignment boundary within the structure,
	use __alignof__ (long long) - 1 pad size always.
	* loop.c (GOMP_loop_start): Fix *mem computation if
	inline_ordered_team_ids is not aligned on long long alignment boundary
	within the structure.
	* loop-ull.c (GOMP_loop_ull_start): Likewise.
	* sections.c (GOMP_sections2_start): Likewise.

From-SVN: r271671
2019-05-27 23:27:00 +02:00
Jakub Jelinek 6c7ae8c56f tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CONDTEMP_.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CONDTEMP_.
	* tree.h (OMP_CLAUSE_DECL): Use OMP_CLAUSE__CONDTEMP_ instead of
	OMP_CLAUSE__REDUCTEMP_.
	* tree.c (omp_clause_num_ops, omp_clause_code_name): Add
	OMP_CLAUSE__CONDTEMP_.
	(walk_tree_1): Handle OMP_CLAUSE__CONDTEMP_.
	* tree-pretty-print.c (dump_omp_clause): Likewise.
	* tree-nested.c (convert_nonlocal_omp_clauses,
	convert_local_omp_clauses): Likewise.
	* gimplify.c (enum gimplify_omp_var_data): Use hexadecimal constants
	instead of decimal.  Add GOVD_LASTPRIVATE_CONDITIONAL.
	(gimplify_scan_omp_clauses): Don't reject lastprivate conditional
	on OMP_FOR.
	(gimplify_omp_for): Warn and disable conditional modifier from
	lastprivate on loop iterators.
	* omp-general.h (struct omp_for_data): Add lastprivate_conditional
	member.
	* omp-general.c (omp_extract_for_data): Initialize it.
	* omp-low.c (struct omp_context): Add lastprivate_conditional_map
	member.
	(delete_omp_context): Delete it.
	(lower_lastprivate_conditional_clauses): New function.
	(lower_lastprivate_clauses): Add BODY_P and CSTMT_LIST arguments,
	handle lastprivate conditional clauses.
	(lower_reduction_clauses): Add CLIST argument, emit it into
	the critical section if any.
	(lower_omp_sections): Adjust lower_lastprivate_clauses and
	lower_reduction_clauses callers.
	(lower_omp_for_lastprivate): Add CLIST argument, pass it through
	to lower_lastprivate_clauses.
	(lower_omp_for): Call lower_lastprivate_conditional_clauses, adjust
	lower_omp_for_lastprivate and lower_reduction_clauses callers, emit
	clist into a critical section if not emitted there already by
	lower_reduction_clauses.
	(lower_omp_taskreg, lower_omp_teams): Adjust lower_reduction_clauses
	callers.
	(lower_omp_1): Handle GIMPLE_ASSIGNs storing into lastprivate
	conditional variables.
	* omp-expand.c (determine_parallel_type): Punt if OMP_CLAUSE__CONDTEMP_
	clause is present.
	(expand_omp_for_generic, expand_omp_for_static_nochunk,
	expand_omp_for_static_chunk): Handle lastprivate conditional.
	(expand_omp_for): Handle fd.lastprivate_conditional like
	fd.have_reductemp.
gcc/testsuite/
	* c-c++-common/gomp/lastprivate-conditional-2.c (foo): Don't expect
	sorry for omp for.
	* c-c++-common/gomp/lastprivate-conditional-3.c: New test.
libgomp/
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-1.c: New test.
	* testsuite/libgomp.c-c++-common/lastprivate-conditional-2.c: New test.

From-SVN: r271610
2019-05-24 23:31:59 +02:00
Jakub Jelinek b5c26449f3 re PR libgomp/90585 (libgomp hsa plugin ftbfs in the x32 multilib variant)
PR libgomp/90585
	* plugin/plugin-hsa.c: Include gstdint.h.  Include inttypes.h only if
	HAVE_INTTYPES_H is defined.
	(print_uint64_t): New typedef.
	(PRIu64): Define if HAVE_INTTYPES_H is not defined.
	(print_kernel_dispatch, run_kernel): Use PRIu64 macro instead of
	"lu", cast uint64_t HSA_DEBUG and fprintf arguments to print_uint64_t.
	(release_kernel_dispatch): Likewise.  Cast shadow->debug to uintptr_t
	before casting to void *.
	* plugin/plugin-nvptx.c: Include gstdint.h instead of stdint.h.
	* oacc-mem.c: Don't include config.h nor stdint.h.
	* target.c: Don't include config.h.
	* oacc-cuda.c: Likewise.
	* oacc-host.c: Don't include stdint.h.

From-SVN: r271597
2019-05-24 10:59:37 +02:00
Jakub Jelinek 3e03ed6626 re PR libgomp/90527 (alloc.c:72:7: error: implicit declaration of function ‘posix_memalign’)
PR libgomp/90527
	* alloc.c (_GNU_SOURCE): Define.

From-SVN: r271438
2019-05-20 23:29:17 +02:00
Thomas Schwinge 5fae049dc2 OpenACC Profiling Interface (incomplete)
libgomp/
	* acc_prof.h: New file.
	* oacc-profiling.c: Likewise.
	* Makefile.am (nodist_libsubinclude_HEADERS, libgomp_la_SOURCES):
	Add these, respectively.
	* Makefile.in: Regenerate.
	* env.c (initialize_env): Call goacc_profiling_initialize.
	* oacc-plugin.c (GOMP_PLUGIN_goacc_thread)
	(GOMP_PLUGIN_goacc_profiling_dispatch): New functions.
	* oacc-plugin.h (GOMP_PLUGIN_goacc_thread)
	(GOMP_PLUGIN_goacc_profiling_dispatch): Declare.
	* libgomp.map (OACC_2.5.1): Add acc_prof_lookup,
	acc_prof_register, acc_prof_unregister, and acc_register_library.
	(GOMP_PLUGIN_1.3): Add GOMP_PLUGIN_goacc_profiling_dispatch, and
	GOMP_PLUGIN_goacc_thread.
	* oacc-int.h (struct goacc_thread): Add prof_info, api_info,
	prof_callbacks_enabled members.
	(goacc_prof_enabled, goacc_profiling_initialize)
	(_goacc_profiling_dispatch_p, _goacc_profiling_setup_p)
	(goacc_profiling_dispatch): Declare.
	(GOACC_PROF_ENABLED, GOACC_PROFILING_DISPATCH_P)
	(GOACC_PROFILING_SETUP_P): Define.
	* oacc-async.c (acc_async_test, acc_async_test_all, acc_wait)
	(acc_wait_async, acc_wait_all, acc_wait_all_async): Update for
	OpenACC Profiling Interface.
	* oacc-cuda.c (acc_get_current_cuda_device)
	(acc_get_current_cuda_context, acc_get_cuda_stream)
	(acc_set_cuda_stream): Likewise.
	* oacc-init.c (acc_init_1, goacc_attach_host_thread_to_device)
	(acc_init, acc_set_device_type, acc_get_device_type)
	(acc_get_device_num, goacc_lazy_initialize): Likewise.
	* oacc-mem.c (acc_malloc, acc_free, memcpy_tofrom_device)
	(acc_deviceptr, acc_hostptr, acc_is_present, acc_map_data)
	(acc_unmap_data, present_create_copy, delete_copyout)
	(update_dev_host): Likewise.
	* oacc-parallel.c (GOACC_parallel_keyed, GOACC_data_start)
	(GOACC_data_end, GOACC_enter_exit_data, GOACC_update, GOACC_wait):
	Likewise.
	* plugin/plugin-nvptx.c (nvptx_exec, nvptx_alloc, nvptx_free)
	(GOMP_OFFLOAD_openacc_exec, GOMP_OFFLOAD_openacc_async_exec):
	Likewise.
	* libgomp.texi: Update.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-dispatch-1.c: New
	file.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-1.c: Likewise.
	* 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/acc_prof-valid_bytes-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-version-1.c:
	Likewise.

From-SVN: r271346
2019-05-17 21:13:36 +02:00
Chung-Lin Tang 1f4c5b9bb2 2019-05-13 Chung-Lin Tang <cltang@codesourcery.com>
Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

	libgomp/
	* libgomp-plugin.h (struct goacc_asyncqueue): Declare.
	(struct goacc_asyncqueue_list): Likewise.
	(goacc_aq): Likewise.
	(goacc_aq_list): Likewise.
	(GOMP_OFFLOAD_openacc_register_async_cleanup): Remove.
	(GOMP_OFFLOAD_openacc_async_test): Remove.
	(GOMP_OFFLOAD_openacc_async_test_all): Remove.
	(GOMP_OFFLOAD_openacc_async_wait): Remove.
	(GOMP_OFFLOAD_openacc_async_wait_async): Remove.
	(GOMP_OFFLOAD_openacc_async_wait_all): Remove.
	(GOMP_OFFLOAD_openacc_async_wait_all_async): Remove.
	(GOMP_OFFLOAD_openacc_async_set_async): Remove.
	(GOMP_OFFLOAD_openacc_exec): Adjust declaration.
	(GOMP_OFFLOAD_openacc_cuda_get_stream): Likewise.
	(GOMP_OFFLOAD_openacc_cuda_set_stream): Likewise.
	(GOMP_OFFLOAD_openacc_async_exec): Declare.
	(GOMP_OFFLOAD_openacc_async_construct): Declare.
	(GOMP_OFFLOAD_openacc_async_destruct): Declare.
	(GOMP_OFFLOAD_openacc_async_test): Declare.
	(GOMP_OFFLOAD_openacc_async_synchronize): Declare.
	(GOMP_OFFLOAD_openacc_async_serialize): Declare.
	(GOMP_OFFLOAD_openacc_async_queue_callback): Declare.
	(GOMP_OFFLOAD_openacc_async_host2dev): Declare.
	(GOMP_OFFLOAD_openacc_async_dev2host): Declare.

	* libgomp.h (struct acc_dispatch_t): Define 'async' sub-struct.
	(gomp_acc_insert_pointer): Adjust declaration.
	(gomp_copy_host2dev): New declaration.
	(gomp_copy_dev2host): Likewise.
	(gomp_map_vars_async): Likewise.
	(gomp_unmap_tgt): Likewise.
	(gomp_unmap_vars_async): Likewise.
	(gomp_fini_device): Likewise.

	* oacc-async.c (get_goacc_thread): New function.
	(get_goacc_thread_device): New function.
	(lookup_goacc_asyncqueue): New function.
	(get_goacc_asyncqueue): New function.
	(acc_async_test): Adjust code to use new async design.
	(acc_async_test_all): Likewise.
	(acc_wait): Likewise.
	(acc_wait_async): Likewise.
	(acc_wait_all): Likewise.
	(acc_wait_all_async): Likewise.
	(goacc_async_free): New function.
	(goacc_init_asyncqueues): Likewise.
	(goacc_fini_asyncqueues): Likewise.
	* oacc-cuda.c (acc_get_cuda_stream): Adjust code to use new async
	design.
	(acc_set_cuda_stream): Likewise.
	* oacc-host.c (host_openacc_exec): Adjust parameters, remove 'async'.
	(host_openacc_register_async_cleanup): Remove.
	(host_openacc_async_exec): New function.
	(host_openacc_async_test): Adjust parameters.
	(host_openacc_async_test_all): Remove.
	(host_openacc_async_wait): Remove.
	(host_openacc_async_wait_async): Remove.
	(host_openacc_async_wait_all): Remove.
	(host_openacc_async_wait_all_async): Remove.
	(host_openacc_async_set_async): Remove.
	(host_openacc_async_synchronize): New function.
	(host_openacc_async_serialize): New function.
	(host_openacc_async_host2dev): New function.
	(host_openacc_async_dev2host): New function.
	(host_openacc_async_queue_callback): New function.
	(host_openacc_async_construct): New function.
	(host_openacc_async_destruct): New function.
	(struct gomp_device_descr host_dispatch): Remove initialization of old
	interface, add intialization of new async sub-struct.
	* oacc-init.c (acc_shutdown_1): Adjust to use gomp_fini_device.
	(goacc_attach_host_thread_to_device): Remove old async code usage.
	* oacc-int.h (goacc_init_asyncqueues): New declaration.
	(goacc_fini_asyncqueues): Likewise.
	(goacc_async_copyout_unmap_vars): Likewise.
	(goacc_async_free): Likewise.
	(get_goacc_asyncqueue): Likewise.
	(lookup_goacc_asyncqueue): Likewise.

	* oacc-mem.c (memcpy_tofrom_device): Adjust code to use new async
	design.
	(present_create_copy): Adjust code to use new async design.
	(delete_copyout): Likewise.
	(update_dev_host): Likewise.
	(gomp_acc_insert_pointer): Add async parameter, adjust code to use new
	async design.
	(gomp_acc_remove_pointer): Adjust code to use new async design.
	* oacc-parallel.c (GOACC_parallel_keyed): Adjust code to use new async
	design.
	(GOACC_enter_exit_data): Likewise.
	(goacc_wait): Likewise.
	(GOACC_update): Likewise.
	* oacc-plugin.c (GOMP_PLUGIN_async_unmap_vars): Change to assert fail
	when called, warn as obsolete in comment.

	* target.c (goacc_device_copy_async): New function.
	(gomp_copy_host2dev): Remove 'static', add goacc_asyncqueue parameter,
	add goacc_device_copy_async case.
	(gomp_copy_dev2host): Likewise.
	(gomp_map_vars_existing): Add goacc_asyncqueue parameter, adjust code.
	(gomp_map_pointer): Likewise.
	(gomp_map_fields_existing): Likewise.
	(gomp_map_vars_internal): New always_inline function, renamed from
	gomp_map_vars.
	(gomp_map_vars): Implement by calling gomp_map_vars_internal.
	(gomp_map_vars_async): Implement by calling gomp_map_vars_internal,
	passing goacc_asyncqueue argument.
	(gomp_unmap_tgt): Remove static, add attribute_hidden.
	(gomp_unref_tgt): New function.
	(gomp_unmap_vars_internal): New always_inline function, renamed from
	gomp_unmap_vars.
	(gomp_unmap_vars): Implement by calling gomp_unmap_vars_internal.
	(gomp_unmap_vars_async): Implement by calling
	gomp_unmap_vars_internal, passing goacc_asyncqueue argument.
	(gomp_fini_device): New function.
	(gomp_exit_data): Adjust gomp_copy_dev2host call.
	(gomp_load_plugin_for_device): Remove old interface, adjust to load
	new async interface.
	(gomp_target_fini): Adjust code to call gomp_fini_device.

	* plugin/plugin-nvptx.c (struct cuda_map): Remove.
	(struct ptx_stream): Remove.
	(struct nvptx_thread): Remove current_stream field.
	(cuda_map_create): Remove.
	(cuda_map_destroy): Remove.
	(map_init): Remove.
	(map_fini): Remove.
	(map_pop): Remove.
	(map_push): Remove.
	(struct goacc_asyncqueue): Define.
	(struct nvptx_callback): Define.
	(struct ptx_free_block): Define.
	(struct ptx_device): Remove null_stream, active_streams, async_streams,
	stream_lock, and next fields.
	(enum ptx_event_type): Remove.
	(struct ptx_event): Remove.
	(ptx_event_lock): Remove.
	(ptx_events): Remove.
	(init_streams_for_device): Remove.
	(fini_streams_for_device): Remove.
	(select_stream_for_async): Remove.
	(nvptx_init): Remove ptx_events and ptx_event_lock references.
	(nvptx_attach_host_thread_to_device): Remove CUDA_ERROR_NOT_PERMITTED
	case.
	(nvptx_open_device): Add free_blocks initialization, remove
	init_streams_for_device call.
	(nvptx_close_device): Remove fini_streams_for_device call, add
	free_blocks destruct code.
	(event_gc): Remove.
	(event_add): Remove.
	(nvptx_exec): Adjust parameters and code.
	(nvptx_free): Likewise.
	(nvptx_host2dev): Remove.
	(nvptx_dev2host): Remove.
	(nvptx_set_async): Remove.
	(nvptx_async_test): Remove.
	(nvptx_async_test_all): Remove.
	(nvptx_wait): Remove.
	(nvptx_wait_async): Remove.
	(nvptx_wait_all): Remove.
	(nvptx_wait_all_async): Remove.
	(nvptx_get_cuda_stream): Remove.
	(nvptx_set_cuda_stream): Remove.
	(GOMP_OFFLOAD_alloc): Adjust code.
	(GOMP_OFFLOAD_free): Likewise.
	(GOMP_OFFLOAD_openacc_register_async_cleanup): Remove.
	(GOMP_OFFLOAD_openacc_exec): Adjust parameters and code.
	(GOMP_OFFLOAD_openacc_async_test_all): Remove.
	(GOMP_OFFLOAD_openacc_async_wait): Remove.
	(GOMP_OFFLOAD_openacc_async_wait_async): Remove.
	(GOMP_OFFLOAD_openacc_async_wait_all): Remove.
	(GOMP_OFFLOAD_openacc_async_wait_all_async): Remove.
	(GOMP_OFFLOAD_openacc_async_set_async): Remove.
	(cuda_free_argmem): New function.
	(GOMP_OFFLOAD_openacc_async_exec): New plugin hook function.
	(GOMP_OFFLOAD_openacc_create_thread_data): Adjust code.
	(GOMP_OFFLOAD_openacc_cuda_get_stream): Adjust code.
	(GOMP_OFFLOAD_openacc_cuda_set_stream): Adjust code.
	(GOMP_OFFLOAD_openacc_async_construct): New plugin hook function.
	(GOMP_OFFLOAD_openacc_async_destruct): New plugin hook function.
	(GOMP_OFFLOAD_openacc_async_test): Remove and re-implement.
	(GOMP_OFFLOAD_openacc_async_synchronize): New plugin hook function.
	(GOMP_OFFLOAD_openacc_async_serialize): New plugin hook function.
	(GOMP_OFFLOAD_openacc_async_queue_callback): New plugin hook function.
	(cuda_callback_wrapper): New function.
	(cuda_memcpy_sanity_check): New function.
	(GOMP_OFFLOAD_host2dev): Remove and re-implement.
	(GOMP_OFFLOAD_dev2host): Remove and re-implement.
	(GOMP_OFFLOAD_openacc_async_host2dev): New plugin hook function.
	(GOMP_OFFLOAD_openacc_async_dev2host): New plugin hook function.

From-SVN: r271128
2019-05-13 13:32:00 +00:00
Thomas Schwinge da2d30c199 Address compiler diagnostics in libgomp.oacc-c-c++-common/pr87835.c
source-gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/pr87835.c: In function 'main':
    source-gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/pr87835.c:45: warning: ignoring #pragma loop gang [-Wunknown-pragmas]
       45 |     #pragma loop gang
          |
    source-gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/pr87835.c:19:7: warning: unused variable 'b' [-Wunused-variable]
       19 |   int b[n];
          |       ^

	libgomp/
	PR target/87835
	* testsuite/libgomp.oacc-c-c++-common/pr87835.c: Update.

From-SVN: r271004
2019-05-08 12:01:30 +02:00
Thomas Schwinge 2bbbfa4e28 Clean up libgomp GCC 5 legacy support
libgomp/
	* oacc-parallel.c: Add comments to legacy entry points (GCC 5).

From-SVN: r270901
2019-05-06 10:49:55 +02:00
Kevin Buettner bbf1efe1b4 team.c (gomp_team_start): Initialize pool->threads[0].
libgomp/ChangeLog:

	* team.c (gomp_team_start): Initialize pool->threads[0].

From-SVN: r269971
2019-03-27 18:30:44 +00:00
Thomas Schwinge b03d721a62 [libgomp] In OpenACC testing, by default only build for the offload target that we're actually going to test
... to avoid compilation overhead, and to keep simple '-foffload=[...]'
handling in test cases.

	libgomp/
	* testsuite/libgomp.oacc-c++/c++.exp: Specify
	"-foffload=$offload_target".
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* testsuite/lib/libgomp.exp
	(check_effective_target_openacc_nvidia_accel_configured): Remove,
	as (conceptually) merged into
	check_effective_target_openacc_nvidia_accel_selected.  Adjust all
	users.

From-SVN: r269109
2019-02-22 11:51:35 +01:00
Thomas Schwinge 0a0384b43a [libgomp] In OpenACC testing, cycle though all offload targets
... instead of through offload plugins.

	libgomp/
	* plugin/configfrag.ac: Populate and AC_SUBST offload_targets.
	* testsuite/libgomp-test-support.exp.in: Adjust.
	* testsuite/lib/libgomp.exp: Likewise.  Don't populate
	openacc_device_types_s.
	(offload_target_to_openacc_device_type): New proc.
	* testsuite/libgomp.oacc-c++/c++.exp: Adjust.
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r269108
2019-02-22 11:51:20 +01:00
Thomas Schwinge ee332b4a9a [libgomp] Clarify difference between offload target, offload plugin, and OpenACC device type
libgomp/
	* plugin/configfrag.ac: Populate and AC_SUBST offload_plugins
	instead of offload_targets, and AC_DEFINE_UNQUOTED OFFLOAD_PLUGINS
	instead of OFFLOAD_TARGETS.
	* target.c (gomp_target_init): Adjust.
	* testsuite/libgomp-test-support.exp.in: Likewise.
	* testsuite/lib/libgomp.exp: Likewise.  Populate
	openacc_device_types_s instead of offload_targets_s_openacc.
	(check_effective_target_openacc_nvidia_accel_selected)
	(check_effective_target_openacc_host_selected): Adjust.
	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* Makefile.in: Regenerate.
	* config.h.in: Likewise.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r269107
2019-02-22 11:51:05 +01:00
Thomas Schwinge 1241136c71 [libgomp] In OpenACC offloading testing, be more explicit in what is supported, and what is not, or why not
libgomp/
	* testsuite/lib/libgomp.exp: Error out for unknown offload target.
	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.  Report if
	"offloading: supported, but hardware not accessible".
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

From-SVN: r269106
2019-02-22 11:50:49 +01:00
Chung-Lin Tang 19695f4d99 re PR c/87924 (OpenACC wait clauses without async-arguments)
2019-02-19  Chung-Lin Tang <cltang@codesourcery.com>

	PR c/87924
	gcc/c/
	* c-parser.c (c_parser_oacc_clause_wait): Add representation of wait
	clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.

	gcc/cp/
	* parser.c (cp_parser_oacc_clause_wait): Add representation of wait
	clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.

	gcc/fortran/
	* openmp.c (gfc_match_omp_clauses): Add representation of wait clause
	without argument as 'wait (GOMP_ASYNC_NOVAL)'.

	libgomp/
	* oacc-parallel.c (GOACC_parallel_keyed): Remove condition on call to
	goacc_wait().
	(goacc_wait): Handle ACC_ASYNC_NOVAL case, remove goacc_thread() call
	and related adjustment.

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

From-SVN: r269016
2019-02-19 14:10:15 +00:00
Jakub Jelinek 8b44f8ec4b re PR c++/88988 (ICE: Segmentation fault (in lookup_name_real_1))
PR c++/88988
	* lambda.c (is_capture_proxy): Don't return true for
	DECL_OMP_PRIVATIZED_MEMBER artificial vars.

	* testsuite/libgomp.c++/pr88988.C: New test.

From-SVN: r268407
2019-01-31 00:28:53 +01:00
Jakub Jelinek 52bfbb69e7 re PR middle-end/89002 (ICE in scan_omp_1_op, at omp-low.c:3166)
PR middle-end/89002
	* gimplify.c (gimplify_omp_for): When adding OMP_CLAUSE_*_GIMPLE_SEQ
	for lastprivate/linear IV, push gimplify context around gimplify_assign
	and, if it needed any temporaries, pop it into a gimple bind around the
	sequence.

	* testsuite/libgomp.c/pr89002.c: New test.

From-SVN: r268346
2019-01-28 23:34:32 +01:00
Jakub Jelinek be3a87e7b5 re PR middle-end/89002 (ICE in scan_omp_1_op, at omp-low.c:3166)
PR middle-end/89002
	* gimplify.c (gimplify_omp_for): When adding OMP_CLAUSE_*_GIMPLE_SEQ
	for lastprivate/linear IV, push gimplify context around gimplify_assign
	and, if it needed any temporaries, pop it into a gimple bind around the
	sequence.

	* testsuite/libgomp.c/pr89002.c: New test.

From-SVN: r268345
2019-01-28 23:33:33 +01:00
Richard Biener 497ef4d7f5 re PR testsuite/89064 (libgomp.graphite/force-parallel-5.c fails starting with r268257)
2019-01-28  Richard Biener  <rguenther@suse.de>

	PR testsuite/89064
	PR tree-optimization/86865
	* testsuite/libgomp.graphite/force-parallel-5.c: XFAIL.

From-SVN: r268333
2019-01-28 09:07:30 +00:00
Tom de Vries 738c56d410 [nvptx, libgomp] Fix memleak in GOMP_OFFLOAD_fini_device
I wrote a test-case:
...
int
main (void)
{
  for (unsigned i = 0; i < 128; ++i)
    {
      acc_init (acc_device_nvidia);
      acc_shutdown (acc_device_nvidia);
    }

  return 0;
}
...
and ran it under valgrind.  The only leak location reported with a frequency
of 128, was the allocation of ptx_devices in nvptx_init.

Fix this by freeing ptx_devices in GOMP_OFFLOAD_fini_device, once
instantiated_devices drops to 0.

2019-01-24  Tom de Vries  <tdevries@suse.de>

	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_fini_device): Free ptx_devices
	once instantiated_devices drops to 0.

From-SVN: r268237
2019-01-24 14:12:19 +00:00
Tom de Vries 4a75460b00 [nvptx, libgomp] Fix cuMemAlloc with size zero
Consider test-case:
...
int
main (void)
{
  #pragma acc parallel async
  ;
  #pragma acc parallel async
  ;
  #pragma acc wait

  return 0;
}
...

This fails with:
...
libgomp: cuMemAlloc error: invalid argument
Segmentation fault (core dumped)
...
The cuMemAlloc error is due to the fact that we're try to allocate 0 bytes.

Fix this by preventing calling map_push with size zero argument in nvptx_exec.

This also has the consequence that for the abort-1.c test-case, we end up
calling cuMemFree during map_fini for the struct cuda_map allocated in
map_init, which fails because an abort happened.  Fix this by calling
cuMemFree with CUDA_CALL_NOCHECK in cuda_map_destroy.

2019-01-23  Tom de Vries  <tdevries@suse.de>

	PR target/PR88946
	* plugin/plugin-nvptx.c (cuda_map_destroy): Use CUDA_CALL_NOCHECK for
	cuMemFree.
	(nvptx_exec): Don't call map_push if mapnum == 0.
	* testsuite/libgomp.oacc-c-c++-common/pr88946.c: New test.

From-SVN: r268178
2019-01-23 08:16:56 +00:00
Tom de Vries 4fef8e4d8c [nvptx, libgomp] Fix assert (!s->map->active) in map_fini
There are currently two situations where this assert triggers:
...
libgomp/plugin/plugin-nvptx.c: map_fini: Assertion `!s->map->active' failed.
...

First, in abort-1.c, a parallel region triggering an abort:
...
int
main (void)
{
  #pragma acc parallel
  abort ();

  return 0;
}
...

The abort is detected in nvptx_exec as the CUDA_ERROR_ILLEGAL_INSTRUCTION
return status of the cuStreamSynchronize call after kernel launch, which is
then handled by calling non-returning function GOMP_PLUGIN_fatal.
Consequently, the map_pop in nvptx_exec that in case of cuStreamSynchronize
success would remove or inactive the element added by the map_push earlier in
nvptx_exec, does not trigger.  With the element no longer active, but still
marked active and a member of s->map,  we run into the assert during
GOMP_OFFLOAD_fini_device, which is triggered from atexit handler
gomp_target_fini (which is triggered by the GOMP_PLUGIN_fatal mentioned above
calling exit).

Second, in pr88941.c, an async parallel region without wait:
...
int
main (void)
{
  #pragma acc parallel async
  ;

  /* no #pragma acc wait */
  return 0;
}
...

Because nvptx_exec is handling an async region, it does not call map_pop for
the element added by map_push, but schedules an kernel execution completion
event to call map_pop.  Again, we run into the assert during
GOMP_OFFLOAD_fini_device, which is triggered from atexit handler
gomp_target_fini, but the exit in this case is triggered by returning from main.
So either the kernel is still running, or the kernel has completed but the
corresponding event that is supposed to call map_pop is stuck in the event
queue, waiting for an event_gc.

Fix this by removing the assert, and skipping the freeing of device memory if
the map is still marked active (though in the async case, this is more a
workaround than an fix).

2019-01-23  Tom de Vries  <tdevries@suse.de>

	PR target/88941
	PR target/88939
	* plugin/plugin-nvptx.c (cuda_map_destroy): Handle map->active case.
	(map_fini): Remove "assert (!s->map->active)".
	* testsuite/libgomp.oacc-c-c++-common/pr88941.c: New test.

From-SVN: r268177
2019-01-23 08:16:42 +00:00
Tom de Vries 2ee6cb22c1 [nvptx, libgomp] Fix map_push
The map field of a struct ptx_stream is a FIFO.  The FIFO is implemented as a
single linked list, with pop-from-the-front semantics.

The function map_pop pops an element, either by:
- deallocating the element, if there is more than one element
- or marking the element inactive, if there's only one element

The responsibility of map_push is to push an element to the back, as well as
selecting the element to push, by:
- allocating an element, or
- reusing the element at the front if inactive and big enough, or
- dropping the element at the front if inactive and not big enough, and
  allocating one that's big enough

The current implemention gets at least the first and most basic scenario wrong:

> map = cuda_map_create (size);

We create an element, and assign it to map.

> for (t = s->map; t->next != NULL; t = t->next)
>   ;

We determine the last element in the fifo.

> t->next = map;

We append the new element.

> s->map = map;

But here, we throw away the rest of the FIFO, and declare the FIFO to be just
the new element.

This problem causes the test-case asyncwait-1.c to fail intermittently on some
systems.  The pr87835.c test-case added here is a a minimized and modified
version of asyncwait-1.c (avoiding the kernel construct) that is more likely to
fail.

Fix this by rewriting map_pop more robustly, by:
- seperating the function in two phases: select element, push element
- when reusing or dropping an element, making sure that the element is cleanly
  popped from the queue
- rewriting the push element part in such a way that it can handle all cases
  without needing if statements, such that each line is exercised for each of
  the three cases.

2019-01-23  Tom de Vries  <tdevries@suse.de>

	PR target/87835
	* plugin/plugin-nvptx.c (map_push): Fix adding of allocated element.
	* testsuite/libgomp.oacc-c-c++-common/pr87835.c: New test.

From-SVN: r268176
2019-01-23 08:16:11 +00:00
Tom de Vries d41d952c9b [nvptx] Handle assignment to gang-level reduction variable
2019-01-15  Tom de Vries  <tdevries@suse.de>

	PR target/80547
	* config/nvptx/nvptx.c (nvptx_goacc_reduction_init): Handle
	lhs == NULL_TREE for gang-level reduction.

	* testsuite/libgomp.oacc-c-c++-common/gang-reduction-var-assignment.c:
	New test.

From-SVN: r267934
2019-01-15 10:11:16 +00:00
Tom de Vries efb56ae82b [nvptx] Enable setting vector length using -fopenacc-dim -- testcases
Add some test-cases that set vector length using -fopenacc-dim.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/pr85486-2.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-2.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-5.c: New test.
	* testsuite/libgomp.oacc-fortran/gemm-2.f90: New test.

From-SVN: r267897
2019-01-12 22:19:31 +00:00
Tom de Vries 2c2ff1684d [nvptx] Enable setting vector length using -fopenacc-dim
Enable setting vector length using -fopenacc-dim, f.i. -fopenacc-dim=::128.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Alow setting
	vector length using -fopenacc-dim.

	* plugin/plugin-nvptx.c (nvptx_exec): Update error message.

From-SVN: r267896
2019-01-12 22:19:15 +00:00
Tom de Vries a105775825 [nvptx] Add vector_length 64 test-cases
Add some test-cases using vector_length 64.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/vector-length-64-1.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/vector-length-64-2.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/vector-length-64-3.c: New test.

From-SVN: r267895
2019-01-12 22:19:02 +00:00
Tom de Vries 56314b772f [nvptx] Force vl32 if calling vector-partitionable routines -- test-cases
Add test-cases for "[nvptx] Force vl32 if calling vector-partitionable
routines".

2019-01-12  Tom de Vries  <tdevries@suse.de>

	PR target/85486
	* testsuite/libgomp.oacc-c-c++-common/pr85486-3.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/pr85486.c: New test.

From-SVN: r267894
2019-01-12 22:18:50 +00:00
Tom de Vries b39e4366a2 [nvptx] Don't emit barriers for empty loops -- test-cases
Add test-cases for PR85381.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	PR target/85381
	* testsuite/libgomp.oacc-c-c++-common/pr85381-5.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/pr85381.c: New test.

From-SVN: r267893
2019-01-12 22:18:39 +00:00
Tom de Vries 2cb7a501ab [nvptx] Enable large vectors -- reduction testcases
Add various reduction test-cases with vector length 128.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: New test.
	* testsuite/libgomp.oacc-fortran/gemm.f90: New test.
	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-10.c: New test.

From-SVN: r267892
2019-01-12 22:18:27 +00:00
Tom de Vries 8e77f71eda [nvptx] Enable large vectors -- test-cases
Add various test-cases with vector length 128.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-7.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-4.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-6.c: New test.

From-SVN: r267891
2019-01-12 22:18:11 +00:00
Tom de Vries 52d22ece49 [nvptx] Update insufficient launch message for variable vector_length
Update message in nvptx libgomp plugin about insufficient resources to launch
kernel, to accommodate for the fact the vector_length can now be variable.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* plugin/plugin-nvptx.c (nvptx_exec): Update insufficient hardware
	resources diagnostic.

From-SVN: r267890
2019-01-12 22:18:00 +00:00
Tom de Vries 2b9d9e3937 [nvptx] Enable large vectors
Allow vector_length clauses to accept values larger than warp size.  Note that
this does not enable setting vector_length to values larger than warp size using
-fopenacc-dim.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Take larger vector
	lengths into account.

	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-1.c: Expect
	vector length to be 128.
	* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Expect vector
	length 2097152 to be reduced to 1024 instead of 32.

From-SVN: r267889
2019-01-12 22:17:42 +00:00
Thomas Schwinge 4102bda64c Better distinguish OpenACC and OpenMP sections in libgomp.texi
2019-01-11  Thomas Schwinge  <thomas@codesourcery.com>
            James Norris  <jnorris@codesourcery.com>

	* libgomp.texi: Better distinguish OpenACC and OpenMP "Runtime
	Library Routines", and "Environment Variables".

Co-Authored-By: James Norris <jnorris@codesourcery.com>

From-SVN: r267841
2019-01-11 13:55:01 +00:00
Tom de Vries 052aaaceed [nvptx] Don't allow vector_length 64 with num_workers 16
When using a compiler build with:
...
+#define PTX_DEFAULT_VECTOR_LENGTH PTX_CTA_SIZE
...

consider a test-case:
...
int
main (void)
{
  #pragma acc parallel vector_length (64)
    #pragma acc loop worker
    for (unsigned int i = 0; i < 32; i++)
      #pragma acc loop vector
      for (unsigned int j = 0; j < 64; j++)
        ;

  return 0;
}
...

If num_workers is 16, either because:
- we add a "num_workers (16)" clause on the parallel directive, or
- we set "GOMP_OPENACC_DIM=:16:", or
- the libgomp plugin chooses 16 num_workers
we run into an illegal instruction at runtime, because a bar.sync instruction
tries to use a barrier 16.  The instruction is illegal, because ptx supports
only 16 barriers per CTA, and the valid range is 0..15.

The problem is that with a warp-multiple vector length, we use a code generation
scheme with a per-worker barrier.  And because barrier zero is reserved for
per-cta barrier, only the remaining 15 barriers can be used as per-worker
barrier, and consequently we can't use num_workers larger than 15.

This problem occurs only for vector_length 64.  For vector_length 32, we use a
different code generation scheme, and for vector_length >= 96, the maximum
num_workers is not big enough not to trigger this problem.

Also, this problem only occurs for num_workers 16.  As explained above,
num_workers 15 is safe to use, and 16 is already the maximum num_workers for
vector_length 64.

This patch fixes the problem in both the compiler (handling "num_workers (16)")
and in the libgomp nvptx plugin (with and without "GOMP_OPENACC_DIM=:16:").

2019-01-11  Tom de Vries  <tdevries@suse.de>

	* config/nvptx/nvptx.c (PTX_CTA_NUM_BARRIERS, PTX_PER_CTA_BARRIER)
	(PTX_NUM_PER_CTA_BARRIER, PTX_FIRST_PER_WORKER_BARRIER)
	(PTX_NUM_PER_WORKER_BARRIERS): Define.
	(nvptx_apply_dim_limits): Prevent vector_length 64 and
	num_workers 16.

	* plugin/plugin-nvptx.c (nvptx_exec): Prevent vector_length 64 and
	num_workers 16.

From-SVN: r267838
2019-01-11 11:46:43 +00:00
Tom de Vries 9390f91687 [libgomp, testsuite, openacc] Remove -foffload=-w in reduction-[1-5].c
Before the commit "[libgomp, testsuite, openacc] Don't use const int for
dimensions", the "const int" construct was used to set launch dimensions in
reductions-[1-5].c.  In the case of -xc -O0, the const int is implemented as a
variable by the C front-end.  Consequently, the nvptx back-end generated
warnings that vector_length was overridden to be hard-coded, rather than left to
be set at runtime.  The test-cases silenced these warnings by switching off all
warnings in the accelerator compiler using "-foffload=-w".

Given that no warnings occur anymore, remove the "-foffload=-w" setting.

2019-01-11  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Remove
	-foffload=-w.
	* testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Same.

From-SVN: r267836
2019-01-11 11:46:06 +00:00
Tom de Vries 2c3e7ad20b [nvptx, testsuite, openacc, libgomp] Add insufficient-resources.c
Add a test-case that tests the "insufficient resources" fatal in the nvptx
libgomp plugin.

2019-01-11  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/insufficient-resources.c: New
	test.

From-SVN: r267835
2019-01-11 11:45:55 +00:00
Nathan Sidwell e222497dcb Add testcase from PR71959
libgomp/

	PR lto/71959
	* testsuite/libgomp.oacc-c++/pr71959-aux.cc: New.
	* testsuite/libgomp.oacc-c++/pr71959.C: New.

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

From-SVN: r267806
2019-01-10 12:32:03 +00:00
Sebastian Huber cb87fec331 libgomp: Reduce copy and paste for RTEMS
libgomp/

	* config/rtems/bar.c: Include "../linux/bar.c" and delete copy
	and paste code.

From-SVN: r267752
2019-01-09 06:16:05 +00:00
Sebastian Huber 30b4d0d0b9 libgomp: Avoid complex dependencies for RTEMS
libgomp/

	* config/rtems/affinity-fmt.c: New file.  Include affinity-fmt.c,
	undefining HAVE_GETPID and HAVE_GETHOSTNAME, and mapping fwrite to
	write.

From-SVN: r267751
2019-01-09 06:14:15 +00:00
Tom de Vries 5d0bc70ae4 [libgomp, testsuite, openacc] Don't use const int for dimensions
Const int is handled differently at -O0 for -xc and -xc++, which can cause noise
in testsuite/libgomp.oacc-c-c++-common test-cases (which are both run for c and
c++) if const int is used for launch dimensions.

Fix this by using #defines instead.

2019-01-09  Tom de Vries  <tdevries@suse.de>

	PR target/88756
	* testsuite/libgomp.oacc-c-c++-common/reduction-1.c (ng, nw, vl): Use
	#define instead of "const int".
	* testsuite/libgomp.oacc-c-c++-common/reduction-2.c (ng, nw, vl): Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-3.c (ng, nw, vl): Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-4.c (ng, nw, vl): Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-5.c (ng, nw, vl): Same.

From-SVN: r267747
2019-01-09 00:07:55 +00:00
Tom de Vries 2c372e81a9 [nvptx, libgomp] Don't launch with num_workers == 0
When using a compiler build with:
...
+#define PTX_DEFAULT_VECTOR_LENGTH PTX_CTA_SIZE
+#define PTX_MAX_VECTOR_LENGTH PTX_CTA_SIZE
...
and running the libgomp testsuite, we run into an execution failure in
parallel-loop-1.c, due to a cuda launch failure:
...
  nvptx_exec: kernel f6_none_none$_omp_fn$0: launch gangs=480, workers=0, \
    vectors=1024

libgomp: cuLaunchKernel error: invalid argument
...
because workers == 0.

The workers variable is set to 0 here in nvptx_exec:
...
                workers = blocks / actual_vectors;
...
because actual_vectors is 1024, and blocks is 768:
...
cuOccupancyMaxPotentialBlockSize: grid = 10, block = 768
...

Fix this by ensuring that workers is at least one.

2019-01-09  Tom de Vries  <tdevries@suse.de>

	* plugin/plugin-nvptx.c (nvptx_exec): Make sure to launch with at least
	one worker.

From-SVN: r267746
2019-01-09 00:07:45 +00:00
Tom de Vries 43493c97a6 [nvptx] Fix libgomp.oacc-c-c++-common/vector-length-128-3.c
The vector-length-128-3.c test-case uses GOMP_OPENACC_DIM=-:-:128, but '-' is
not yet supported on trunk.  Use GOMP_OPENACC_DIM=::128 instead.

2019-01-07  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-3.c: Fix
	GOMP_OPENACC_DIM argument.

From-SVN: r267624
2019-01-07 08:09:49 +00:00