gcc/ChangeLog:
* omp-low.cc (check_omp_nesting_restrictions): Skip warning for
target inside target if inner is reverse offload.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/target-device-ancestor-5.c: New test.
(cherry picked from commit
47554478a13f64bff1ee4b9bb0319ae63d42ca52)
+2022-07-05 Tobias Burnus <tobias@codesourcery.com>
+
+ Backport from mainline:
+ 2022-05-17 Tobias Burnus <tobias@codesourcery.com>
+
+ * omp-low.cc (check_omp_nesting_restrictions): Skip warning for
+ target inside target if inner is reverse offload.
+
2022-07-04 Tobias Burnus <tobias@codesourcery.com>
Backport from mainline:
}
else
{
+ if ((gimple_omp_target_kind (ctx->stmt)
+ == GF_OMP_TARGET_KIND_REGION)
+ && (gimple_omp_target_kind (stmt)
+ == GF_OMP_TARGET_KIND_REGION))
+ {
+ c = omp_find_clause (gimple_omp_target_clauses (stmt),
+ OMP_CLAUSE_DEVICE);
+ if (c && OMP_CLAUSE_DEVICE_ANCESTOR (c))
+ break;
+ }
warning_at (gimple_location (stmt), 0,
"%qs construct inside of %qs region",
stmt_name, ctx_stmt_name);
+2022-07-05 Tobias Burnus <tobias@codesourcery.com>
+
+ Backport from mainline:
+ 2022-05-17 Tobias Burnus <tobias@codesourcery.com>
+
+ * c-c++-common/gomp/target-device-ancestor-5.c: New test.
+
2022-07-04 Tobias Burnus <tobias@codesourcery.com>
Backport from mainline:
--- /dev/null
+#pragma omp requires reverse_offload /* { dg-message "sorry, unimplemented: 'reverse_offload' clause on 'requires' directive not supported yet" } */
+
+void
+foo ()
+{
+ /* Good nesting - as reverse offload */
+ #pragma omp target
+ #pragma omp target device(ancestor:1) /* valid -> no warning */ /* { dg-bogus "'target' construct inside of 'target' region" } */
+ { }
+
+ /* Bad nesting */
+ #pragma omp target
+ #pragma omp target /* { dg-warning "'target' construct inside of 'target' region" } */
+ #pragma omp target /* { dg-warning "'target' construct inside of 'target' region" } */
+ { }
+
+ /* Good nesting - as reverse offload */
+ #pragma omp target
+ #pragma omp target /* { dg-warning "'target' construct inside of 'target' region" } */
+ #pragma omp target device(ancestor:1) /* valid -> no warning */ /* { dg-bogus "'target' construct inside of 'target' region" } */
+ { }
+
+ #pragma omp target
+ #pragma omp target device(ancestor:1) /* valid -> no warning */ /* { dg-bogus "'target' construct inside of 'target' region" } */
+ #pragma omp target device(ancestor:1) /* { dg-error "OpenMP constructs are not allowed in target region with 'ancestor'" } */
+ { }
+
+}