Thomas Schwinge wrote:
PS: My plans
for the future is to permit more fine tuning and some default changes.
In particular, if a device is an APU, it should by default use self
mapping. Additionally, the user should have the possibility to switch
between mapping and self mapping for devices.
Also with a command-line flag and/or environment variable in addition to
source-code-level '#pragma omp requires unified_shared_memory' etc., I
suppose?
I noticed that I hadn't replied to this.
My idea is to have an environment variable to toggle between:
* default (e.g. unset) - use normal mapping, unless the system is an APU
(cf. currently commented function in the plugins)
* Use self-maps – if supported by hardware, even if not an APU
* Use mapping - even if it is an APU
* And possibly, for experiments, force-self-maps, even if the detection
mechanism does not recognize a USM system [not sure this makes sense],
either because it is one but not recognized or some GPUs have it.
For the auto-APU thing, we need to still map 'declare target' variables
(cf. PR 115279), however, for 'requires self_maps' it is supposed to work
with 'declare target link' as that indirection is then initialized to the
host address (cf. PR 122205).
Regarding the command line, in principle yes, also to support OpenACC, but
it is rather unclear how we want to have this implemented. For C/C++,
Jakub and I were (OpenMP only) thinking of -include-line similar to
'-include <file>' such that '-include-line '#pragma omp requires self_maps'
works. Otherwise, we also had -foffload-memory=... ideas floating around.
But the command line one is surely a backburner topic; the in-compiler
support for 'requires self_maps' (+ USM as well?) to move to 'link'
and to fix the case when USM is supposed to be used (e.g. APUs) but
'declare target' variables are lingering around will be of higher
priority.
Tobias