[5/n] Unified Shared Memory

- Add kernel support for host um allocations
- During make resident call choose only appropriate resources for residency
- change resource types to binary bit friendly values
- enhance memory manager to only make resident compatible types

Related-To: NEO-3148

Change-Id: Ic711a4425a0d8db151a335e0357440312dc09b7e
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
Mrozek, Michal
2019-06-17 13:31:23 +02:00
committed by sys_ocldev
parent cfdade26c2
commit 2e8e625024
8 changed files with 66 additions and 14 deletions

View File

@@ -944,6 +944,11 @@ void Kernel::clearSvmKernelExecInfo() {
void Kernel::setUnifiedMemoryProperty(cl_kernel_exec_info infoType, bool infoValue) {
if (infoType == CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL) {
this->unifiedMemoryControls.indirectDeviceAllocationsAllowed = infoValue;
return;
}
if (infoType == CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL) {
this->unifiedMemoryControls.indirectHostAllocationsAllowed = infoValue;
return;
}
}
@@ -1009,8 +1014,9 @@ void Kernel::makeResident(CommandStreamReceiver &commandStreamReceiver) {
gtpinNotifyMakeResident(this, &commandStreamReceiver);
if (unifiedMemoryControls.indirectDeviceAllocationsAllowed) {
this->getContext().getSVMAllocsManager()->makeInternalAllocationsResident(commandStreamReceiver);
if (unifiedMemoryControls.indirectDeviceAllocationsAllowed ||
unifiedMemoryControls.indirectHostAllocationsAllowed) {
this->getContext().getSVMAllocsManager()->makeInternalAllocationsResident(commandStreamReceiver, unifiedMemoryControls.generateMask());
}
}
@@ -2224,4 +2230,15 @@ void Kernel::addAllocationToCacheFlushVector(uint32_t argIndex, GraphicsAllocati
}
}
}
uint32_t Kernel::UnifiedMemoryControls::generateMask() {
uint32_t resourceMask = 0u;
if (this->indirectHostAllocationsAllowed) {
resourceMask |= InternalMemoryType::HOST_UNIFIED_MEMORY;
}
if (this->indirectDeviceAllocationsAllowed) {
resourceMask |= InternalMemoryType::DEVICE_UNIFIED_MEMORY;
}
return resourceMask;
}
} // namespace NEO