mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Reverse logic of creating Memory Manager - part 3
-Move a Device::getEnabled64kbPages method's logic to the Memory Manager constructor Change-Id: Ide88898000e5817a79f9a6ad5dfc9d680bec0533 Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
cc13045ddd
commit
9ecb3193af
@@ -16,6 +16,7 @@
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/basic_math.h"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/kernel_commands.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
@@ -31,10 +32,21 @@
|
||||
#include <algorithm>
|
||||
|
||||
namespace OCLRT {
|
||||
MemoryManager::MemoryManager(bool enable64kbpages, bool enableLocalMemory, ExecutionEnvironment &executionEnvironment)
|
||||
: allocator32Bit(nullptr), enable64kbpages(enable64kbpages), localMemorySupported(enableLocalMemory),
|
||||
executionEnvironment(executionEnvironment), hostPtrManager(std::make_unique<HostPtrManager>()),
|
||||
multiContextResourceDestructor(std::make_unique<DeferredDeleter>()) {}
|
||||
MemoryManager::MemoryManager(ExecutionEnvironment &executionEnvironment) : allocator32Bit(nullptr),
|
||||
executionEnvironment(executionEnvironment), hostPtrManager(std::make_unique<HostPtrManager>()),
|
||||
multiContextResourceDestructor(std::make_unique<DeferredDeleter>()) {
|
||||
this->localMemorySupported = false;
|
||||
this->enable64kbpages = false;
|
||||
|
||||
auto hwInfo = executionEnvironment.getHardwareInfo();
|
||||
if (hwInfo != nullptr) {
|
||||
this->localMemorySupported = HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily).getEnableLocalMemory(*hwInfo);
|
||||
this->enable64kbpages = OSInterface::osEnabled64kbPages && hwInfo->capabilityTable.ftr64KBpages;
|
||||
}
|
||||
if (DebugManager.flags.Enable64kbpages.get() > -1) {
|
||||
this->enable64kbpages = DebugManager.flags.Enable64kbpages.get() != 0;
|
||||
}
|
||||
}
|
||||
|
||||
MemoryManager::~MemoryManager() {
|
||||
for (auto &engine : registeredEngines) {
|
||||
|
||||
@@ -93,7 +93,7 @@ class MemoryManager {
|
||||
RetryInNonDevicePool
|
||||
};
|
||||
|
||||
MemoryManager(bool enable64kbpages, bool enableLocalMemory, ExecutionEnvironment &executionEnvironment);
|
||||
MemoryManager(ExecutionEnvironment &executionEnvironment);
|
||||
|
||||
virtual ~MemoryManager();
|
||||
MOCKABLE_VIRTUAL void *allocateSystemMemory(size_t size, size_t alignment);
|
||||
@@ -185,7 +185,7 @@ class MemoryManager {
|
||||
void setDefaultEngineIndex(uint32_t index) { defaultEngineIndex = index; }
|
||||
virtual bool copyMemoryToAllocation(GraphicsAllocation *graphicsAllocation, const void *memoryToCopy, uint32_t sizeToCopy) const;
|
||||
static HeapIndex selectHeap(const GraphicsAllocation *allocation, bool hasPointer, bool isFullRangeSVM);
|
||||
static std::unique_ptr<MemoryManager> createMemoryManager(bool enable64KBpages, bool enableLocalMemory, ExecutionEnvironment &exeEnv);
|
||||
static std::unique_ptr<MemoryManager> createMemoryManager(ExecutionEnvironment &executionEnvironment);
|
||||
virtual void *reserveCpuAddressRange(size_t size) = 0;
|
||||
virtual void releaseReservedCpuAddressRange(void *reserved, size_t size) = 0;
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ class OsAgnosticMemoryManager : public MemoryManager {
|
||||
public:
|
||||
using MemoryManager::allocateGraphicsMemory;
|
||||
|
||||
OsAgnosticMemoryManager(bool enable64kbPages, bool enableLocalMemory, ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(enable64kbPages, enableLocalMemory, false, executionEnvironment) {}
|
||||
OsAgnosticMemoryManager(ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(false, executionEnvironment) {}
|
||||
|
||||
OsAgnosticMemoryManager(bool enable64kbPages, bool enableLocalMemory, bool aubUsage, ExecutionEnvironment &executionEnvironment) : MemoryManager(enable64kbPages, enableLocalMemory, executionEnvironment) {
|
||||
allocator32Bit = std::unique_ptr<Allocator32bit>(create32BitAllocator(aubUsage));
|
||||
OsAgnosticMemoryManager(bool aubUsage, ExecutionEnvironment &executionEnvironment) : MemoryManager(executionEnvironment) {
|
||||
allocator32Bit.reset(create32BitAllocator(aubUsage));
|
||||
gfxPartition.init(platformDevices[0]->capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user