Files
compute-runtime/runtime/memory_manager/host_ptr_manager.h
Artur Harasimiuk 40146291ad Update copyright headers
Updating files modified in 2018 only. Older files remain with old style
copyright header

Change-Id: Ic99f2e190ad74b4b7f2bd79dd7b9fa5fbe36ec92
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
2018-09-20 18:02:35 +02:00

39 lines
1.3 KiB
C++

/*
* Copyright (C) 2017-2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <map>
#include "runtime/helpers/aligned_memory.h"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/memory_manager/host_ptr_defines.h"
namespace OCLRT {
typedef std::map<const void *, FragmentStorage> HostPtrFragmentsContainer;
class HostPtrManager {
public:
static AllocationRequirements getAllocationRequirements(const void *inputPtr, size_t size);
OsHandleStorage populateAlreadyAllocatedFragments(AllocationRequirements &requirements, CheckedFragments *checkedFragments);
void storeFragment(FragmentStorage &fragment);
void storeFragment(AllocationStorageData &storageData);
void releaseHandleStorage(OsHandleStorage &fragments);
bool releaseHostPtr(const void *ptr);
FragmentStorage *getFragment(const void *inputPtr);
size_t getFragmentCount() { return partialAllocations.size(); }
FragmentStorage *getFragmentAndCheckForOverlaps(const void *inputPtr, size_t size, OverlapStatus &overlappingStatus);
private:
std::map<const void *, FragmentStorage>::iterator findElement(const void *ptr);
HostPtrFragmentsContainer partialAllocations;
std::mutex allocationsMutex;
};
} // namespace OCLRT