[OpenMP][Offload] Update the Logic for Configuring Auto Zero-Copy (#143638)
Summary: Currently the Auto Zero-Copy is enabled by checking every initialized device to ensure that no dGPU is attached to an APU. However, an APU is designed to comprise a homogeneous set of GPUs, therefore, it should be sufficient to check any device for configuring Auto Zero-Copy. In this PR, it checks the first initialized device in the list. The changes in this PR are to clearly reflect the design and logic of enabling the feature for further improving the readibility.
This commit is contained in:
parent
c2f0af514b
commit
bbe59e19b6
@ -286,16 +286,16 @@ void PluginManager::registerLib(__tgt_bin_desc *Desc) {
|
||||
}
|
||||
PM->RTLsMtx.unlock();
|
||||
|
||||
bool UseAutoZeroCopy = Plugins.size() > 0;
|
||||
bool UseAutoZeroCopy = false;
|
||||
|
||||
auto ExclusiveDevicesAccessor = getExclusiveDevicesAccessor();
|
||||
for (const auto &Device : *ExclusiveDevicesAccessor)
|
||||
UseAutoZeroCopy &= Device->useAutoZeroCopy();
|
||||
// APUs are homogeneous set of GPUs. Check the first device for
|
||||
// configuring Auto Zero-Copy.
|
||||
if (ExclusiveDevicesAccessor->size() > 0) {
|
||||
auto &Device = *(*ExclusiveDevicesAccessor)[0];
|
||||
UseAutoZeroCopy = Device.useAutoZeroCopy();
|
||||
}
|
||||
|
||||
// Auto Zero-Copy can only be currently triggered when the system is an
|
||||
// homogeneous APU architecture without attached discrete GPUs.
|
||||
// If all devices suggest to use it, change requirement flags to trigger
|
||||
// zero-copy behavior when mapping memory.
|
||||
if (UseAutoZeroCopy)
|
||||
addRequirements(OMPX_REQ_AUTO_ZERO_COPY);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user