[perf]hipMalloc performance optimization
Change-Id: I6e8a918cc1c4cafad197b09e10755cd180e11ead
Этот коммит содержится в:
коммит произвёл
Sarbojit Sarkar
родитель
8ab8fac173
Коммит
4a025e1a87
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user