Bug 114754 - [OpenMP] Missing 'uses_allocators' diagnostic
Summary: [OpenMP] Missing 'uses_allocators' diagnostic
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, diagnostic, openmp
Depends on:
Blocks:
 
Reported: 2024-04-17 12:03 UTC by Tobias Burnus
Modified: 2024-04-17 12:03 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2024-04-17 12:03:44 UTC
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;
   }