mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
[1/n] Internal 4GB allocator
- Add new entry point in memory manager for internal allocations. - Route to allocate32BitGraphicsMemory - Add new enum to control memory region - Change mm to memoryManager Change-Id: I2ee069aa9baf7f69f652022e026569ec4fdb9d77
This commit is contained in:
committed by
sys_ocldev
parent
386675480f
commit
19c68a608f
@@ -152,6 +152,10 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemory(size_t size, const voi
|
||||
return graphicsAllocation;
|
||||
}
|
||||
|
||||
GraphicsAllocation *MemoryManager::createInternalGraphicsAllocation(const void *ptr, size_t allocationSize) {
|
||||
return allocate32BitGraphicsMemory(allocationSize, const_cast<void *>(ptr), MemoryType::INTERNAL_ALLOCATION);
|
||||
}
|
||||
|
||||
void MemoryManager::cleanGraphicsMemoryCreatedFromHostPtr(GraphicsAllocation *graphicsAllocation) {
|
||||
hostPtrManager.releaseHandleStorage(graphicsAllocation->fragmentsStorage);
|
||||
cleanOsHandles(graphicsAllocation->fragmentsStorage);
|
||||
|
||||
@@ -56,6 +56,11 @@ enum allocationType {
|
||||
REUSABLE_ALLOCATION
|
||||
};
|
||||
|
||||
enum MemoryType {
|
||||
EXTERNAL_ALLOCATION,
|
||||
INTERNAL_ALLOCATION
|
||||
};
|
||||
|
||||
struct AlignedMallocRestrictions {
|
||||
uintptr_t minAddress;
|
||||
};
|
||||
@@ -97,7 +102,7 @@ class MemoryManager {
|
||||
}
|
||||
virtual GraphicsAllocation *allocateGraphicsMemory(size_t size, const void *ptr, bool forcePin);
|
||||
|
||||
virtual GraphicsAllocation *allocate32BitGraphicsMemory(size_t size, void *ptr) = 0;
|
||||
virtual GraphicsAllocation *allocate32BitGraphicsMemory(size_t size, void *ptr, MemoryType memoryType) = 0;
|
||||
|
||||
virtual GraphicsAllocation *allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) = 0;
|
||||
|
||||
@@ -111,6 +116,8 @@ class MemoryManager {
|
||||
|
||||
virtual GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle) = 0;
|
||||
|
||||
virtual GraphicsAllocation *createInternalGraphicsAllocation(const void *ptr, size_t allocationSize);
|
||||
|
||||
virtual bool mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) { return false; };
|
||||
|
||||
virtual void *lockResource(GraphicsAllocation *graphicsAllocation) = 0;
|
||||
@@ -172,7 +179,7 @@ class MemoryManager {
|
||||
|
||||
GraphicsAllocation *createGraphicsAllocationWithRequiredBitness(size_t size, void *ptr, bool forcePin) {
|
||||
if (force32bitAllocations && is64bit) {
|
||||
return allocate32BitGraphicsMemory(size, ptr);
|
||||
return allocate32BitGraphicsMemory(size, ptr, MemoryType::EXTERNAL_ALLOCATION);
|
||||
} else {
|
||||
if (ptr) {
|
||||
return allocateGraphicsMemory(size, ptr, forcePin);
|
||||
|
||||
@@ -69,7 +69,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemory64kb(size_t s
|
||||
return allocateGraphicsMemory(alignUp(size, MemoryConstants::pageSize64k), MemoryConstants::pageSize64k, forcePin, false);
|
||||
}
|
||||
|
||||
GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemory(size_t size, void *ptr) {
|
||||
GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemory(size_t size, void *ptr, MemoryType memoryType) {
|
||||
if (ptr) {
|
||||
auto allocationSize = alignSizeWholePage(reinterpret_cast<void *>(ptr), size);
|
||||
auto gpuVirtualAddress = allocator32Bit->allocate(allocationSize);
|
||||
|
||||
@@ -63,7 +63,7 @@ class OsAgnosticMemoryManager : public MemoryManager {
|
||||
~OsAgnosticMemoryManager() override;
|
||||
GraphicsAllocation *allocateGraphicsMemory(size_t size, size_t alignment, bool forcePin, bool uncacheable) override;
|
||||
GraphicsAllocation *allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin) override;
|
||||
GraphicsAllocation *allocate32BitGraphicsMemory(size_t size, void *ptr) override;
|
||||
GraphicsAllocation *allocate32BitGraphicsMemory(size_t size, void *ptr, MemoryType memoryType) override;
|
||||
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, bool requireSpecificBitness, bool reuseBO) override;
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle) override { return nullptr; }
|
||||
GraphicsAllocation *allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) override;
|
||||
|
||||
Reference in New Issue
Block a user