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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
For 'adjust_args':

void f0(int *);
#pragma omp declare variant(f0) match(construct={dispatch}) \
              adjust_args(need_device_ptr: x)
void f(int *x);

void g(int *a, int dev) {
  #pragma omp dispatch device(dev)
    f(a);
}


This becomes the following - which seems to be okay-ish. However,
(1) It would be presumably good to also add location data to omp_*_device calls
(2) I am not sure whether it makes more sense to have the location in in the
  call line (here: line 8) – or in the '#pragma' line (line 7).

Regarding (2):
* In the latter case, it would first step to '#pragma' to do
adjust_args/append_args/device setting; then, second step, executing the
function call, and then as third step, move the source line back to the pragma
line and do the clean up.
* In the former case, one step would do all the library calls, function call
and cleanup in one debugger step.

void g (int * a, int dev)
[f.c:6:25] {
  [f.c:7:11] #pragma omp dispatch
    {
      {
        int D.2982;
        void * D.2983;

        D.2982 = __builtin_omp_get_default_device ();
        __builtin_omp_set_default_device (dev);
        [f.c:8:5] D.2983 = __builtin_omp_get_mapped_ptr (a, dev);
        [f.c:8:5] f0 (D.2983);
        __builtin_omp_set_default_device (D.2982);
      }
    }
}

Reply via email to