[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

@@ -68,10 +68,10 @@ SvmMapOperation *SVMAllocsManager::MapOperationsTracker::get(const void *regionP
return &iter->second;
}
void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver) {
void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver, uint32_t requestedTypesMask) {
std::unique_lock<SpinLock> lock(mtx);
for (auto &allocation : this->SVMAllocs.allocations) {
if (allocation.second.memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY) {
if (allocation.second.memoryType & requestedTypesMask) {
commandStreamReceiver.makeResident(*allocation.second.gpuAllocation);
}
}

View File

@@ -18,11 +18,11 @@ class Device;
class GraphicsAllocation;
class MemoryManager;
enum class InternalMemoryType : uint32_t {
SVM = 0,
DEVICE_UNIFIED_MEMORY,
HOST_UNIFIED_MEMORY,
NOT_SPECIFIED
enum InternalMemoryType : uint32_t {
NOT_SPECIFIED = 0b0,
SVM = 0b1,
DEVICE_UNIFIED_MEMORY = 0b10,
HOST_UNIFIED_MEMORY = 0b100,
};
struct SvmAllocationData {
@@ -89,7 +89,7 @@ class SVMAllocsManager {
void insertSvmMapOperation(void *regionSvmPtr, size_t regionSize, void *baseSvmPtr, size_t offset, bool readOnlyMap);
void removeSvmMapOperation(const void *regionSvmPtr);
SvmMapOperation *getSvmMapOperation(const void *regionPtr);
void makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver);
void makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver, uint32_t requestedTypesMask);
protected:
void *createZeroCopySvmAllocation(size_t size, const SvmAllocationProperties &svmProperties);