mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 12:42:54 +08:00
feature: disable chunking when debugger is used
Added if conditions to enable useChunking flag by checking with ExecutionEnvironment::isDebuggingEnabled. Related-To: NEO-8164 Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3a9a835692
commit
40af0dddeb
@@ -491,6 +491,50 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest,
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryPrelimTest,
|
||||
whenCreateUnifiedMemoryAllocationWithChunkingModeSetToSharedAndSizeGreaterThanMinimalWithDebuggingEnabledThenChunkingIsNotUsed) {
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1};
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, DrmMockHelper::getEngineOrMemoryInstanceValue(0, 0)};
|
||||
|
||||
mock->memoryInfo.reset(new MemoryInfo(regionInfo, *mock));
|
||||
mock->queryEngineInfo();
|
||||
mock->ioctlCallsCount = 0;
|
||||
|
||||
mock->chunkingAvailable = true;
|
||||
mock->callBaseIsChunkingAvailable = true;
|
||||
|
||||
mock->chunkingMode = 0x01;
|
||||
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::Online);
|
||||
|
||||
AllocationProperties gpuProperties{0u,
|
||||
mock->minimalChunkingSize * 2,
|
||||
AllocationType::UNIFIED_SHARED_MEMORY,
|
||||
1u};
|
||||
gpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||
gpuProperties.usmInitialPlacement = GraphicsAllocation::UsmInitialPlacement::CPU;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(gpuProperties);
|
||||
|
||||
ASSERT_NE(allocation, nullptr);
|
||||
EXPECT_NE(static_cast<DrmAllocation *>(allocation)->getMmapPtr(), nullptr);
|
||||
EXPECT_NE(static_cast<DrmAllocation *>(allocation)->getMmapSize(), 0u);
|
||||
EXPECT_EQ(allocation->getAllocationOffset(), 0u);
|
||||
EXPECT_FALSE(allocation->storageInfo.isChunked);
|
||||
|
||||
const auto &createExt = mock->context.receivedCreateGemExt.value();
|
||||
EXPECT_EQ(1u, createExt.handle);
|
||||
|
||||
const auto &memRegions = createExt.memoryRegions;
|
||||
ASSERT_EQ(memRegions.size(), 2u);
|
||||
EXPECT_EQ(memRegions[0].memoryClass, drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM);
|
||||
EXPECT_EQ(memRegions[0].memoryInstance, 1u);
|
||||
EXPECT_EQ(memRegions[1].memoryClass, drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE);
|
||||
EXPECT_EQ(memRegions[1].memoryInstance, regionInfo[1].region.memoryInstance);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryPrelimTest,
|
||||
whenCreateUnifiedMemoryAllocationWithChunkingAndNoEnableBOChunkingPreferredLocationHintSetThenGemCreateExtIsUsedWithoutPreferredLocation) {
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
|
||||
@@ -5396,6 +5396,32 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest,
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest,
|
||||
givenMemoryAllocationWithMoreThanChunkingSizeAllowedWithDebuggingEnabledThenChunkingIsNotUsed) {
|
||||
VariableBackup<bool> backupChunkingCallParent{&mock->getChunkingAvailableCall.callParent, false};
|
||||
VariableBackup<bool> backupChunkingReturnValue{&mock->getChunkingAvailableCall.returnValue, true};
|
||||
VariableBackup<bool> backupChunkingModeCallParent{&mock->getChunkingModeCall.callParent, false};
|
||||
VariableBackup<uint32_t> backupChunkingModeReturnValue{&mock->getChunkingModeCall.returnValue, 0x3};
|
||||
|
||||
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success;
|
||||
AllocationData allocData;
|
||||
allocData.allFlags = 0;
|
||||
allocData.size = MemoryConstants::pageSize2M;
|
||||
allocData.type = AllocationType::BUFFER;
|
||||
allocData.rootDeviceIndex = rootDeviceIndex;
|
||||
allocData.storageInfo.memoryBanks = 0b11;
|
||||
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::Offline);
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
|
||||
EXPECT_EQ(false, static_cast<MockedMemoryInfo *>(mock->getMemoryInfo())->isChunkedUsed);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest,
|
||||
givenMemoryAllocationWithMoreThanChunkingSizeAllowedAndFailGemCreateExtThenNullptrIsReturned) {
|
||||
VariableBackup<bool> backupChunkingCallParent{&mock->getChunkingAvailableCall.callParent, false};
|
||||
|
||||
Reference in New Issue
Block a user