Disable host ptr tracking for GEN12LP
Related-To: NEO-3661 Change-Id: I1774aad8ef32f294192a9b679cb9f66e4091198c Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
parent
cd198fac0a
commit
632134db30
|
@ -51,6 +51,7 @@ struct RuntimeCapabilityTable {
|
|||
bool supportCacheFlushAfterWalker;
|
||||
bool supportsImages;
|
||||
bool supportsDeviceEnqueue;
|
||||
bool hostPtrTrackingEnabled;
|
||||
};
|
||||
|
||||
struct HardwareCapabilities {
|
||||
|
|
|
@ -56,6 +56,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
|||
INTERNAL_HOST_MEMORY,
|
||||
KERNEL_ISA,
|
||||
LINEAR_STREAM,
|
||||
MAP_ALLOCATION,
|
||||
MCS,
|
||||
PIPE,
|
||||
PREEMPTION,
|
||||
|
|
|
@ -64,7 +64,8 @@ const RuntimeCapabilityTable EHL::capabilityTable{
|
|||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true // supportsDeviceEnqueue
|
||||
true, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable EHL::workaroundTable = {};
|
||||
|
|
|
@ -66,7 +66,8 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{
|
|||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true // supportsDeviceEnqueue
|
||||
true, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable ICLLP::workaroundTable = {};
|
||||
|
|
|
@ -65,7 +65,8 @@ const RuntimeCapabilityTable LKF::capabilityTable{
|
|||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true // supportsDeviceEnqueue
|
||||
true, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable LKF::workaroundTable = {};
|
||||
|
|
|
@ -66,7 +66,8 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{
|
|||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true // supportsDeviceEnqueue
|
||||
true, // supportsDeviceEnqueue
|
||||
false // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable TGLLP::workaroundTable = {};
|
||||
|
|
|
@ -70,7 +70,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{
|
|||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true // supportsDeviceEnqueue
|
||||
true, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable BDW::workaroundTable = {};
|
||||
|
|
|
@ -67,7 +67,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{
|
|||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
false // supportsDeviceEnqueue
|
||||
false, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable BXT::workaroundTable = {};
|
||||
|
|
|
@ -62,7 +62,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{
|
|||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true // supportsDeviceEnqueue
|
||||
true, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable CFL::workaroundTable = {};
|
||||
|
|
|
@ -62,7 +62,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{
|
|||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
false // supportsDeviceEnqueue
|
||||
false, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable GLK::workaroundTable = {};
|
||||
|
|
|
@ -62,7 +62,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{
|
|||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true // supportsDeviceEnqueue
|
||||
true, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
WorkaroundTable KBL::workaroundTable = {};
|
||||
|
|
|
@ -70,7 +70,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{
|
|||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true // supportsDeviceEnqueue
|
||||
true, // supportsDeviceEnqueue
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
WorkaroundTable SKL::workaroundTable = {};
|
||||
FeatureTable SKL::featureTable = {};
|
||||
|
|
|
@ -283,7 +283,7 @@ Buffer *Buffer::create(Context *context,
|
|||
|
||||
if (memoryProperties.flags.useHostPtr) {
|
||||
if (!zeroCopyAllowed && !isHostPtrSVM) {
|
||||
AllocationProperties properties{rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::MAP_ALLOCATION, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
||||
mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ Image *Image::create(Context *context,
|
|||
zeroCopy = true;
|
||||
}
|
||||
if (memory) {
|
||||
AllocationProperties properties{rootDeviceIndex, false, hostPtrMinSize, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{rootDeviceIndex, false, hostPtrMinSize, GraphicsAllocation::AllocationType::MAP_ALLOCATION, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
||||
mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ Image *Image::create(Context *context,
|
|||
} else {
|
||||
errcodeRet = cmdQ->enqueueWriteImage(image, CL_TRUE, ©Origin[0], ©Region[0],
|
||||
hostPtrRowPitch, hostPtrSlicePitch,
|
||||
hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
hostPtr, mapAllocation, 0, nullptr, nullptr);
|
||||
}
|
||||
} else {
|
||||
image->transferData(memory->getUnderlyingBuffer(), imgInfo.rowPitch, imgInfo.slicePitch,
|
||||
|
|
|
@ -332,7 +332,8 @@ void *MemObj::getBasePtrForMap(uint32_t rootDeviceIndex) {
|
|||
} else {
|
||||
auto memory = memoryManager->allocateSystemMemory(getSize(), MemoryConstants::pageSize);
|
||||
setAllocatedMapPtr(memory);
|
||||
AllocationProperties properties{rootDeviceIndex, false, getSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{rootDeviceIndex, false, getSize(), GraphicsAllocation::AllocationType::MAP_ALLOCATION, false};
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, memory);
|
||||
setMapAllocation(allocation);
|
||||
return getAllocatedMapPtr();
|
||||
|
|
|
@ -260,6 +260,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
|
||||
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::IMAGE:
|
||||
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
|
||||
case GraphicsAllocation::AllocationType::PIPE:
|
||||
case GraphicsAllocation::AllocationType::SHARED_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::SHARED_IMAGE:
|
||||
|
@ -278,6 +279,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
|
||||
case GraphicsAllocation::AllocationType::FILL_PATTERN:
|
||||
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
|
||||
case GraphicsAllocation::AllocationType::MCS:
|
||||
case GraphicsAllocation::AllocationType::PREEMPTION:
|
||||
case GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER:
|
||||
|
@ -340,7 +342,7 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData &
|
|||
return allocateGraphicsMemoryForImage(allocationData);
|
||||
}
|
||||
if (allocationData.type == GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR &&
|
||||
(!peekExecutionEnvironment().isFullRangeSvm() || !DebugManager.flags.EnableHostPtrTracking.get())) {
|
||||
(!peekExecutionEnvironment().isFullRangeSvm() || !isHostPointerTrackingEnabled())) {
|
||||
auto allocation = allocateGraphicsMemoryForNonSvmHostPtr(allocationData);
|
||||
if (allocation) {
|
||||
allocation->setFlushL3Required(allocationData.flags.flushL3);
|
||||
|
@ -485,4 +487,11 @@ void *MemoryManager::getReservedMemory(size_t size, size_t alignment) {
|
|||
return reservedMemory;
|
||||
}
|
||||
|
||||
bool MemoryManager::isHostPointerTrackingEnabled() {
|
||||
if (DebugManager.flags.EnableHostPtrTracking.get() != -1) {
|
||||
return !!DebugManager.flags.EnableHostPtrTracking.get();
|
||||
}
|
||||
return (peekExecutionEnvironment().getHardwareInfo()->capabilityTable.hostPtrTrackingEnabled | is32bit);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -140,6 +140,8 @@ class MemoryManager {
|
|||
::alignedFree(ptr);
|
||||
}
|
||||
|
||||
MOCKABLE_VIRTUAL bool isHostPointerTrackingEnabled();
|
||||
|
||||
const ExecutionEnvironment &peekExecutionEnvironment() const { return executionEnvironment; }
|
||||
|
||||
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType,
|
||||
|
|
|
@ -87,7 +87,7 @@ DECLARE_DEBUG_VARIABLE(bool, DisableConcurrentBlockExecution, false, "disables c
|
|||
DECLARE_DEBUG_VARIABLE(bool, UseNoRingFlushesKmdMode, true, "Windows only, passes flag to KMD that informs KMD to not emit any ring buffer flushes.")
|
||||
DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForUseHostPtr, false, "When active all buffer allocations created with CL_MEM_USE_HOST_PTR flag will not share memory with CPU.")
|
||||
DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForBuffers, false, "When active all buffer allocations will not share memory with CPU.")
|
||||
DECLARE_DEBUG_VARIABLE(bool, EnableHostPtrTracking, true, "Enable host ptr tracking")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableHostPtrTracking, -1, "Enable host ptr tracking: -1 - default platform setting, 0 - disabled, 1 - enabled")
|
||||
DECLARE_DEBUG_VARIABLE(bool, DisableDcFlushInEpilogue, false, "Disable DC flush in epilogue")
|
||||
|
||||
/*FEATURE FLAGS*/
|
||||
|
|
|
@ -143,7 +143,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(co
|
|||
|
||||
wddmAllocation->setDefaultGmm(gmm);
|
||||
|
||||
if (!createWddmAllocation(wddmAllocation.get(), wddmAllocation->getAlignedCpuPtr())) {
|
||||
if (!createWddmAllocation(wddmAllocation.get(), nullptr)) {
|
||||
delete gmm;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ TEST_F(CreateAllocationForHostSurfaceTest, givenReadOnlyHostPointerWhenAllocatio
|
|||
size_t size = sizeof(memory);
|
||||
HostPtrSurface surface(const_cast<char *>(memory), size, true);
|
||||
|
||||
if (device->isFullRangeSvm()) {
|
||||
if (device->isFullRangeSvm() && gmockMemoryManager->isHostPointerTrackingEnabled()) {
|
||||
EXPECT_CALL(*gmockMemoryManager, populateOsHandles(::testing::_))
|
||||
.Times(1)
|
||||
.WillOnce(::testing::Return(MemoryManager::AllocationStatus::InvalidHostPointer));
|
||||
|
@ -446,7 +446,7 @@ TEST_F(CreateAllocationForHostSurfaceTest, givenReadOnlyHostPointerWhenAllocatio
|
|||
size_t size = sizeof(memory);
|
||||
HostPtrSurface surface(const_cast<char *>(memory), size, false);
|
||||
|
||||
if (device->isFullRangeSvm()) {
|
||||
if (device->isFullRangeSvm() && gmockMemoryManager->isHostPointerTrackingEnabled()) {
|
||||
EXPECT_CALL(*gmockMemoryManager, populateOsHandles(::testing::_))
|
||||
.Times(1)
|
||||
.WillOnce(::testing::Return(MemoryManager::AllocationStatus::InvalidHostPointer));
|
||||
|
|
|
@ -293,7 +293,7 @@ TEST(Buffer, givenHostPtrPassedToBufferCreateWhenMemUseHostPtrFlagisSetAndBuffer
|
|||
auto mapAllocation = buffer->getMapAllocation();
|
||||
EXPECT_NE(nullptr, mapAllocation);
|
||||
EXPECT_EQ(offsetedPtr, mapAllocation->getUnderlyingBuffer());
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, mapAllocation->getAllocationType());
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::MAP_ALLOCATION, mapAllocation->getAllocationType());
|
||||
|
||||
alignedFree(ptr);
|
||||
}
|
||||
|
|
|
@ -1183,7 +1183,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenFullGpuAddressSpaceWhenAllocateGr
|
|||
bool requiresL3Flush = GetParam();
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
executionEnvironment.setHwInfo(platformDevices[0]);
|
||||
if (!executionEnvironment.isFullRangeSvm()) {
|
||||
if (!executionEnvironment.isFullRangeSvm() || !executionEnvironment.getHardwareInfo()->capabilityTable.hostPtrTrackingEnabled) {
|
||||
return;
|
||||
}
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
|
@ -1201,7 +1201,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenFullGpuAddressSpaceWhenAllocateGr
|
|||
|
||||
TEST_P(OsAgnosticMemoryManagerWithParams, givenDisabledHostPtrTrackingWhenAllocateGraphicsMemoryForHostPtrIsCalledThenAllocationWithoutFragmentsIsCreated) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableHostPtrTracking.set(false);
|
||||
DebugManager.flags.EnableHostPtrTracking.set(0);
|
||||
|
||||
bool requiresL3Flush = GetParam();
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
|
@ -1945,3 +1945,23 @@ TEST(MemoryManagerTest, whenMemoryManagerReturnsNullptrThenAllocateGlobalsSurfac
|
|||
allocation = allocateGlobalsSurface(&context, &device, 1024, false, true, nullptr);
|
||||
EXPECT_EQ(nullptr, allocation);
|
||||
}
|
||||
|
||||
HWTEST_F(MemoryAllocatorTest, givenMemoryManagerWhenEnableHostPtrTrackingFlagIsSetTo0ThenHostPointerTrackingIsDisabled) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.EnableHostPtrTracking.set(0);
|
||||
EXPECT_FALSE(memoryManager->isHostPointerTrackingEnabled());
|
||||
}
|
||||
|
||||
HWTEST_F(MemoryAllocatorTest, givenMemoryManagerWhenEnableHostPtrTrackingFlagIsNotSetTo1ThenHostPointerTrackingIsEnabled) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.EnableHostPtrTracking.set(1);
|
||||
EXPECT_TRUE(memoryManager->isHostPointerTrackingEnabled());
|
||||
}
|
||||
|
||||
HWTEST_F(MemoryAllocatorTest, givenMemoryManagerWhenEnableHostPtrTrackingFlagIsSetNotSetThenHostPointerTrackingDependsOnCapabilityTable) {
|
||||
if (is32bit) {
|
||||
EXPECT_TRUE(memoryManager->isHostPointerTrackingEnabled());
|
||||
} else {
|
||||
EXPECT_EQ(executionEnvironment->getHardwareInfo()->capabilityTable.hostPtrTrackingEnabled, memoryManager->isHostPointerTrackingEnabled());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ HWTEST_F(EnqueueBufferWindowsTest, givenMisalignedHostPtrWhenEnqueueReadBufferCa
|
|||
if (kernel->getKernelInfo().kernelArgInfo[1].kernelArgPatchInfoVector[0].size == sizeof(uint64_t)) {
|
||||
auto pKernelArg = (uint64_t *)(kernel->getCrossThreadData() +
|
||||
kernel->getKernelInfo().kernelArgInfo[1].kernelArgPatchInfoVector[0].crossthreadOffset);
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(alignDown(misalignedPtr, 4)), *pKernelArg);
|
||||
EXPECT_EQ(alignDown(gpuVa, 4), static_cast<uint64_t>(*pKernelArg));
|
||||
EXPECT_EQ(*pKernelArg, surfaceStateDst.getSurfaceBaseAddress());
|
||||
|
||||
} else if (kernel->getKernelInfo().kernelArgInfo[1].kernelArgPatchInfoVector[0].size == sizeof(uint32_t)) {
|
||||
|
|
|
@ -108,7 +108,7 @@ RenderCompressedBuffersEnabled = -1
|
|||
AUBDumpAllocsOnEnqueueReadOnly = 0
|
||||
AUBDumpForceAllToLocalMemory = 0
|
||||
EnableCacheFlushAfterWalker = -1
|
||||
EnableHostPtrTracking = 1
|
||||
EnableHostPtrTracking = -1
|
||||
DisableDcFlushInEpilogue = 0
|
||||
OverrideInvalidEngineWithDefault = 0
|
||||
EnableFormatQuery = 0
|
||||
|
|
Loading…
Reference in New Issue