Hi Tobias, to my eye this looks fine. I would appreciate, if you could add some tests for errors on the fortran side, esp. where modules are involved. But no must.
Ok for mainline. Thanks for the patch. - Andre On Sat, 21 Sep 2024 23:37:33 +0200 Tobias Burnus <tbur...@baylibre.com> wrote: > Add support of the 'self_maps' clause in 'omp requires', > an OpenMP 6 feature but added here mostly as part of the > on-going improvement of the unified-shared memory (USM) handling. > > Comments, remarks concerns before I commit it? > > * * * > > Regarding USM, there is on one hand the hardware: > > - some hardware cannot access the host memory at all > - other hardware can access it, but either only through > an interconnect or via page migration on page fault > - on the third time of hardware, a host and device share > the same memory controller > > For the latter, a 'map' never does make sense, but for > the second case, it depends on the details whether it is > better to do mapping or directly accessing the memory > (i.e. via interconnect or page migration). > > On the compile-time side, the user can demand: > - no requirement > - 'requires unified_shared_memory' (= memory has to be accessible > but the implementation can still do mapping for explicit maps) > - 'requires shared_memory' - mapping is strictly not permitted. > - other hints using compiler flags > > And for the runtime, the result depends on the actual hardware, > the compile-time wishes, environment variables what is done. > > * * * > > Currently, the runtime never maps with USM, i.e. both act the same. > At least using an environment variable, I would consider enabling > mapping - one could also consider to have it always do mappings, > except for self_maps. > > On the compile side, we need to handle implicit 'declare target' > better - as it currently leads to separate memory. Using 'link', > we could point to the host memory (at least for 'self_maps'). > > And before we can enable USM by default for integrated/APU devices, > we need to solve some issues with 'link' (→ posted link) and for > those, 'map' has to be honored. > > Those are 5.x follow up tasks, but having 'self_maps' available, > completes the what-does-the-user-want part. > > Tobias > > PS: There is also the 'self' modifier to the map clause, working > on a per-variable granularity. However, this like several other > 6.0 items is completely out of scope of the current USM work. > > PPS: See > also https://gcc.gnu.org/pipermail/gcc-patches/2024-September/663209.html and > the patch associated set, posted > at https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655946.html -- Andre Vehreschild * Email: vehre ad gmx dot de