public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/114754] New: [OpenMP] Missing 'uses_allocators' diagnostic
@ 2024-04-17 12:03 burnus at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu.org @ 2024-04-17 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114754
           Summary: [OpenMP] Missing 'uses_allocators' diagnostic
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Cf. https://github.com/SOLLVE/sollve_vv/pull/802

"LLVM error:
 error: allocator must be specified in the 'uses_allocators' clause
adding uses_allocators(omp_default_mem_alloc) fixes the problem"

OpenMP spec has under 'Restrictions to the *target* construct are as follows:'

"Memory allocators that do not appear in a *uses_allocators* clause cannot
appear as an allocator in an *allocate* clause or be used in the *target*
region unless a *requires* directive with the *dynamic_allocators* clause is
present in the same compilation unit."

Example snippets, based on the sollve_vv testcase.

The OG13 patch only diagnose the issue in the last/4th directive;
clang diagnoses both the 'allocate' clause variants (2nd + 4th) but neither
diagnoses the 1st/4th one.

* * *

   omp_allocator_handle_t al = omp_init_allocator(omp_default_mem_space, 0,
NULL);
   #pragma omp target
   {
     int *y = omp_alloc(omp_default_mem_alloc, sizeof(1));
   }

   #pragma omp target allocate(omp_default_mem_alloc:x) firstprivate(x)
map(from: device_result)
   {
      for (int i = 0; i < N; i++)
        x += i;
      device_result = x;
   }

   #pragma omp target firstprivate(al)
   {
     int *y = omp_alloc(al, sizeof(1));
   }

   #pragma omp target allocate(al:x) firstprivate(x) map(from: device_result)
   {
      for (int i = 0; i < N; i++)
        x += i;
      device_result = x;
   }

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

only message in thread, other threads:[~2024-04-17 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 12:03 [Bug middle-end/114754] New: [OpenMP] Missing 'uses_allocators' diagnostic burnus at gcc dot gnu.org

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).