feature: add debug flag to control usage of heap extended for USM Host
Related-To: NEO-7665 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
c0fcdef03e
commit
06bd405e88
|
@ -491,6 +491,7 @@ DECLARE_DEBUG_VARIABLE(bool, ForceDefaultGrfCompilationMode, false, "Adds build
|
|||
DECLARE_DEBUG_VARIABLE(bool, ForceLargeGrfCompilationMode, false, "Adds build option -cl-intel-256-GRF-per-thread to force kernel compilation in Large-GRF mode")
|
||||
DECLARE_DEBUG_VARIABLE(bool, EnableConcurrentSharedCrossP2PDeviceAccess, false, "Enables the concurrent use between host and peer devices of shared-allocations ")
|
||||
DECLARE_DEBUG_VARIABLE(bool, AllocateSharedAllocationsInHeapExtended, false, "When enabled driver can allocate shared unified memory allocation in heap extended. (0 - disable, 1 - enable)")
|
||||
DECLARE_DEBUG_VARIABLE(bool, AllocateHostAllocationsInHeapExtended, true, "When enabled driver can allocate host unified memory allocation in heap extended. (0 - disable, 1 - enable)")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceAutoGrfCompilationMode, -1, "Adds build option -*-intel-enable-auto-large-GRF-mode to force kernel compilation")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceOCLVersion, 0, "Force specific OpenCL API version")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceOCL21FeaturesSupport, -1, "-1: default, 0: disable, 1:enable. Force support of OpenCL 2.0 and OpenCL 2.1 API features")
|
||||
|
|
|
@ -1967,7 +1967,8 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData &
|
|||
auto totalSizeToAlloc = alignedSize + alignment;
|
||||
uint64_t preferredAddress = 0;
|
||||
auto gfxPartition = getGfxPartition(allocationData.rootDeviceIndex);
|
||||
if (allocationData.flags.isUSMHostAllocation && gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0u) {
|
||||
auto canAllocateInHeapExtended = DebugManager.flags.AllocateHostAllocationsInHeapExtended.get();
|
||||
if (canAllocateInHeapExtended && allocationData.flags.isUSMHostAllocation && gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0u) {
|
||||
|
||||
preferredAddress = acquireGpuRange(totalSizeToAlloc, allocationData.rootDeviceIndex, HeapIndex::HEAP_EXTENDED);
|
||||
}
|
||||
|
|
|
@ -514,6 +514,7 @@ ForceDummyBlitWa = -1
|
|||
DetectIndirectAccessInKernel = -1
|
||||
OptimizeIoqBarriersHandling = -1
|
||||
AllocateSharedAllocationsInHeapExtended = 0
|
||||
AllocateHostAllocationsInHeapExtended = 1
|
||||
DirectSubmissionControllerMaxTimeout = -1
|
||||
ExitOnSubmissionNumber = -1
|
||||
ExitOnSubmissionMode = 0
|
||||
ExitOnSubmissionMode = 0
|
||||
|
|
|
@ -6466,6 +6466,30 @@ TEST_F(DrmMemoryManagerTest, given48bAddressSpaceCpuAnd57bGpuWhenAllocatingHostU
|
|||
memoryManager->freeGraphicsMemory(hostUSM);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, given57bAddressSpaceCpuAndGpuAndDisabledHeapExtendedUsageForUsmHostWhenAllocatingHostUSMThenAddressFromExtendedHeapIsNotUsed) {
|
||||
if (defaultHwInfo->capabilityTable.gpuAddressSpace < maxNBitValue(57)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.AllocateHostAllocationsInHeapExtended.set(false);
|
||||
VariableBackup<bool> backupCaptureExtendedPointers(&SysCalls::mmapCaptureExtendedPointers, true);
|
||||
VariableBackup<bool> backupAllowExtendedPointers(&SysCalls::mmapAllowExtendedPointers, true);
|
||||
SysCalls::mmapCapturedExtendedPointers.clear();
|
||||
std::vector<MemoryRegion> regionInfo(1);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
|
||||
auto &drm = static_cast<DrmMockCustom &>(memoryManager->getDrm(mockRootDeviceIndex));
|
||||
drm.memoryInfo.reset(new MemoryInfo(regionInfo, drm));
|
||||
AllocationProperties allocationProperties(mockRootDeviceIndex, MemoryConstants::cacheLineSize, AllocationType::SVM_CPU, {});
|
||||
allocationProperties.flags.isUSMHostAllocation = true;
|
||||
auto hostUSM = memoryManager->allocateGraphicsMemoryInPreferredPool(allocationProperties, nullptr);
|
||||
EXPECT_NE(nullptr, hostUSM);
|
||||
|
||||
EXPECT_EQ(0u, SysCalls::mmapCapturedExtendedPointers.size());
|
||||
memoryManager->freeGraphicsMemory(hostUSM);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, given57bAddressSpaceCpuAndGpuWhenAllocatingSharedUSMThenAddressFromExtendedHeapIsPassedAsHintAndSetAsGpuAddressAndReservedAddress) {
|
||||
if (defaultHwInfo->capabilityTable.gpuAddressSpace < maxNBitValue(57)) {
|
||||
GTEST_SKIP();
|
||||
|
|
Loading…
Reference in New Issue