Files
compute-runtime/runtime/os_interface/linux/drm_limited_range.cpp
Kai Chen 85b60dff0f Linux GPU address allocator for devices with reduced address space
Code implementation of GPU address allocator for devices with reduced
address space.

Change-Id: Ieb0412c5930fdd71f90741055cf89c0338b01133
Signed-off-by: Kai Chen <kai.chen@intel.com>
2018-11-19 10:20:25 +01:00

31 lines
822 B
C++

/*
* Copyright (C) 2017-2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/os_interface/linux/allocator_helper.h"
#include "runtime/os_interface/linux/drm_limited_range.h"
#include "runtime/os_interface/debug_settings_manager.h"
using namespace OCLRT;
OCLRT::AllocatorLimitedRange::AllocatorLimitedRange(uint64_t base, uint64_t size) : base(base), size(size), heapAllocator(std::make_unique<HeapAllocator>(base, size)) {
}
uint64_t OCLRT::AllocatorLimitedRange::allocate(size_t &size) {
if (size >= this->size) {
return 0llu;
}
return this->heapAllocator->allocate(size);
}
void OCLRT::AllocatorLimitedRange::free(uint64_t ptr, size_t size) {
this->heapAllocator->free(ptr, size);
}
uint64_t OCLRT::AllocatorLimitedRange::getBase() const {
return base;
}