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

            Bug ID: 103384
           Summary: [OpenMP] declare variant with device={kind(nohost)}
                    does not use GPU, kind(gpu) works
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 51861
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51861&action=edit
Testcase, fails as is (if omp_get_num_devices() > 0) and '{kind(nohost)}' -
works when later is changed to "match(device={kind(gpu)})"

Observed with
https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/declare_target/test_declare_target_device_type_nohost.c

For that testcase with nvptx offloading, with

  #pragma omp declare variant(target_function) match(device={kind(gpu)})

target_function() is called and the code is executed on the GPU
(value a[0] = 5 (host function 'update') + 1 (device function
'target_function') == 6).


However, using kind(nohost), i.e.

  #pragma omp declare variant(target_function) match(device={kind(nohost)})

will *not* execute 'target_function' (thus: a[0] == 10 = 2*5 (host function
'update').


Expected: both {kind(nohost)} and {kind(gpu)} are executed on the GPU.

Reply via email to