public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] openmp: Add -foffload-memory
@ 2022-03-14 10:26 Hafiz Abid Qadeer
  0 siblings, 0 replies; only message in thread
From: Hafiz Abid Qadeer @ 2022-03-14 10:26 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a17e41ca17ae8182986ac4117c93e1423ae8d37a

commit a17e41ca17ae8182986ac4117c93e1423ae8d37a
Author: Andrew Stubbs <ams@codesourcery.com>
Date:   Wed Feb 2 10:17:16 2022 +0000

    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.

Diff:
---
 gcc/ChangeLog.omp   |  9 +++++++++
 gcc/common.opt      | 16 ++++++++++++++++
 gcc/coretypes.h     |  7 +++++++
 gcc/doc/invoke.texi | 16 +++++++++++++++-
 4 files changed, 47 insertions(+), 1 deletion(-)

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-14 10:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 10:26 [gcc/devel/omp/gcc-11] openmp: Add -foffload-memory Hafiz Abid Qadeer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).