Files
compute-runtime/runtime/memory_manager/host_ptr_manager.h
Jobczyk, Lukasz 3fe91e6d69 Move host_ptr_defines to the core dir
Related-To: NEO-3677

Change-Id: Ic973fb65f584563cc3fbcfa20eb81fe687dc5435
Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
2019-09-11 09:35:55 +02:00

38 lines
1.3 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "core/memory_manager/host_ptr_defines.h"
#include <map>
#include <mutex>
namespace NEO {
using HostPtrFragmentsContainer = std::map<const void *, FragmentStorage>;
class MemoryManager;
class HostPtrManager {
public:
FragmentStorage *getFragment(const void *inputPtr);
OsHandleStorage prepareOsStorageForAllocation(MemoryManager &memoryManager, size_t size, const void *ptr);
void releaseHandleStorage(OsHandleStorage &fragments);
bool releaseHostPtr(const void *ptr);
void storeFragment(AllocationStorageData &storageData);
void storeFragment(FragmentStorage &fragment);
protected:
static AllocationRequirements getAllocationRequirements(const void *inputPtr, size_t size);
OsHandleStorage populateAlreadyAllocatedFragments(AllocationRequirements &requirements);
FragmentStorage *getFragmentAndCheckForOverlaps(const void *inputPtr, size_t size, OverlapStatus &overlappingStatus);
RequirementsStatus checkAllocationsForOverlapping(MemoryManager &memoryManager, AllocationRequirements *requirements);
HostPtrFragmentsContainer::iterator findElement(const void *ptr);
HostPtrFragmentsContainer partialAllocations;
std::recursive_mutex allocationsMutex;
};
} // namespace NEO