https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127213
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIRST: There is an IMPLICIT FIRSTPRIVATE in the TESTCASE
Add MAP(VAR) to 'omp target' TO FIX THE TEST - with that fix:
* * *
For SELF_MAPS:
It seems as if the local variables should be link variables – but initialized
not at startup time (as not listed in the offload_vars table) but for each
target region, we can pass-through the pointer address on the device, i.e.
.omp_data_arr.31.var = &var
#... firstprivate(var)
var = .omp_data_i->var;
(*var) += 1;
That way, 'var' has the host address but we avoid all overhead. This can be
done locally in the target region, i.e. there is no need to have a global
variable on the device.
This should effectively match what we are already doing for normal variables.
CURRENTLY:
* With added missing 'map(var)':
All variants have the right values :-)
* For the address (&var) on the device side:
- Same as host without 'declare target' :-)
- Same as host with 'declare target link' :-)
- Difference value with 'declare target ENTER' :-(
TODO:
* Make 'declare target ENTER' works. (<<< wrong-code)
* Check whether LINK/no declare_target need to be changed in some way
for better code gen.
* * *
For GOMP_RUNTIME_USM=enabled
Requires 'MAP(VAR)' fix.
Same result as above, i.e.:
* Value is correct
* no declare_target and declare_target LINK have the host address
* declare_target ENTER has the device address
TODO: check whether the internal representation is fine (cf. also bug 127214)
but it seems to be OK otherwise.