[perf]hipMalloc performance optimization

Change-Id: I6e8a918cc1c4cafad197b09e10755cd180e11ead
Этот коммит содержится в:
Sarbojit Sarkar
2020-08-24 13:15:28 -04:00
коммит произвёл Sarbojit Sarkar
родитель 8ab8fac173
Коммит 4a025e1a87
5 изменённых файлов: 125 добавлений и 9 удалений
+13
Просмотреть файл
@@ -595,9 +595,22 @@ bool TransferBufferFileCommand::validateMemory() {
bool CopyMemoryP2PCommand::validateMemory() {
amd::Device* queue_device = &queue()->device();
// Rocr backend maps memory from different devices by default and runtime doesn't need to track
// extra memory objects. Also P2P staging buffer always allocated
if (queue_device->settings().rocr_backend_) {
// Explicit allow access is needed for P2P access
const std::vector<Device*>& srcDevices = memory1_->getContext().devices();
const std::vector<Device*>& dstDevices = memory2_->getContext().devices();
if (srcDevices.size() == 1 && dstDevices.size() == 1) {
device::Memory* mem2 = memory2_->getDeviceMemory(*dstDevices[0]);
if (!mem2->getAllowedPeerAccess()) {
void* dst = mem2->owner()->getSvmPtr();
bool status = dstDevices[0]->deviceAllowAccess(dst);
mem2->setAllowedPeerAccess(true);
return status;
}
}
return true;
}