]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
openmp: Add -foffload-memory
authorAndrew Stubbs <ams@codesourcery.com>
Wed, 2 Feb 2022 10:17:16 +0000 (10:17 +0000)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 28 Jun 2022 20:55:22 +0000 (13:55 -0700)
Add a new option.  It will be used in follow-up patches.

Backport of the patch posted at
https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591350.html

gcc/ChangeLog:

* common.opt: Add -foffload-memory and its enum values.
* coretypes.h (enum offload_memory): New.
* doc/invoke.texi: Document -foffload-memory.

gcc/ChangeLog.omp
gcc/common.opt
gcc/coretypes.h
gcc/doc/invoke.texi

index 8668d76babd7475efdae252873ab737c4c37b0dd..8b9a869e759933ffcb501eecbc472f792c225513 100644 (file)
@@ -1,3 +1,12 @@
+2022-03-10  Andrew Stubbs <ams@codesourcery.com>
+
+       Backport of the patch posted at
+       https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591350.html
+
+       * common.opt: Add -foffload-memory and its enum values.
+       * coretypes.h (enum offload_memory): New.
+       * doc/invoke.texi: Document -foffload-memory.
+
 2022-03-09  Abid Qadeer  <abidh@codesourcery.com>
 
        Backport of a patch posted at
index ea2837c857dbc39a8ec931d995f5875c714359ec..129e5fb25548e3852a349f291ad49b00728c3cf7 100644 (file)
@@ -2191,6 +2191,22 @@ Enum(offload_abi) String(ilp32) Value(OFFLOAD_ABI_ILP32)
 EnumValue
 Enum(offload_abi) String(lp64) Value(OFFLOAD_ABI_LP64)
 
+foffload-memory=
+Common Joined RejectNegative Enum(offload_memory) Var(flag_offload_memory) Init(OFFLOAD_MEMORY_NONE)
+-foffload-memory=[none|unified|pinned] Use an offload memory optimization.
+
+Enum
+Name(offload_memory) Type(enum offload_memory) UnknownError(Unknown offload memory option %qs)
+
+EnumValue
+Enum(offload_memory) String(none) Value(OFFLOAD_MEMORY_NONE)
+
+EnumValue
+Enum(offload_memory) String(unified) Value(OFFLOAD_MEMORY_UNIFIED)
+
+EnumValue
+Enum(offload_memory) String(pinned) Value(OFFLOAD_MEMORY_PINNED)
+
 fomit-frame-pointer
 Common Var(flag_omit_frame_pointer) Optimization
 When possible do not generate stack frames.
index 08b9ac9094ce73d5a9935f1f398c0a71c25e40f3..dd52d5bb113e87dbd0d98f3435b2e9a7c2330ea5 100644 (file)
@@ -206,6 +206,13 @@ enum offload_abi {
   OFFLOAD_ABI_ILP32
 };
 
+/* Types of memory optimization for an offload device.  */
+enum offload_memory {
+  OFFLOAD_MEMORY_NONE,
+  OFFLOAD_MEMORY_UNIFIED,
+  OFFLOAD_MEMORY_PINNED
+};
+
 /* Types of profile update methods.  */
 enum profile_update {
   PROFILE_UPDATE_SINGLE,
index e4b756efb5c8a8c9eb8ab7e996147af0a173149d..88275248fb4838daeee591b2081ad64d8dfb38c6 100644 (file)
@@ -202,7 +202,7 @@ in the following sections.
 -fno-builtin  -fno-builtin-@var{function}  -fcond-mismatch @gol
 -ffreestanding  -fgimple  -fgnu-tm  -fgnu89-inline  -fhosted @gol
 -flax-vector-conversions  -fms-extensions @gol
--foffload=@var{arg}  -foffload-options=@var{arg} @gol
+-foffload=@var{arg}  -foffload-options=@var{arg} -foffload-memory=@var{arg} @gol
 -fopenacc  -fopenacc-dim=@var{geom} @gol
 -fopenmp  -fopenmp-simd @gol
 -fpermitted-flt-eval-methods=@var{standard} @gol
@@ -2707,6 +2707,20 @@ Typical command lines are
 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
 @end smallexample
 
+@item -foffload-memory=none
+@itemx -foffload-memory=unified
+@itemx -foffload-memory=pinned
+@opindex foffload-memory
+@cindex OpenMP offloading memory modes
+Enable a memory optimization mode to use with OpenMP.  The default behavior,
+@option{-foffload-memory=none}, is to do nothing special (unless enabled via
+a requires directive in the code).  @option{-foffload-memory=unified} is
+equivalent to @code{#pragma omp requires unified_shared_memory}.
+@option{-foffload-memory=pinned} forces all host memory to be pinned (this
+mode may require the user to increase the ulimit setting for locked memory).
+All translation units must select the same setting to avoid undefined
+behavior.
+
 @item -fopenacc
 @opindex fopenacc
 @cindex OpenACC accelerator programming