Revert "performance: remove not needed logic"
This reverts commit 0ec4e9333d
.
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
parent
f9228ad11b
commit
5dc01e5764
|
@ -165,6 +165,7 @@ void CommandStreamReceiver::makeResident(GraphicsAllocation &gfxAllocation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->dispatchMode == DispatchMode::batchedDispatch) {
|
if (this->dispatchMode == DispatchMode::batchedDispatch) {
|
||||||
|
checkForNewResources(submissionTaskCount, gfxAllocation.getTaskCount(osContext->getContextId()), gfxAllocation);
|
||||||
if (!gfxAllocation.isResident(osContext->getContextId())) {
|
if (!gfxAllocation.isResident(osContext->getContextId())) {
|
||||||
this->totalMemoryUsed += gfxAllocation.getUnderlyingBufferSize();
|
this->totalMemoryUsed += gfxAllocation.getUnderlyingBufferSize();
|
||||||
}
|
}
|
||||||
|
@ -987,6 +988,17 @@ void CommandStreamReceiver::printDeviceIndex() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommandStreamReceiver::checkForNewResources(TaskCountType submittedTaskCount, TaskCountType allocationTaskCount, GraphicsAllocation &gfxAllocation) {
|
||||||
|
if (useNewResourceImplicitFlush) {
|
||||||
|
if (allocationTaskCount == GraphicsAllocation::objectNotUsed && !GraphicsAllocation::isIsaAllocationType(gfxAllocation.getAllocationType())) {
|
||||||
|
newResources = true;
|
||||||
|
if (debugManager.flags.ProvideVerboseImplicitFlush.get()) {
|
||||||
|
printf("New resource detected of type %llu\n", static_cast<unsigned long long>(gfxAllocation.getAllocationType()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CommandStreamReceiver::checkImplicitFlushForGpuIdle() {
|
bool CommandStreamReceiver::checkImplicitFlushForGpuIdle() {
|
||||||
if (useGpuIdleImplicitFlush) {
|
if (useGpuIdleImplicitFlush) {
|
||||||
if (this->taskCount == *getTagAddress()) {
|
if (this->taskCount == *getTagAddress()) {
|
||||||
|
|
|
@ -543,6 +543,7 @@ class CommandStreamReceiver {
|
||||||
protected:
|
protected:
|
||||||
void cleanupResources();
|
void cleanupResources();
|
||||||
void printDeviceIndex();
|
void printDeviceIndex();
|
||||||
|
void checkForNewResources(TaskCountType submittedTaskCount, TaskCountType allocationTaskCount, GraphicsAllocation &gfxAllocation);
|
||||||
bool checkImplicitFlushForGpuIdle();
|
bool checkImplicitFlushForGpuIdle();
|
||||||
void downloadTagAllocation(TaskCountType taskCountToWait);
|
void downloadTagAllocation(TaskCountType taskCountToWait);
|
||||||
void printTagAddressContent(TaskCountType taskCountToWait, int64_t waitTimeout, bool start);
|
void printTagAddressContent(TaskCountType taskCountToWait, int64_t waitTimeout, bool start);
|
||||||
|
|
|
@ -99,6 +99,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||||
using BaseClass::CommandStreamReceiver::baseWaitFunction;
|
using BaseClass::CommandStreamReceiver::baseWaitFunction;
|
||||||
using BaseClass::CommandStreamReceiver::bindingTableBaseAddressRequired;
|
using BaseClass::CommandStreamReceiver::bindingTableBaseAddressRequired;
|
||||||
using BaseClass::CommandStreamReceiver::canUse4GbHeaps;
|
using BaseClass::CommandStreamReceiver::canUse4GbHeaps;
|
||||||
|
using BaseClass::CommandStreamReceiver::checkForNewResources;
|
||||||
using BaseClass::CommandStreamReceiver::checkImplicitFlushForGpuIdle;
|
using BaseClass::CommandStreamReceiver::checkImplicitFlushForGpuIdle;
|
||||||
using BaseClass::CommandStreamReceiver::cleanupResources;
|
using BaseClass::CommandStreamReceiver::cleanupResources;
|
||||||
using BaseClass::CommandStreamReceiver::clearColorAllocation;
|
using BaseClass::CommandStreamReceiver::clearColorAllocation;
|
||||||
|
|
|
@ -33,6 +33,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
|
||||||
public:
|
public:
|
||||||
using CommandStreamReceiver::activePartitions;
|
using CommandStreamReceiver::activePartitions;
|
||||||
using CommandStreamReceiver::baseWaitFunction;
|
using CommandStreamReceiver::baseWaitFunction;
|
||||||
|
using CommandStreamReceiver::checkForNewResources;
|
||||||
using CommandStreamReceiver::checkImplicitFlushForGpuIdle;
|
using CommandStreamReceiver::checkImplicitFlushForGpuIdle;
|
||||||
using CommandStreamReceiver::cleanupResources;
|
using CommandStreamReceiver::cleanupResources;
|
||||||
using CommandStreamReceiver::CommandStreamReceiver;
|
using CommandStreamReceiver::CommandStreamReceiver;
|
||||||
|
|
|
@ -1609,6 +1609,85 @@ TEST(CommandStreamReceiverSimpleTest, givenBaseCsrWhenWritingMemoryThenReturnFal
|
||||||
EXPECT_FALSE(csr.writeMemory(mockAllocation));
|
EXPECT_FALSE(csr.writeMemory(mockAllocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushDisabledWhenProvidingNeverUsedAllocationTaskCountThenDoNotMarkNewResourceTrue) {
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||||
|
executionEnvironment.initializeMemoryManager();
|
||||||
|
DeviceBitfield deviceBitfield(1);
|
||||||
|
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
|
||||||
|
MockGraphicsAllocation mockAllocation;
|
||||||
|
|
||||||
|
csr.useNewResourceImplicitFlush = false;
|
||||||
|
csr.newResources = false;
|
||||||
|
csr.checkForNewResources(10u, GraphicsAllocation::objectNotUsed, mockAllocation);
|
||||||
|
EXPECT_FALSE(csr.newResources);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingNeverUsedAllocationTaskCountThenMarkNewResourceTrue) {
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||||
|
executionEnvironment.initializeMemoryManager();
|
||||||
|
DeviceBitfield deviceBitfield(1);
|
||||||
|
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
|
||||||
|
MockGraphicsAllocation mockAllocation;
|
||||||
|
|
||||||
|
csr.useNewResourceImplicitFlush = true;
|
||||||
|
csr.newResources = false;
|
||||||
|
csr.checkForNewResources(10u, GraphicsAllocation::objectNotUsed, mockAllocation);
|
||||||
|
EXPECT_TRUE(csr.newResources);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingNeverUsedAllocationThatIsKernelIsaThenMarkNewResourceFalse) {
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||||
|
executionEnvironment.initializeMemoryManager();
|
||||||
|
DeviceBitfield deviceBitfield(1);
|
||||||
|
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
|
||||||
|
MockGraphicsAllocation mockAllocation;
|
||||||
|
mockAllocation.setAllocationType(AllocationType::kernelIsa);
|
||||||
|
|
||||||
|
csr.useNewResourceImplicitFlush = true;
|
||||||
|
csr.newResources = false;
|
||||||
|
csr.checkForNewResources(10u, GraphicsAllocation::objectNotUsed, mockAllocation);
|
||||||
|
EXPECT_FALSE(csr.newResources);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingAlreadyUsedAllocationTaskCountThenDoNotMarkNewResource) {
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||||
|
executionEnvironment.initializeMemoryManager();
|
||||||
|
DeviceBitfield deviceBitfield(1);
|
||||||
|
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
|
||||||
|
MockGraphicsAllocation mockAllocation;
|
||||||
|
|
||||||
|
csr.useNewResourceImplicitFlush = true;
|
||||||
|
csr.newResources = false;
|
||||||
|
csr.checkForNewResources(10u, 10u, mockAllocation);
|
||||||
|
EXPECT_FALSE(csr.newResources);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingNewAllocationAndVerbosityEnabledThenProvidePrintOfNewAllocationType) {
|
||||||
|
DebugManagerStateRestore restore;
|
||||||
|
debugManager.flags.ProvideVerboseImplicitFlush.set(true);
|
||||||
|
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||||
|
executionEnvironment.initializeMemoryManager();
|
||||||
|
DeviceBitfield deviceBitfield(1);
|
||||||
|
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
|
||||||
|
MockGraphicsAllocation mockAllocation;
|
||||||
|
|
||||||
|
csr.useNewResourceImplicitFlush = true;
|
||||||
|
csr.newResources = false;
|
||||||
|
testing::internal::CaptureStdout();
|
||||||
|
csr.checkForNewResources(10u, GraphicsAllocation::objectNotUsed, mockAllocation);
|
||||||
|
EXPECT_TRUE(csr.newResources);
|
||||||
|
|
||||||
|
std::string output = testing::internal::GetCapturedStdout();
|
||||||
|
EXPECT_NE(0u, output.size());
|
||||||
|
EXPECT_STREQ("New resource detected of type 0\n", output.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(CommandStreamReceiverSimpleTest, givenPrintfTagAllocationAddressFlagEnabledWhenCreatingTagAllocationThenPrintItsAddress) {
|
TEST(CommandStreamReceiverSimpleTest, givenPrintfTagAllocationAddressFlagEnabledWhenCreatingTagAllocationThenPrintItsAddress) {
|
||||||
DebugManagerStateRestore restore;
|
DebugManagerStateRestore restore;
|
||||||
debugManager.flags.PrintTagAllocationAddress.set(true);
|
debugManager.flags.PrintTagAllocationAddress.set(true);
|
||||||
|
|
Loading…
Reference in New Issue