mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Restrict system memory allocations to certain address range
Change-Id: Ibe8c1183368ce48f2c820d0f1a71f0b15703ffcd
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "runtime/memory_manager/host_ptr_manager.h"
|
||||
#include "runtime/memory_manager/graphics_allocation.h"
|
||||
#include "runtime/os_interface/32bit_memory.h"
|
||||
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/utilities/tag_allocator_base.h"
|
||||
|
||||
#include <cstdint>
|
||||
@@ -56,6 +56,10 @@ enum allocationType {
|
||||
REUSABLE_ALLOCATION
|
||||
};
|
||||
|
||||
struct AlignedMallocRestrictions {
|
||||
uintptr_t minAddress;
|
||||
};
|
||||
|
||||
constexpr size_t paddingBufferSize = 2 * MemoryConstants::megaByte;
|
||||
|
||||
class AllocationsList : public IDList<GraphicsAllocation, true, true> {
|
||||
@@ -207,6 +211,18 @@ class MemoryManager {
|
||||
bool isAsyncDeleterEnabled() const;
|
||||
virtual bool isMemoryBudgetExhausted() const;
|
||||
|
||||
virtual AlignedMallocRestrictions *getAlignedMallocRestrictions() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOCKABLE_VIRTUAL void *alignedMallocWrapper(size_t bytes, size_t alignment) {
|
||||
return ::alignedMalloc(bytes, alignment);
|
||||
}
|
||||
|
||||
MOCKABLE_VIRTUAL void alignedFreeWrapper(void *ptr) {
|
||||
::alignedFree(ptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
std::recursive_mutex mtx;
|
||||
std::unique_ptr<TagAllocatorBase> profilingTimeStampAllocator;
|
||||
|
||||
Reference in New Issue
Block a user