https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103384

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Would
--- gcc/omp-general.c.jj        2021-10-15 11:59:16.135683948 +0200
+++ gcc/omp-general.c   2021-11-23 15:45:32.761468592 +0100
@@ -1487,16 +1487,22 @@ omp_context_selector_matches (tree ctx)
                      continue;
                    if (!strcmp (prop, "host"))
                      {
+#ifdef ACCEL_COMPILER
+                       return 0;
+#else
                        if (omp_maybe_offloaded ())
                          ret = -1;
                        continue;
+#endif
                      }
                    if (!strcmp (prop, "nohost"))
                      {
+#ifndef ACCEL_COMPILER
                        if (omp_maybe_offloaded ())
                          ret = -1;
                        else
                          return 0;
+#endif
                        continue;
                      }
                    int r = 0;
fix this?  In ACCEL_COMPILER we know that it is nohost, so for host we should
return 0 even if we earlier on the host side said it might be offloaded and so
defer, and for host we know it is ok.

I don't really like the test, in the SOLLVE test it just relies on no host
fallback without ensuring it, in your attached test omp_get_num_devices ()
doesn't guarantee no host fallback either.  Check omp_is_initial_device () in
the target region instead?

Reply via email to