diff mbox series

[committed] Doc update: -foffload-options= examples + OpenMP in Fortran intrinsic modules

Message ID 96ff8db2-cd00-b7cb-6818-06a4ef1c160b@codesourcery.com
State New
Headers show
Series [committed] Doc update: -foffload-options= examples + OpenMP in Fortran intrinsic modules | expand

Commit Message

Tobias Burnus June 19, 2023, 8:56 a.m. UTC
Since r14-1807-g4bcb46b3ade179, using -foffload-options='-lgfortran -lm' are
no longer required as they get automatically linked on the offload side, if
linked on the host side. (Linking with g++ implies -lm, with gfortran
'-lgfortran -lm', while an explicit 'gcc -lm -lgfortran' would also do the
autolinking.) [Note: This only affects those two libraries.]

As there the number of useful flags reduced, new ones were added, including
-foffload-options=-O3. While possible, I believe that flag is misleading as
it implies that no optimization is done unless an -O... flag has been passed
to the run-time library.

But like now for -lm and -lgfortran, also the -O... flags are automatically
passed on from the host flags. (While they can be overridden, this is usually
not required.) — As the previous line already shows an example, i.e.
   "-foffload-options='-fno-math-errno -ffinite-math-only'",
I think we can get rid of this line without needing to find another example.

* * *

Looking at Fortran's fortran/intrinsic.texi I saw references to 4.5 and 5.0;
I have now added 5.1 and 5.2 – hopefully, we can at replace them soon
(GCC 15?) the v4.5 to 5.2 by just 5.2, having implemented all of 5.x.

(The reference to v4.5 in GCC's and gfortran's invoke.texi feels also odd
as v5.* is supported and the attribute syntax shown for C/C++ is only in
v5.x. To be changed - but not now.)


Additionally, fortran/intrinsic.texi listed the content of the OMP_* modules
(except for the API routines) but missed two recently added named constants,
which I now added.

Committed as r14-1936-ge9c1679c350be0.

Like always, comments are highly welcome!

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
diff mbox series

Patch

commit e9c1679c350be09cec5354a3d98915c3afe02c87
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Jun 19 10:24:08 2023 +0200

    Doc update: -foffload-options= examples + OpenMP in Fortran intrinsic modules
    
    With LTO, the -O.. flags of the host are passed on to the lto compiler, which
    also includes offloading compilers. Therefore, using --foffload-options=-O3 is
    misleading as it implies that without the default optimizations are used. Hence,
    this flags has now been removed from the usage examples.
    
    The Fortran documentation lists the content (except for API routines) routines
    of the intrinsic OpenMP modules OMP_LIB and OMP_LIB_KINDS; this commit adds
    two missing named constants and links also to the OpenMP 5.1 and 5.2
    OpenMP spec for completeness.
    
    gcc/ChangeLog:
    
            * doc/invoke.texi (-foffload-options): Remove '-O3' from the examples.
    
    gcc/fortran/ChangeLog:
    
            * intrinsic.texi (OpenMP Modules OMP_LIB and OMP_LIB_KINDS): Also
            add references to the OpenMP 5.1 and 5.2 spec; add omp_initial_device
            and omp_invalid_device named constants.
---
 gcc/doc/invoke.texi        |  2 +-
 gcc/fortran/intrinsic.texi | 20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index fafdee30f66..215ab0dd05c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2718,7 +2718,7 @@  Typical command lines are
 
 @smallexample
 -foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic
--foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-O3
+-foffload-options=amdgcn-amdhsa=-march=gfx906
 @end smallexample
 
 @opindex fopenacc
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 5555db227ea..6c7ad03a02c 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -15247,8 +15247,9 @@  with the following options: @code{-fno-unsafe-math-optimizations
 @table @asis
 @item @emph{Standard}:
 OpenMP Application Program Interface v4.5,
-OpenMP Application Program Interface v5.0 (partially supported) and
-OpenMP Application Program Interface v5.1 (partially supported).
+OpenMP Application Program Interface v5.0 (partially supported),
+OpenMP Application Program Interface v5.1 (partially supported) and
+OpenMP Application Program Interface v5.2 (partially supported).
 @end table
 
 The OpenMP Fortran runtime library routines are provided both in
@@ -15262,9 +15263,13 @@  below.
 
 For details refer to the actual
 @uref{https://www.openmp.org/wp-content/uploads/openmp-4.5.pdf,
-OpenMP Application Program Interface v4.5} and
+OpenMP Application Program Interface v4.5},
 @uref{https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf,
-OpenMP Application Program Interface v5.0}.
+OpenMP Application Program Interface v5.0},
+@uref{https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5-1.pdf,
+OpenMP Application Program Interface v5.1} and
+@uref{https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5-2.pdf,
+OpenMP Application Program Interface v5.2}.
 
 @code{OMP_LIB_KINDS} provides the following scalar default-integer
 named constants:
@@ -15295,6 +15300,13 @@  The following derived type:
 @item @code{omp_alloctrait}
 @end table
 
+The following scalar default-integer named constants:
+@table @asis
+@item @code{omp_initial_device}
+@item @code{omp_invalid_device}
+@end table
+
+
 The following scalar integer named constants of the
 kind @code{omp_sched_kind}: