Hi! On 2019-11-15T13:43:04+0100, Jakub Jelinek <ja...@redhat.com> wrote: > On Fri, Nov 15, 2019 at 12:38:06PM +0000, Andrew Stubbs wrote: >> On 15/11/2019 12:21, Jakub Jelinek wrote: >> > I'm surprised by the set acc_mem_shared 0, I thought gcn is a shared memory >> > offloading target. >> >> APUs, such as Carizzo are shared memory. DGPUs, such as Fiji and Vega, have >> their own memory. A DGPU can access host memory, provided that it has been >> set up just so, but that is very slow, and I don't know of a way to do that >> without still having to copy the program data into that special region.
For a few years already, Nvidia GPUs/drivers have been supporting what they call Unified Memory, where the driver/kernel automatically handles the movement of memory pages between host/device memories. Given some reasonable pre-fetching logic (either automatic in the driver/kernel, or "guided" by the compiler/runtime), this reportedly achieves good performance -- or even better performance than manually-managed memory copying, as really only the data pages accessed (plus pre-fetched) will be copied. For example, see <https://dl.acm.org/citation.cfm?id=3356141> "Compiler assisted hybrid implicit and explicit GPU memory management under unified address space", which I've recently (SuperComputing 2019) have seen presented, or other publications. This is not currently implemented in GCC, but could/should be at some point. This (or even a mixture of manual-discrete/automatic-shared?) would then be an execution mode of libgomp/plugin, selected at run-time? > Ah, that is going to be interesting e.g. for > #pragma omp requires unified_shared_memory > My plan was that for this the TU constructor would call some libgomp > library function that in the end would when loading plugins ensure that > only shared memory supporting plugins are loaded. If the gcn plugin > will support shared memory only conditionally, we'll need some interfaces to > ensure that. (I have not yet completely digested the relevant OpenMP features.) Grüße Thomas
signature.asc
Description: PGP signature