[perf]hipMalloc performance optimization

Change-Id: I6e8a918cc1c4cafad197b09e10755cd180e11ead
このコミットが含まれているのは:
Sarbojit Sarkar authored and Sarbojit Sarkar committed 2020-10-06 03:19:41 -04:00
1 親 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;
}