SWDEV-334233 - add support for p2p in windows

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: I9109120b5444c400e65cfff869cb36e876ffd1fc
Tento commit je obsažen v:
sdashmiz
2022-06-20 15:40:43 -04:00
odevzdal Shadi Dashmiz
rodič 782e0f2a8d
revize e176e27bf7
6 změnil soubory, kde provedl 41 přidání a 50 odebrání
+27
Zobrazit soubor
@@ -85,6 +85,7 @@ bool VirtualDevice::ActiveWait() const {
namespace amd {
amd::Monitor Device::lockP2P_("Lock P2P ON/OFF");
std::pair<const Isa*, const Isa*> Isa::supportedIsas() {
constexpr amd::Isa::Feature NONE = amd::Isa::Feature::Unsupported;
constexpr amd::Isa::Feature ANY = amd::Isa::Feature::Any;
@@ -709,6 +710,32 @@ bool Device::getDeviceIDs(cl_device_type deviceType, uint32_t numEntries, cl_dev
return true;
}
bool Device::enableP2P(amd::Device* ptrDev) {
assert(ptrDev != nullptr);
amd::ScopedLock lock(lockP2P_);
Device* peerDev = static_cast<Device*>(ptrDev);
if (std::find(enabled_p2p_devices_.begin(), enabled_p2p_devices_.end(), peerDev) ==
enabled_p2p_devices_.end()) {
enabled_p2p_devices_.push_back(peerDev);
// Update access to all old allocations
amd::MemObjMap::UpdateAccess(static_cast<amd::Device*>(this));
}
return true;
}
bool Device::disableP2P(amd::Device* ptrDev) {
assert(ptrDev != nullptr);
amd::ScopedLock lock(lockP2P_);
Device* peerDev = static_cast<Device*>(ptrDev);
//if device is present then remove
auto it = std::find(enabled_p2p_devices_.begin(), enabled_p2p_devices_.end(), peerDev);
if (it != enabled_p2p_devices_.end()) {
enabled_p2p_devices_.erase(it);
}
return true;
}
bool Device::UpdateStackSize(uint64_t stackSize) {
uint32_t maxMemPerThread = info().localMemSizePerCU_ / info().maxThreadsPerCU_;
if (maxMemPerThread < stackSize) {