https://gcc.gnu.org/g:33f539fa1466fa2ac21091c35b81d00741adc85f
commit 33f539fa1466fa2ac21091c35b81d00741adc85f Author: Andrew Stubbs <a...@codesourcery.com> Date: Mon Apr 22 18:07:00 2024 +0200 openmp: Add -foffload-memory Add a new option. It's inactive until I add some follow-up patches. gcc/ChangeLog: * common.opt: Add -foffload-memory and its enum values. * coretypes.h (enum offload_memory): New. Diff: --- gcc/ChangeLog.omp | 6 ++++++ gcc/common.opt | 16 ++++++++++++++++ gcc/coretypes.h | 7 +++++++ gcc/doc/invoke.texi | 16 +++++++++++++++- 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 52306a5d516..f2bf2eb5b50 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,9 @@ +2023-08-23 Andrew Stubbs <a...@codesourcery.com> + + * common.opt: Add -foffload-memory and its enum values. + * coretypes.h (enum offload_memory): New. + * doc/invoke.texi: Document -foffload-memory. + 2022-10-19 Tobias Burnus <tob...@codesourcery.com> * omp-expand.cc (expand_omp_target): Fix OpenACC in case there diff --git a/gcc/common.opt b/gcc/common.opt index ad348844775..e19c4ef1166 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2339,6 +2339,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 1ac6f0abea3..938cfa93753 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -218,6 +218,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 3e2f9bd5b4b..a368d80a123 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 -ffreestanding -fgimple -fgnu-tm -fgnu89-inline -fhosted -flax-vector-conversions -fms-extensions --foffload=@var{arg} -foffload-options=@var{arg} +-foffload=@var{arg} -foffload-options=@var{arg} -foffload-memory=@var{arg} -fopenacc -fopenacc-dim=@var{geom} -fopenmp -fopenmp-simd -fopenmp-target-simd-clone@r{[}=@var{device-type}@r{]} -fpermitted-flt-eval-methods=@var{standard} @@ -2779,6 +2779,20 @@ Typical command lines are -foffload-options=amdgcn-amdhsa=-march=gfx906 @end smallexample +@opindex foffload-memory +@cindex OpenMP offloading memory modes +@item -foffload-memory=none +@itemx -foffload-memory=unified +@itemx -foffload-memory=pinned +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. + @opindex fopenacc @cindex OpenACC accelerator programming @item -fopenacc