Bind allocations in csr under debug flag

Related-To: NEO-4732

Change-Id: Ie2a609dc614d2ad1ee698940fe6f2527d6e92854
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-07-17 14:09:42 +02:00
committed by sys_ocldev
parent 56a0eb7d0f
commit acc4a44b15
4 changed files with 21 additions and 0 deletions

View File

@ -151,6 +151,15 @@ TEST(GraphicsAllocationTest, givenDefaultAllocationWhenGettingNumHandlesThenOneI
EXPECT_EQ(1u, graphicsAllocation.getNumGmms());
}
TEST(GraphicsAllocationTest, givenAlwaysResidentAllocationWhenUpdateTaskCountThenItIsNotUpdated) {
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, 0u);
graphicsAllocation.updateResidencyTaskCount(10u, 0u);
EXPECT_EQ(graphicsAllocation.getResidencyTaskCount(0u), GraphicsAllocation::objectAlwaysResident);
}
TEST(GraphicsAllocationTest, givenDefaultGraphicsAllocationWhenInternalHandleIsBeingObtainedThenZeroIsReturned) {
MockGraphicsAllocation graphicsAllocation;
EXPECT_EQ(0llu, graphicsAllocation.peekInternalHandle(nullptr));

View File

@ -81,6 +81,7 @@ DirectSubmissionEnableDebugBuffer = 0
DirectSubmissionDiagnosticExecutionCount = 30
DirectSubmissionDisableCacheFlush = 0
DirectSubmissionDisableMonitorFence = 0
BindAllAllocations = 0
EnableNullHardware = 0
ForceLinearImages = 0
ForceSLML3Config = 0

View File

@ -109,6 +109,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionEnableDebugBuffer, 0, "0: diagno
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionDiagnosticExecutionCount, 30, "Number of executions of EnableDebugBuffer modes within diagnostic run")
DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionDisableCacheFlush, false, "Disable dispatching cache flush commands")
DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionDisableMonitorFence, false, "Disable dispatching monitor fence commands")
DECLARE_DEBUG_VARIABLE(bool, BindAllAllocations, false, "Bind all allocations during flush")
/*PERFORMANCE FLAGS*/
DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForBuffers, false, "When active all buffer allocations will not share memory with CPU.")

View File

@ -7,6 +7,8 @@
#include "shared/source/os_interface/linux/drm_memory_operations_handler_bind.h"
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/device/device.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
#include "shared/source/os_interface/linux/drm_buffer_object.h"
@ -81,6 +83,14 @@ void DrmMemoryOperationsHandlerBind::mergeWithResidencyContainer(OsContext *osCo
for (auto gfxAllocation = residencyContainer.begin(); gfxAllocation != residencyContainer.end();) {
if ((*gfxAllocation)->isAlwaysResident(osContext->getContextId())) {
gfxAllocation = residencyContainer.erase(gfxAllocation);
} else if (DebugManager.flags.BindAllAllocations.get()) {
auto drmAllocation = static_cast<DrmAllocation *>(*gfxAllocation);
auto &drmContextIds = static_cast<const OsContextLinux *>(osContext)->getDrmContextIds();
for (uint32_t drmIterator = 0u; drmIterator < drmContextIds.size(); drmIterator++) {
drmAllocation->makeBOsResident(osContext->getContextId(), drmContextIds[drmIterator], drmIterator, nullptr, true);
}
drmAllocation->updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, osContext->getContextId());
gfxAllocation = residencyContainer.erase(gfxAllocation);
} else {
gfxAllocation++;
}