summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@codesourcery.com>2022-02-02 10:17:16 +0000
committerHafiz Abid Qadeer <abidh@codesourcery.com>2022-03-11 23:03:58 +0000
commita17e41ca17ae8182986ac4117c93e1423ae8d37a (patch)
tree1e1c1dc1b9ace76f8ccb4832bb750848ea47e8f6
parentef3c1a66eec978a1e20e29aaab8af2772560efcd (diff)
openmp: Add -foffload-memory
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.
-rw-r--r--gcc/ChangeLog.omp9
-rw-r--r--gcc/common.opt16
-rw-r--r--gcc/coretypes.h7
-rw-r--r--gcc/doc/invoke.texi16
4 files changed, 47 insertions, 1 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 46143dda9c3..9e0a6f59155 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -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-10 Abid Qadeer <abidh@codesourcery.com>
* tree.c (walk_tree_1): Add case for OMP_CLAUSE_ALLOCATOR.
diff --git a/gcc/common.opt b/gcc/common.opt
index 4c38ed5cf9a..70740059744 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2111,6 +2111,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.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 406572e947d..2157080c9e0 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -205,6 +205,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,
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 5f32d3e23f2..0c2736f76a2 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -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
@@ -2672,6 +2672,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