SWDEV-333557 - 1.Add support for IPC memory to enable hipIpcGetMemHandle() and hipIpcOpenMemHandle() in PAL path. Set interprocess flag for device allocations in HIP PAL. 2.Fix PAL IPC path with ResourceCache and SubAllocation 3.Minor fixes for IpcBuffer constructor and IpcAttach 4.Remove redundant checks that may go wrong

Change-Id: Ie9d99847c7c2c7b3b2aaefaaf60d23bf71b68635
Tá an tiomantas seo le fáil i:
Todd tiantuo Li tiomanta 2023-07-12 17:49:32 -04:00
1 tuismitheoir 6b89980fb2
tiomantas 8434feed16
5 comhad athraithe
+25 -13

Níor tháinig aon chomhaid le do chuardach

+7 -1
Féach ar an gComhad
@@ -1040,7 +1040,8 @@ bool Resource::CreateIpc(CreateParams* params) {
if (nullptr == memRef_) {
return false;
}
params->owner_->setSvmPtr(reinterpret_cast<void*>(memRef_->iMem()->Desc().gpuVirtAddr));
offset_ += params->owner_->getOffset();
params->owner_->setSvmPtr(reinterpret_cast<void*>(memRef_->iMem()->Desc().gpuVirtAddr + offset_));
return true;
}
@@ -1178,6 +1179,7 @@ bool Resource::CreateSvm(CreateParams* params, Pal::gpusize svmPtr) {
params->owner_->setSvmPtr(
reinterpret_cast<void*>(memRef_->iMem()->Desc().gpuVirtAddr + subOffset_));
offset_ += static_cast<size_t>(subOffset_);
params->owner_->setOffset(offset_);
}
return true;
}
@@ -2055,6 +2057,10 @@ bool CoarseMemorySubAllocator::CreateChunk(const Pal::IGpuMemory* reserved_va) {
createInfo.heaps[0] = Pal::GpuHeapInvisible;
createInfo.heaps[1] = Pal::GpuHeapLocal;
createInfo.mallPolicy = static_cast<Pal::GpuMemMallPolicy>(device_->settings().mallPolicy_);
if (amd::IS_HIP) {
//set interprocess for IPC memory support
createInfo.flags.interprocess = 1;
}
GpuMemoryReference* mem_ref = GpuMemoryReference::Create(*device_, createInfo);
if (mem_ref != nullptr) {
// Workaround: some chunk memory are not guaranteed to be resident during initial allocation.