This is the front-end portion of the Unified Shared Memory implementation.
It checks that -foffload-memory isn't set to an incompatible mode.
Backport of the patch posted at
https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591351.html
gcc/c/ChangeLog:
* c-parser.c (c_parser_omp_requires): Check compatibility of
-foffload-memory option with requires directive.
gcc/cp/ChangeLog:
* parser.c (cp_parser_omp_requires): Check compatibility of
-foffload-memory option with requires directive.
gcc/fortran/ChangeLog:
* openmp.c (gfc_match_omp_requires): Check compatibility of
-foffload-memory option with requires directive.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/usm-1.c: New test.
* gfortran.dg/gomp/usm-1.f90: New test.
+2022-03-10 Andrew Stubbs <ams@codesourcery.com>
+
+ Backport of the patch posted at
+ https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591351.html
+
+ * c-parser.c (c_parser_omp_requires): Check compatibility of
+ -foffload-memory option with requires directive.
+
2022-02-27 Tobias Burnus <tobias@codesourcery.com>
Backported from master:
if (!strcmp (p, "unified_address"))
this_req = OMP_REQUIRES_UNIFIED_ADDRESS;
else if (!strcmp (p, "unified_shared_memory"))
+ {
this_req = OMP_REQUIRES_UNIFIED_SHARED_MEMORY;
+
+ if (flag_offload_memory != OFFLOAD_MEMORY_UNIFIED
+ && flag_offload_memory != OFFLOAD_MEMORY_NONE)
+ error_at (cloc,
+ "unified_shared_memory is incompatible with the "
+ "selected -foffload-memory option");
+ flag_offload_memory = OFFLOAD_MEMORY_UNIFIED;
+ }
else if (!strcmp (p, "dynamic_allocators"))
this_req = OMP_REQUIRES_DYNAMIC_ALLOCATORS;
else if (!strcmp (p, "reverse_offload"))
+2022-03-10 Andrew Stubbs <ams@codesourcery.com>
+
+ Backport of the patch posted at
+ https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591351.html
+
+ * parser.c (cp_parser_omp_requires): Check compatibility of
+ -foffload-memory option with requires directive.
+
2022-02-27 Tobias Burnus <tobias@codesourcery.com>
Backported from master:
if (!strcmp (p, "unified_address"))
this_req = OMP_REQUIRES_UNIFIED_ADDRESS;
else if (!strcmp (p, "unified_shared_memory"))
+ {
this_req = OMP_REQUIRES_UNIFIED_SHARED_MEMORY;
+
+ if (flag_offload_memory != OFFLOAD_MEMORY_UNIFIED
+ && flag_offload_memory != OFFLOAD_MEMORY_NONE)
+ error_at (cloc,
+ "unified_shared_memory is incompatible with the "
+ "selected -foffload-memory option");
+ flag_offload_memory = OFFLOAD_MEMORY_UNIFIED;
+ }
else if (!strcmp (p, "dynamic_allocators"))
this_req = OMP_REQUIRES_DYNAMIC_ALLOCATORS;
else if (!strcmp (p, "reverse_offload"))
+2022-03-10 Andrew Stubbs <ams@codesourcery.com>
+
+ Backport of the patch posted at
+ https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591351.html
+
+ * openmp.c (gfc_match_omp_requires): Check compatibility of
+ -foffload-memory option with requires directive.
+
2022-03-09 Abid Qadeer <abidh@codesourcery.com>
Backport of a patch posted at
#include "gomp-constants.h"
#include "options.h"
#include "target-memory.h" /* For gfc_encode_character. */
+#include "options.h"
/* Match an end of OpenMP directive. End of OpenMP directive is optional
whitespace, followed by '\n' or comment '!'. In the special case where a
requires_clause = OMP_REQ_UNIFIED_SHARED_MEMORY;
if (requires_clauses & OMP_REQ_UNIFIED_SHARED_MEMORY)
goto duplicate_clause;
+
+ if (flag_offload_memory != OFFLOAD_MEMORY_UNIFIED
+ && flag_offload_memory != OFFLOAD_MEMORY_NONE)
+ gfc_error_now ("unified_shared_memory at %C is incompatible with "
+ "the selected -foffload-memory option");
+ flag_offload_memory = OFFLOAD_MEMORY_UNIFIED;
}
else if (gfc_match (clauses[3]) == MATCH_YES)
{
+2022-03-10 Andrew Stubbs <ams@codesourcery.com>
+
+ Backport of the patch posted at
+ https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591351.html
+
+ * c-c++-common/gomp/usm-1.c: New test.
+ * gfortran.dg/gomp/usm-1.f90: New test.
+
2022-03-09 Abid Qadeer <abidh@codesourcery.com>
Backport of a patch posted at
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-foffload-memory=pinned" } */
+
+#pragma omp requires unified_shared_memory /* { dg-error "unified_shared_memory is incompatible with the selected -foffload-memory option" } */
--- /dev/null
+! { dg-do compile }
+! { dg-additional-options "-foffload-memory=pinned" }
+
+!$omp requires unified_shared_memory ! { dg-error "unified_shared_memory at .* is incompatible with the selected -foffload-memory option" }
+
+end