[Openmp-commits] [openmp] [OpenMP][libomptarget] Enable automatic unified shared memory executi… (PR #75999)

via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 19 19:52:01 PST 2023

carlobertolli wrote:

> I like that we get auto-magic for these things.
> High-level questions:
> 1. Why is this not a device property?
> 2. Why is this not just an implicit OMP_REQ_UNIFIED_SHARED_MEMORY?

Good questions.
For 1. I am not expecting an APU to have any PCI-e (or other mean) attached GPUs, at this point in time.
For 2. We need to distinguish the handling of global variables (not yet supported by this patch). When an application is built with requires usm, global variables in the device binary become references to the original host globals. This doesn't happen when not building with requires unified_shared_memory, hence the need to differentiate between "automatic" zero-copy and user-requested zero-copy.
In auto zero-copy, global variables need to be copied between their host and device items, following the map(always,.. constructs requested by the user (remember, the user did not use requires usm, so they are required to use map clauses for everything, including global variables).

Thanks for the rest of the style comments, really appreciated. I will apply the changes tomorrow.


More information about the Openmp-commits mailing list