mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Do not initiate limited range allocator if range above max64 bit address.
Change-Id: If7b0a83c5e5326f2b16d32533d8631ff6ff877cc Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
1bc5f7b142
commit
840d81c9fc
@ -85,7 +85,7 @@ DrmMemoryManager::~DrmMemoryManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrmMemoryManager::initInternalRangeAllocator(size_t gpuRange) {
|
void DrmMemoryManager::initInternalRangeAllocator(size_t gpuRange) {
|
||||||
if (gpuRange < MemoryConstants::max48BitAddress || !DebugManager.flags.EnableHostPtrTracking.get()) {
|
if (gpuRange < MemoryConstants::max64BitAppAddress || !DebugManager.flags.EnableHostPtrTracking.get()) {
|
||||||
// set the allocator with the whole reduced address space range - pageSize (base address) to
|
// set the allocator with the whole reduced address space range - pageSize (base address) to
|
||||||
// avoid starting address of the heap to be 0, which could be interpreted as invalid address
|
// avoid starting address of the heap to be 0, which could be interpreted as invalid address
|
||||||
// nullPtr.
|
// nullPtr.
|
||||||
|
@ -103,6 +103,7 @@ class TestedDrmMemoryManager : public MemoryManagerCreate<DrmMemoryManager> {
|
|||||||
|
|
||||||
DrmGemCloseWorker *getgemCloseWorker() { return this->gemCloseWorker.get(); }
|
DrmGemCloseWorker *getgemCloseWorker() { return this->gemCloseWorker.get(); }
|
||||||
void forceLimitedRangeAllocator(uint64_t range) { initInternalRangeAllocator(range); }
|
void forceLimitedRangeAllocator(uint64_t range) { initInternalRangeAllocator(range); }
|
||||||
|
void releaseLimitedAddressRangeAllocator() { limitedGpuAddressRangeAllocator.reset(nullptr); }
|
||||||
|
|
||||||
Allocator32bit *getDrmInternal32BitAllocator() const { return internal32bitAllocator.get(); }
|
Allocator32bit *getDrmInternal32BitAllocator() const { return internal32bitAllocator.get(); }
|
||||||
AllocatorLimitedRange *getDrmLimitedRangeAllocator() const { return limitedGpuAddressRangeAllocator.get(); }
|
AllocatorLimitedRange *getDrmLimitedRangeAllocator() const { return limitedGpuAddressRangeAllocator.get(); }
|
||||||
|
@ -3115,6 +3115,22 @@ TEST_F(DrmMemoryManagerBasic, ifLimitedRangeAllocatorAvailableWhenAskedForAlloca
|
|||||||
limitedRangeAllocator->free(ptr, size);
|
limitedRangeAllocator->free(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmMemoryManagerBasic, givenAddressRangeBelowMax64BitAddressThenLimitedRangeAllocatorIsInitialized) {
|
||||||
|
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false, false, false, executionEnvironment));
|
||||||
|
memoryManager->releaseLimitedAddressRangeAllocator();
|
||||||
|
EXPECT_EQ(nullptr, memoryManager->getDrmLimitedRangeAllocator());
|
||||||
|
memoryManager->forceLimitedRangeAllocator(MemoryConstants::max64BitAppAddress - 1);
|
||||||
|
EXPECT_NE(nullptr, memoryManager->getDrmLimitedRangeAllocator());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmMemoryManagerBasic, givenAddressRangeMax64BitWhenMemoryManagerIsCreatedThenLimitedRangeAllocatorIsNotInitialized) {
|
||||||
|
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false, false, false, executionEnvironment));
|
||||||
|
memoryManager->releaseLimitedAddressRangeAllocator();
|
||||||
|
EXPECT_EQ(nullptr, memoryManager->getDrmLimitedRangeAllocator());
|
||||||
|
memoryManager->forceLimitedRangeAllocator(MemoryConstants::max64BitAppAddress);
|
||||||
|
EXPECT_EQ(nullptr, memoryManager->getDrmLimitedRangeAllocator());
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DrmMemoryManagerTest, givenLimitedRangeAllocatorWithNonZeroBaseAndSizeWhenAskedForBaseThenCorrectBaseIsReturned) {
|
TEST_F(DrmMemoryManagerTest, givenLimitedRangeAllocatorWithNonZeroBaseAndSizeWhenAskedForBaseThenCorrectBaseIsReturned) {
|
||||||
uint64_t size = 100u;
|
uint64_t size = 100u;
|
||||||
uint64_t base = 0x23000;
|
uint64_t base = 0x23000;
|
||||||
|
Reference in New Issue
Block a user