diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2024-10-13 10:18:31 +0200 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2024-10-13 10:18:31 +0200 |
commit | 3269a722b7a03613e9c4e2862bc5088c4a17cc11 (patch) | |
tree | 82e582c6bcd47b0f8dc67f3d0d056f6c2a7bb663 /gcc/fortran/trans-decl.cc | |
parent | c38385ddbcce9fbeeaa788b6a4f50bd0653b0271 (diff) | |
download | gcc-3269a722b7a03613e9c4e2862bc5088c4a17cc11.zip gcc-3269a722b7a03613e9c4e2862bc5088c4a17cc11.tar.gz gcc-3269a722b7a03613e9c4e2862bc5088c4a17cc11.tar.bz2 |
Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device
It turned out that 'if (omp_is_initial_device() .eqv. true)' gave an ICE
due to comparing 'int' with 'logical(4)'. When digging deeper, it also
turned out that when the procedure pointer is needed, the builtin cannot
be used, either. (Follow up to r15-2799-gf1bfba3a9b3f31 )
Extend the code to also use the builtin acc_on_device with OpenACC,
which was previously only used in C/C++. Additionally, fix folding
when offloading is not enabled.
Fixes additionally the BT_BOOL data type, which was 'char'/integer(1)
instead of bool, backing the booleaness; use bool_type_node as the rest
of GCC.
gcc/fortran/ChangeLog:
* gfortran.h (gfc_option_t): Add disable_acc_on_device.
* options.cc (gfc_handle_option): Handle -fno-builtin-acc_on_device.
* trans-decl.cc (gfc_get_extern_function_decl): Move
__builtin_omp_is_initial_device handling to ...
* trans-expr.cc (get_builtin_fn): ... this new function.
(conv_function_val): Call it.
(update_builtin_function): New.
(gfc_conv_procedure_call): Call it.
* types.def (BT_BOOL): Fix type by using bool_type_node.
gcc/ChangeLog:
* gimple-fold.cc (gimple_fold_builtin_acc_on_device): Also fold
when offloading is not configured.
libgomp/ChangeLog:
* libgomp.texi (TR13): Fix minor typos.
(omp_is_initial_device): Improve wording.
(acc_on_device): Note how to disable the builtin.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Remove TODO.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
Add -fno-builtin-acc_on_device.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c: Update
dg- as !offloading_enabled now compile-time expands acc_on_device.
* testsuite/libgomp.fortran/target-is-initial-device-3.f90: New test.
* testsuite/libgomp.oacc-fortran/acc_on_device-2.f90: New test.
Diffstat (limited to 'gcc/fortran/trans-decl.cc')
-rw-r--r-- | gcc/fortran/trans-decl.cc | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index 2586c6d..56b6202 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -2231,15 +2231,6 @@ gfc_get_extern_function_decl (gfc_symbol * sym, gfc_actual_arglist *actual_args, to know that. */ gcc_assert (!(sym->attr.entry || sym->attr.entry_master)); - if (!gfc_option.disable_omp_is_initial_device - && flag_openmp && sym->attr.function && sym->ts.type == BT_LOGICAL - && !strcmp (sym->name, "omp_is_initial_device")) - { - sym->backend_decl - = builtin_decl_explicit (BUILT_IN_OMP_IS_INITIAL_DEVICE); - return sym->backend_decl; - } - if (sym->attr.proc_pointer) return get_proc_pointer_decl (sym); |