Skip to content
Snippets Groups Projects
  1. Sep 28, 2024
  2. Sep 27, 2024
  3. Sep 26, 2024
  4. Sep 25, 2024
  5. Sep 24, 2024
    • Jakub Jelinek's avatar
      c++: Implement C++23 P2718R0 - Wording for P2644R1 Fix for Range-based for Loop [PR107637] · 650e9156
      Jakub Jelinek authored
      The following patch implements the C++23 P2718R0 paper
      - Wording for P2644R1 Fix for Range-based for Loop.
      The patch introduces a new option, -f{,no-}range-for-ext-temps so that
      user can control the behavior even in older C++ versions.
      The option is on by default in C++23 and later (-fno-range-for-ext-temps
      is an error in that case) and in the -std=gnu++11 ... -std=gnu++20 modes
      (one can use -fno-range-for-ext-temps to request previous behavior in that
      case), and is not enabled by default in -std=c++11 ... -std=c++20 modes
      but one can explicitly enable it with -frange-for-ext-temps.
      As all the temporaries from __for_range initialization should have life
      extended until the end of __for_range scope, this patch disables (for
      -frange-for-ext-temps and if !processing_template_decl) CLEANUP_POINT_EXPR wrapping
      of the __for_range declaration, also disables -Wdangling-reference warning
      as well as the rest of extend_ref_init_temps (we know the __for_range temporary
      is not TREE_STATIC and as all the temporaries from the initializer will be life
      extended, we shouldn't try to handle temporaries referenced by references any
      differently) and adds an extra push_stmt_list/pop_stmt_list before
      cp_finish_decl of __for_range and after end of the for body and wraps all
      that into CLEANUP_POINT_EXPR.
      I had to repeat that also for OpenMP range loops because those are handled
      differently.
      
      2024-09-24  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/107637
      gcc/
      	* omp-general.cc (find_combined_omp_for, find_nested_loop_xform):
      	Handle CLEANUP_POINT_EXPR like TRY_FINALLY_EXPR.
      	* doc/invoke.texi (frange-for-ext-temps): Document.  Add
      	-fconcepts to the C++ option list.
      gcc/c-family/
      	* c.opt (frange-for-ext-temps): New option.
      	* c-opts.cc (c_common_post_options): Set flag_range_for_ext_temps
      	for C++23 or later or for C++11 or later in !flag_iso mode if
      	the option wasn't set by user.
      	* c-cppbuiltin.cc (c_cpp_builtins): Change __cpp_range_based_for
      	value for flag_range_for_ext_temps from 201603L to 202212L in C++17
      	or later.
      	* c-omp.cc (c_find_nested_loop_xform_r): Handle CLEANUP_POINT_EXPR
      	like TRY_FINALLY_EXPR.
      gcc/cp/
      	* cp-tree.h: Implement C++23 P2718R0 - Wording for P2644R1 Fix for
      	Range-based for Loop.
      	(cp_convert_omp_range_for): Add bool tmpl_p argument.
      	(find_range_for_decls): Declare.
      	* parser.cc (cp_convert_range_for): For flag_range_for_ext_temps call
      	push_stmt_list () before cp_finish_decl for range_temp and save it
      	temporarily to FOR_INIT_STMT.
      	(cp_convert_omp_range_for): Add tmpl_p argument.  If set, remember
      	DECL_NAME of range_temp and for cp_finish_decl call restore it before
      	clearing it again, if unset, don't adjust DECL_NAME of range_temp at
      	all.
      	(cp_parser_omp_loop_nest): For flag_range_for_ext_temps range for add
      	CLEANUP_POINT_EXPR around sl.  Call find_range_for_decls and adjust
      	DECL_NAMEs for range fors if not processing_template_decl.  Adjust
      	cp_convert_omp_range_for caller.  Remove superfluous backslash at the
      	end of line.
      	* decl.cc (initialize_local_var): For flag_range_for_ext_temps
      	temporarily clear stmts_are_full_exprs_p rather than set for
      	for_range__identifier decls.
      	* call.cc (extend_ref_init_temps): For flag_range_for_ext_temps return
      	init early for for_range__identifier decls.
      	* semantics.cc (find_range_for_decls): New function.
      	(finish_for_stmt): Use it.  For flag_range_for_ext_temps if
      	cp_convert_range_for set FOR_INIT_STMT, pop_stmt_list it and wrap
      	into CLEANUP_POINT_EXPR.
      	* pt.cc (tsubst_omp_for_iterator): Adjust tsubst_omp_for_iterator
      	caller.
      	(tsubst_stmt) <case OMP_FOR>: For flag_range_for_ext_temps if there
      	are any range fors in the loop nest, add push_stmt_list starting
      	before the initializations, pop_stmt_list it after the body and wrap
      	into CLEANUP_POINT_EXPR.  Change DECL_NAME of range for temps from
      	NULL to for_range_identifier.
      gcc/testsuite/
      	* g++.dg/cpp23/range-for1.C: New test.
      	* g++.dg/cpp23/range-for2.C: New test.
      	* g++.dg/cpp23/range-for3.C: New test.
      	* g++.dg/cpp23/range-for4.C: New test.
      	* g++.dg/cpp23/range-for5.C: New test.
      	* g++.dg/cpp23/range-for6.C: New test.
      	* g++.dg/cpp23/range-for7.C: New test.
      	* g++.dg/cpp23/range-for8.C: New test.
      	* g++.dg/cpp23/feat-cxx2b.C (__cpp_range_based_for): Check for
      	202212L rather than 201603L.
      	* g++.dg/cpp26/feat-cxx26.C (__cpp_range_based_for): Likewise.
      	* g++.dg/warn/Wdangling-reference4.C: Don't expect warning for C++23
      	or newer.  Use dg-additional-options rather than dg-options.
      libgomp/
      	* testsuite/libgomp.c++/range-for-1.C: New test.
      	* testsuite/libgomp.c++/range-for-2.C: New test.
      	* testsuite/libgomp.c++/range-for-3.C: New test.
      	* testsuite/libgomp.c++/range-for-4.C: New test.
      	* testsuite/libgomp.c++/range-for-5.C: New test.
      650e9156
    • Tobias Burnus's avatar
      libgomp: with USM, init 'link' variables with host address · 4cb20dc0
      Tobias Burnus authored
      If requires unified_shared_memory or self_maps is set, make
      'declare target link' variables to point initially to the host pointer.
      
      libgomp/ChangeLog:
      
      	* target.c (gomp_load_image_to_device): For requires
      	unified_shared_memory, update 'link' vars to point to the host var.
      	* testsuite/libgomp.c-c++-common/target-link-3.c: New test.
      	* testsuite/libgomp.c-c++-common/target-link-4.c: New test.
      4cb20dc0
    • Tobias Burnus's avatar
      OpenMP: Add support for 'self_maps' to the 'require' directive · b752eed3
      Tobias Burnus authored
      'self_maps' implies 'unified_shared_memory', except that the latter
      also permits that explicit maps copy data to device memory while
      self_maps does not. In GCC, currently, both are handled identical.
      
      gcc/c/ChangeLog:
      
      	* c-parser.cc (c_parser_omp_requires): Handle self_maps clause.
      
      gcc/cp/ChangeLog:
      
      	* parser.cc (cp_parser_omp_requires): Handle self_maps clause.
      
      gcc/fortran/ChangeLog:
      
      	* gfortran.h (enum gfc_omp_requires_kind): Add OMP_REQ_SELF_MAPS.
      	(gfc_namespace): Enlarge omp_requires bitfield.
      	* module.cc (enum ab_attribute, attr_bits): Add AB_OMP_REQ_SELF_MAPS.
      	(mio_symbol_attribute): Handle it.
      	* openmp.cc (gfc_check_omp_requires, gfc_match_omp_requires): Handle
      	self_maps clause.
      	* parse.cc (gfc_parse_file): Handle self_maps clause.
      
      gcc/ChangeLog:
      
      	* lto-cgraph.cc (output_offload_tables, omp_requires_to_name): Handle
      	self_maps clause.
      	* omp-general.cc (struct omp_ts_info, omp_context_selector_matches):
      	Likewise for the associated trait.
      	* omp-general.h (enum omp_requires): Add OMP_REQUIRES_SELF_MAPS.
      	* omp-selectors.h (enum omp_ts_code): Add
      	OMP_TRAIT_IMPLEMENTATION_SELF_MAPS.
      
      include/ChangeLog:
      
      	* gomp-constants.h (GOMP_REQUIRES_SELF_MAPS): #define.
      
      libgomp/ChangeLog:
      
      	* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices):
      	Accept self_maps clause.
      	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_num_devices):
      	Likewise.
      	* libgomp.texi (TR13 Impl. Status): Set to 'Y'.
      	* target.c (gomp_requires_to_name, GOMP_offload_register_ver,
      	gomp_target_init): Handle self_maps clause.
      	* testsuite/libgomp.fortran/self_maps.f90: New test.
      
      gcc/testsuite/ChangeLog:
      
      	* c-c++-common/gomp/declare-variant-1.c: Add self_maps test.
      	* c-c++-common/gomp/requires-4.c: Likewise.
      	* gfortran.dg/gomp/declare-variant-3.f90:  Likewise.
      	* c-c++-common/gomp/requires-2.c: Update dg-error msg.
      	* gfortran.dg/gomp/requires-2.f90: Likewise.
      	* gfortran.dg/gomp/requires-self-maps-aux.f90: New.
      	* gfortran.dg/gomp/requires-self-maps.f90: New.
      b752eed3
    • GCC Administrator's avatar
      Daily bump. · 4d6fa5b7
      GCC Administrator authored
      4d6fa5b7
  6. Sep 23, 2024
    • Tobias Burnus's avatar
      OpenMP: Fix omp_get_device_from_uid, minor cleanup · cdb9aa0f
      Tobias Burnus authored
      In Fortran, omp_get_device_from_uid can also accept substrings, which are
      then not NUL terminated.  Fixed by introducing a fortran.c wrapper function.
      Additionally, in case of a fail the plugin functions now return NULL instead
      of failing fatally such that a fall-back UID is generated.
      
      gcc/ChangeLog:
      
      	* omp-general.cc (omp_runtime_api_procname): Strip "omp_" from
      	string; move get_device_from_uid as now a '_' suffix exists.
      
      libgomp/ChangeLog:
      
      	* fortran.c (omp_get_device_from_uid_): New function.
      	* libgomp.map (GOMP_6.0): Add it.
      	* oacc-host.c (host_dispatch): Init '.uid' and '.get_uid_func'.
      	* omp_lib.f90.in: Make it used by removing bind(C).
      	* omp_lib.h.in: Likewise.
      	* target.c (omp_get_device_from_uid): Ensure the device is initialized.
      	* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_uid): Add function comment;
      	return NULL in case of an error.
      	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_uid): Likewise.
      	* testsuite/libgomp.fortran/device_uid.f90: Update to test substrings.
      cdb9aa0f
  7. Sep 20, 2024
    • GCC Administrator's avatar
      Daily bump. · 442db842
      GCC Administrator authored
      442db842
    • Tobias Burnus's avatar
      OpenMP: Add get_device_from_uid/omp_get_uid_from_device routines · bf4a5efa
      Tobias Burnus authored
      Those TR13/OpenMP 6.0 routines permit a reproducible offloading to
      a specific device by mapping an OpenMP device number to a
      unique ID (UID). The GPU device UIDs should be universally unique,
      the one for the host is not.
      
      gcc/ChangeLog:
      
      	* omp-general.cc (omp_runtime_api_procname): Add
      	get_device_from_uid and omp_get_uid_from_device routines.
      
      include/ChangeLog:
      
      	* cuda/cuda.h (cuDeviceGetUuid): Declare.
      	(cuDeviceGetUuid_v2): Add prototype.
      
      libgomp/ChangeLog:
      
      	* config/gcn/target.c (omp_get_uid_from_device,
      	omp_get_device_from_uid): Add stub implementation.
      	* config/nvptx/target.c (omp_get_uid_from_device,
      	omp_get_device_from_uid): Likewise.
      	* fortran.c (omp_get_uid_from_device_,
      	omp_get_uid_from_device_8_): New functions.
      	* libgomp-plugin.h (GOMP_OFFLOAD_get_uid): Add prototype.
      	* libgomp.h (struct gomp_device_descr): Add 'uid' and 'get_uid_func'.
      	* libgomp.map (GOMP_6.0): New, includind the new UID routines.
      	* libgomp.texi (OpenMP Technical Report 13): Mark UID routines as 'Y'.
      	(Device Information Routines): Document new UID routines.
      	(Offload-Target Specifics): Document UID format.
      	* omp.h.in (omp_get_device_from_uid, omp_get_uid_from_device):
      	New prototype.
      	* omp_lib.f90.in (omp_get_device_from_uid, omp_get_uid_from_device):
      	New interface.
      	* omp_lib.h.in: Likewise.
      	* plugin/cuda-lib.def: Add cuDeviceGetUuid and cuDeviceGetUuid_v2 via
      	CUDA_ONE_CALL_MAYBE_NULL.
      	* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_uid): New.
      	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_uid): New.
      	* target.c (str_omp_initial_device): New static var.
      	(STR_OMP_DEV_PREFIX): Define.
      	(gomp_get_uid_for_device, omp_get_uid_from_device,
      	omp_get_device_from_uid): New.
      	(gomp_load_plugin_for_device): DLSYM_OPT the function 'get_uid'.
      	(gomp_target_init): Set the device's 'uid' field to NULL.
      	* testsuite/libgomp.c/device_uid.c: New test.
      	* testsuite/libgomp.fortran/device_uid.f90: New test.
      bf4a5efa
  8. Sep 03, 2024
  9. Sep 02, 2024
    • Andrew Stubbs's avatar
      amdgcn: remove gfx803 "Fiji" support · 57af0022
      Andrew Stubbs authored
      The gfx803 "Fiji" device was deprecated in GCC 14, removed from LLVM 18, and
      hasn't worked properly with the drivers since about ROCm 4.
      
      This patch removes the device from GCC options and documentation, and removes
      the direct mentions from the internals.
      
      The TARGET_GCN3 support in the back-end is now unused and can be removed (in a
      follow-up patch).
      
      gcc/ChangeLog:
      
      	* config.gcc (amdgcn-*-*): Remove "fiji" from with_arch checks.
      	* config/gcn/gcn-hsa.h (ABI_VERSION_SPEC): Remove fiji alternative.
      	(NO_XNACK): Likewise.
      	(NO_SRAM_ECC): Likewise.
      	(ASM_SPEC): Remove "%{}" around ABI_VERSION_SPEC.
      	* config/gcn/gcn-opts.h (enum processor_type): Remove PROCESSOR_FIJI.
      	(TARGET_FIJI): Delete.
      	* config/gcn/gcn.cc (gcn_option_override): Remove Fiji.
      	(gcn_omp_device_kind_arch_isa): Likewise.
      	(output_file_start): Likewise.
      	* config/gcn/gcn.h (TARGET_CPU_CPP_BUILTINS): Likewise.
      	* config/gcn/gcn.opt (gpu_type): Likewise.
      	(march, mtune): Change default to PROCESSOR_VEGA10.
      	* config/gcn/mkoffload.cc (EF_AMDGPU_MACH_AMDGCN_GFX803): Delete.
      	(copy_early_debug_info): Remove elf_flags_actual.
      	Use ELFABIVERSION_AMDGPU_HSA_V4 unconditionally.
      	(get_arch): Remove Fiji.
      	(main): Remove gfx803.
      	* config/gcn/t-omp-device
      	(omp-device-properties-gcn): Remove fiji and gfx803.
      	* doc/install.texi (amdgcn*-*-*): Remove fiji and special instructions.
      	* doc/invoke.texi: Remove fiji.
      
      libgomp/ChangeLog:
      
      	* libgomp.texi: Remove fiji and gfx803.
      	* testsuite/libgomp.c/declare-variant-4.h: Remove fiji and gfx803.
      	* testsuite/libgomp.c/declare-variant-4-fiji.c: Removed.
      	* testsuite/libgomp.c/declare-variant-4-gfx803.c: Removed.
      57af0022
    • Alex Coplan's avatar
      testsuite: Rename scanltranstree.exp -> scanltrans.exp · e4d3e7f9
      Alex Coplan authored
      Since r15-3254-g3f51f0dc88ec21c1ec79df694200f10ef85915f4
      added scan-ltrans-rtl* variants to scanltranstree.exp, it no longer
      makes sense to have "tree" in the name.  This renames the file
      accordingly and updates users.
      
      libatomic/ChangeLog:
      
      	* testsuite/lib/libatomic.exp: Load scanltrans.exp instead of
      	scanltranstree.exp.
      
      libgomp/ChangeLog:
      
      	* testsuite/lib/libgomp.exp: Load scanltrans.exp instead of
      	scanltranstree.exp.
      
      libitm/ChangeLog:
      
      	* testsuite/lib/libitm.exp: Load scanltrans.exp instead of
      	scanltranstree.exp.
      
      libphobos/ChangeLog:
      
      	* testsuite/lib/libphobos-dg.exp: Load scanltrans.exp instead of
      	scanltranstree.exp.
      
      libvtv/ChangeLog:
      
      	* testsuite/lib/libvtv.exp: Load scanltrans.exp instead of
      	scanltranstree.exp.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg-selftests/dg-final.exp: Load scanltrans.exp instead of
      	scanltranstree.exp.
      	* lib/gcc-dg.exp: Likewise.
      	* lib/scanltranstree.exp: Rename to ...
      	* lib/scanltrans.exp: ... this.
      e4d3e7f9
  10. Aug 29, 2024
  11. Aug 28, 2024
    • Tobias Burnus's avatar
      libgomp: Add interop types and routines to OpenMP's headers and module · 0beac1db
      Tobias Burnus authored
      This commit adds OpenMP 5.1+'s interop enumeration, type and routine
      declarations to the C/C++ header file and, new in OpenMP TR13, also to
      the Fortran module and omp_lib.h header file.
      
      While a stub implementation is provided, only with foreign runtime
      support by the libgomp GPU plugins and with the 'interop' directive,
      this becomes really useful.
      
      libgomp/ChangeLog:
      
      	* fortran.c (omp_get_interop_str_, omp_get_interop_name_,
      	omp_get_interop_type_desc_, omp_get_interop_rc_desc_): Add.
      	* libgomp.map (GOMP_5.1.3): New; add interop routines.
      	* omp.h.in: Add interop typedefs, enum and prototypes.
      	(__GOMP_DEFAULT_NULL): Define.
      	(omp_target_memcpy_async, omp_target_memcpy_rect_async):
      	Use it for the optional depend argument.
      	* omp_lib.f90.in: Add paramters and interfaces for interop.
      	* omp_lib.h.in: Likewise; move F90 '&' to column 81 for
      	-ffree-length-80.
      	* target.c (omp_get_num_interop_properties, omp_get_interop_int,
      	omp_get_interop_ptr, omp_get_interop_str, omp_get_interop_name,
      	omp_get_interop_type_desc, omp_get_interop_rc_desc): Add.
      	* config/gcn/target.c (omp_get_num_interop_properties,
      	omp_get_interop_int, omp_get_interop_ptr, omp_get_interop_str,
      	omp_get_interop_name, omp_get_interop_type_desc,
      	omp_get_interop_rc_desc): Add.
      	* config/nvptx/target.c (omp_get_num_interop_properties,
      	omp_get_interop_int, omp_get_interop_ptr, omp_get_interop_str,
      	omp_get_interop_name, omp_get_interop_type_desc,
      	omp_get_interop_rc_desc): Add.
      	* testsuite/libgomp.c-c++-common/interop-routines-1.c: New test.
      	* testsuite/libgomp.c-c++-common/interop-routines-2.c: New test.
      	* testsuite/libgomp.fortran/interop-routines-1.F90: New test.
      	* testsuite/libgomp.fortran/interop-routines-2.F90: New test.
      	* testsuite/libgomp.fortran/interop-routines-3.F: New test.
      	* testsuite/libgomp.fortran/interop-routines-4.F: New test.
      	* testsuite/libgomp.fortran/interop-routines-5.F: New test.
      	* testsuite/libgomp.fortran/interop-routines-6.F: New test.
      	* testsuite/libgomp.fortran/interop-routines-7.F90: New test.
      0beac1db
  12. Aug 10, 2024
  13. Aug 09, 2024
    • Thomas Schwinge's avatar
      OpenMP: Constructors and destructors for "declare target" static aggregates:... · 9f5d22e3
      Thomas Schwinge authored
      OpenMP: Constructors and destructors for "declare target" static aggregates: Fix effective-target keyword in test cases
      
      (Most of) the tests added in commit f1bfba3a
      "OpenMP: Constructors and destructors for "declare target" static aggregates"
      had a mismatch between dump file production and its scanning; the former needs
      to use 'offload_target_nvptx' (like 'offload_target_amdgcn'), not
      'offload_device_nvptx'.
      
      	libgomp/
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C:
      	Fix effective-target keyword.
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C:
      	Likewise.
      	* testsuite/libgomp.c-c++-common/target-is-initial-host-2.c:
      	Likewise.
      	* testsuite/libgomp.c-c++-common/target-is-initial-host.c:
      	Likewise.
      	* testsuite/libgomp.fortran/target-is-initial-host-2.f90:
      	Likewise.
      	* testsuite/libgomp.fortran/target-is-initial-host.f: Likewise.
      	* testsuite/libgomp.fortran/target-is-initial-host.f90: Likewise.
      9f5d22e3
    • GCC Administrator's avatar
      Daily bump. · 77ccfa6a
      GCC Administrator authored
      77ccfa6a
  14. Aug 08, 2024
  15. Aug 07, 2024
    • Tobias Burnus's avatar
      OpenMP: Constructors and destructors for "declare target" static aggregates · f1bfba3a
      Tobias Burnus authored
      
      This commit also compile-time expands (__builtin_)omp_is_initial_device for
      both Fortran and C/C++ (unless, -fno-builtin-omp_is_initial_device is used).
      But the main change is:
      
      This commit adds support for running constructors and destructors for
      static (file-scope) aggregates for C++ objects which are marked with
      "declare target" directives on OpenMP offload targets.
      
      Before this commit, space is allocated on the target for such aggregates,
      but nothing ever constructs them properly, so they end up zero-initialised.
      
      (See the new test static-aggr-constructor-destructor-3.C for a reason
      why running constructors on the target is preferable to e.g. constructing
      on the host and then copying the resulting object to the target.)
      
      2024-08-07  Julian Brown  <julian@codesourcery.com>
      	    Tobias Burnus  <tobias@baylibre.com>
      
      gcc/ChangeLog:
      
      	* builtins.def (DEF_GOMP_BUILTIN_COMPILER): Define
      	DEF_GOMP_BUILTIN_COMPILER to handle the non-prefix version.
      	* gimple-fold.cc (gimple_fold_builtin_omp_is_initial_device): New.
      	(gimple_fold_builtin): Call it.
      	* omp-builtins.def (BUILT_IN_OMP_IS_INITIAL_DEVICE): Define.
      	* tree.cc (get_file_function_name): Support names for on-target
      	constructor/destructor functions.
      
      gcc/cp/
      	* decl2.cc (tree-inline.h): Include.
      	(static_init_fini_fns): Bump to four entries. Update comment.
      	(start_objects, start_partial_init_fini_fn): Add 'omp_target'
      	parameter. Support "declare target" decls. Update forward declaration.
      	(emit_partial_init_fini_fn): Add 'host_fn' parameter. Return tree for
      	the created function. Support "declare target".
      	(OMP_SSDF_IDENTIFIER): New macro.
      	(partition_vars_for_init_fini): Support partitioning "declare target"
      	variables also.
      	(generate_ctor_or_dtor_function): Add 'omp_target' parameter. Support
      	"declare target" decls.
      	(c_parse_final_cleanups): Support constructors/destructors on OpenMP
      	offload targets.
      
      gcc/fortran/ChangeLog:
      
      	* gfortran.h (gfc_option_t): Add disable_omp_is_initial_device.
      	* lang.opt (fbuiltin-): Add.
      	* options.cc (gfc_handle_option): Handle
      	-fno-builtin-omp_is_initial_device.
      	* f95-lang.cc (gfc_init_builtin_functions): Handle
      	DEF_GOMP_BUILTIN_COMPILER.
      	* trans-decl.cc (gfc_get_extern_function_decl): Add code to use
      	DEF_GOMP_BUILTIN_COMPILER for 'omp_is_initial_device'.
      
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C: New test.
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C: New test.
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-3.C: New test.
      	* testsuite/libgomp.c-c++-common/target-is-initial-host.c: New test.
      	* testsuite/libgomp.c-c++-common/target-is-initial-host-2.c: New test.
      	* testsuite/libgomp.fortran/target-is-initial-host.f: New test.
      	* testsuite/libgomp.fortran/target-is-initial-host.f90: New test.
      	* testsuite/libgomp.fortran/target-is-initial-host-2.f90: New test.
      
      Co-authored-by: default avatarTobias Burnus <tobias@baylibre.com>
      f1bfba3a
    • Tobias Burnus's avatar
      libgomp.c-c++-common/target-link-2.c: Fix test on multi-device systems · aa689684
      Tobias Burnus authored
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.c-c++-common/target-link-2.c: Reset variable
      	value to handle multi-device tests.
      aa689684
    • GCC Administrator's avatar
      Daily bump. · b120ca0c
      GCC Administrator authored
      b120ca0c
  16. Aug 06, 2024
    • Tobias Burnus's avatar
      libgomp: Device load_image - improve minor num-funcs/vars check · 0c56fd6a
      Tobias Burnus authored
      The run time library loads the offload functions and variable and optionally
      the ICV variable and returns the number of loaded items, which has to match
      the host side. The plugin returns "+1" (since GCC 12) for the ICV variable
      entry, independently whether it was loaded or not, but the var's value
      (start == end == 0) can be used to detect when this failed.
      
      Thus, we can tighten the assert check - which this commit does together with
      making the output less surprising - and simplify the condition further below.
      
      libgomp/ChangeLog:
      
      	* target.c (gomp_load_image_to_device): Extend fatal-error message;
      	simplify a condition.
      0c56fd6a
    • GCC Administrator's avatar
      Daily bump. · 8ac4db24
      GCC Administrator authored
      8ac4db24
  17. Aug 05, 2024
    • Tobias Burnus's avatar
      libgomp.texi: Add OpenMP TR13 routines to @menu (commented out) · 1a573413
      Tobias Burnus authored
      To keep track of missing routine documentation (both implemented and not),
      the libgomp.texi file contains all non-OMPT routines as commented items
      in @menu. This commit adds the routines added in TR13 as commented fixme
      items.
      
      libgomp/ChangeLog:
      
      	* libgomp.texi (OpenMP Runtime Library Routines): Add TR13 routines
      	to @menu (commented out).
      1a573413
  18. Aug 02, 2024
  19. Aug 01, 2024
    • Tobias Burnus's avatar
      omp-offload.cc: Fix value-expr handling of 'declare target link' vars [PR115637] · c99cdcab
      Tobias Burnus authored
      
      As the PR and included testcase shows, replacing 'arr2' by its value expression
      '*arr2$13$linkptr' failed for
        MEM <uint128_t> [(c_char * {ref-all})&arr2]
      which left 'arr2' in the code as unknown symbol. Now expand the value expression
      already in pass_omp_target_link::execute's process_link_var_op walk_gimple_stmt
      walk - and don't rely on gimple_regimplify_operands.
      
      	PR middle-end/115637
      
      gcc/ChangeLog:
      
      	* gimplify.cc (gimplify_body): Fix macro name in the comment.
      	* omp-offload.cc (find_link_var_op): Rename to ...
      	(process_link_var_op): ... this. Replace value expr.
      	(pass_omp_target_link::execute): Update walk_gimple_stmt call.
      
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.fortran/declare-target-link.f90: Uncomment
      	now working code.
      
      Co-authored-by: default avatarRichard Biener <rguenther@suse.de>
      c99cdcab
    • GCC Administrator's avatar
      Daily bump. · 22c62d33
      GCC Administrator authored
      22c62d33
  20. Jul 31, 2024
    • Sam James's avatar
      testsuite: fix dg-require-effective-target order vs dg-additional-sources · 9ad3d1c5
      Sam James authored
      Per gccint, 'dg-require-effective-target' must come before any
      'dg-additional-sources' directives. Fix a handful of deviant cases.
      
      gcc/testsuite/ChangeLog:
      	* gcc.target/aarch64/aapcs64/func-ret-3.c: Fix dg-require-effective-target directive order.
      	* gcc.target/aarch64/aapcs64/func-ret-4.c: Likewise.
      	* gfortran.dg/PR100914.f90: Likewise.
      
      libgomp/ChangeLog:
      	* testsuite/libgomp.c++/pr24455.C: Fix dg-require-effective-target directive order.
      	* testsuite/libgomp.c/pr24455.c: Likewise.
      9ad3d1c5
    • Sam James's avatar
      testsuite: libgomp: fix dg-do run typo · 1c85b16f
      Sam James authored
      'dg-run' is not a valid dejagnu directive, 'dg-do run' is needed here
      for the test to be executed.
      
      That said, it actually seems to be executed for me anyway, presumably
      a default in the directory, but let's fix it to be consistent with
      other uses in the tree and in that test directory even.
      
      libgomp/ChangeLog:
      	* testsuite/libgomp.c++/declare-target-indirect-1.C: Fix 'dg-run' typo.
      1c85b16f
  21. Jul 30, 2024
  22. Jul 29, 2024
    • Tobias Burnus's avatar
      libgomp.texi: Update 'Device Information Routines' section · 8d332570
      Tobias Burnus authored
      Update 'OpenMP Runtime Library Routines' by adding a note that invoking
      inside a target region might invoke unspecified behavior. Additionally,
      update omp_{get,set}_default_device for omp_{initial,invalid}_device
      named constants.
      
      libgomp/ChangeLog:
      
      	* libgomp.texi (OpenMP Runtime Library Routines): Add missing
      	title to some commented still undocumented items.
      	(Device Information Routines): Update.
      8d332570
    • Tobias Burnus's avatar
      OpenMP/Fortran: Fix handling of 'declare target' with 'link' clause [PR115559] · 29b1587e
      Tobias Burnus authored
      Contrary to a normal 'declare target', the 'declare target link' attribute
      also needs to set node->offloadable and push the offload_vars in the front end.
      
      Linked variables require that the data is mapped. For module variables, this
      can happen anywhere. For variables in an external subprograms or the main
      programm, this can only happen in the either that program itself or in an
      internal subprogram. - Whether a variable is just normally mapped or linked then
      becomes relevant if a device routine exists that can access that variable,
      i.e. an internal procedure has then to be marked as declare target.
      
      	PR fortran/115559
      
      gcc/fortran/ChangeLog:
      
      	* trans-common.cc (build_common_decl): Add 'omp declare target' and
      	'omp declare target link' variables to offload_vars.
      	* trans-decl.cc (add_attributes_to_decl): Likewise; update args and
      	call decl_attributes.
      	(get_proc_pointer_decl, gfc_get_extern_function_decl,
      	build_function_decl): Update calls.
      	(gfc_get_symbol_decl): Likewise; move after 'DECL_STATIC (t)=1'
      	to avoid errors with symtab_node::get_create.
      
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.fortran/declare-target-link.f90: New test.
      29b1587e
    • Tobias Burnus's avatar
      libgomp: Fix declare target link with offset array-section mapping [PR116107] · 14c47e7e
      Tobias Burnus authored
      Assume that 'int var[100]' is 'omp declare target link(var)'. When now
      mapping an array section with offset such as 'map(to:var[20:10])',
      the device-side link pointer has to store &<device-storage-data>[0] minus
      the offset such that var[20] will access <device-storage-data>[0]. But
      the offset calculation was missed such that the device-side 'var' pointed
      to the first element of the mapped data - and var[20] points beyond at
      some invalid memory.
      
      	PR middle-end/116107
      
      libgomp/ChangeLog:
      
      	* target.c (gomp_map_vars_internal): Honor array mapping offsets
      	with declare-target 'link' variables.
      	* testsuite/libgomp.c-c++-common/target-link-2.c: New test.
      14c47e7e
Loading