Files
compute-runtime/runtime/memory_manager/host_ptr_manager.h
Maciej Plewka 9e52684f5b Change namespace from OCLRT to NEO
Change-Id: If965c79d70392db26597aea4c2f3b7ae2820fe96
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
2019-03-26 15:48:19 +01:00

38 lines
1.4 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "runtime/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, CheckedFragments *checkedFragments);
FragmentStorage *getFragmentAndCheckForOverlaps(const void *inputPtr, size_t size, OverlapStatus &overlappingStatus);
RequirementsStatus checkAllocationsForOverlapping(MemoryManager &memoryManager, AllocationRequirements *requirements, CheckedFragments *checkedFragments);
HostPtrFragmentsContainer::iterator findElement(const void *ptr);
HostPtrFragmentsContainer partialAllocations;
std::recursive_mutex allocationsMutex;
};
} // namespace NEO