Files
compute-runtime/core/helpers/heap_helper.cpp
Filip Hazubski 026d1324a4 Move AllocationProperties::noDeviceSpecified to SubDevice
Change-Id: Idfc1efa4e39168ca32b613201aac8ccd0aa3219a
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
2019-11-25 14:23:37 +01:00

31 lines
1.3 KiB
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/helpers/heap_helper.h"
#include "core/memory_manager/graphics_allocation.h"
#include "runtime/memory_manager/internal_allocation_storage.h"
#include "runtime/memory_manager/memory_manager.h"
namespace NEO {
GraphicsAllocation *HeapHelper::getHeapAllocation(size_t heapSize, size_t alignment, uint32_t rootDeviceIndex) {
auto allocation = this->storageForReuse->obtainReusableAllocation(heapSize, GraphicsAllocation::AllocationType::INTERNAL_HEAP);
if (allocation) {
return allocation.release();
}
NEO::AllocationProperties properties{rootDeviceIndex, true /* allocateMemory*/, alignment,
GraphicsAllocation::AllocationType::INTERNAL_HEAP,
isMultiOsContextCapable /* multiOsContextCapable */,
false,
NEO::SubDevice::unspecifiedSubDeviceIndex};
return this->memManager->allocateGraphicsMemoryWithProperties(properties);
}
void HeapHelper::storeHeapAllocation(GraphicsAllocation *heapAllocation) {
this->storageForReuse->storeAllocation(std::unique_ptr<NEO::GraphicsAllocation>(heapAllocation), NEO::AllocationUsage::REUSABLE_ALLOCATION);
}
} // namespace NEO