From 6c8b14c9180cd3fb22952048c084f1c714a14360 Mon Sep 17 00:00:00 2001 From: "Milczarek, Slawomir" Date: Tue, 7 May 2019 10:36:39 +0200 Subject: [PATCH] OmitTimestampPacketDependencies to omit node dependency in timestamp packet Makes subcapture feature work with timestamp packet enabled. Related-To: NEO-2747 Change-Id: Ifa45f1c066129671a02dc708b537b285f5a05d7f Signed-off-by: Milczarek, Slawomir --- runtime/command_queue/command_queue.cpp | 2 +- runtime/command_stream/aub_subcapture.cpp | 2 ++ runtime/os_interface/debug_variables_base.inl | 1 + .../command_stream/aub_subcapture_tests.cpp | 6 +++- unit_tests/helpers/timestamp_packet_tests.cpp | 30 +++++++++++++++++++ unit_tests/test_files/igdrcl.config | 1 + 6 files changed, 40 insertions(+), 2 deletions(-) diff --git a/runtime/command_queue/command_queue.cpp b/runtime/command_queue/command_queue.cpp index 7a7f6131c7..7709b881c6 100644 --- a/runtime/command_queue/command_queue.cpp +++ b/runtime/command_queue/command_queue.cpp @@ -555,7 +555,7 @@ void CommandQueue::obtainNewTimestampPacketNodes(size_t numberOfNodes, Timestamp auto allocator = getCommandStreamReceiver().getTimestampPacketAllocator(); previousNodes.swapNodes(*timestampPacketContainer); - previousNodes.resolveDependencies(isOOQEnabled()); + previousNodes.resolveDependencies(isOOQEnabled() || DebugManager.flags.OmitTimestampPacketDependencies.get()); DEBUG_BREAK_IF(timestampPacketContainer->peekNodes().size() > 0); diff --git a/runtime/command_stream/aub_subcapture.cpp b/runtime/command_stream/aub_subcapture.cpp index 3291debf73..be2aa6f292 100644 --- a/runtime/command_stream/aub_subcapture.cpp +++ b/runtime/command_stream/aub_subcapture.cpp @@ -130,12 +130,14 @@ bool AubSubCaptureManager::isSubCaptureFilterActive(const MultiDispatchInfo &dis void AubSubCaptureManager::setDebugManagerFlags() const { DebugManager.flags.MakeEachEnqueueBlocking.set(!subCaptureIsActive); DebugManager.flags.ForceCsrFlushing.set(false); + DebugManager.flags.OmitTimestampPacketDependencies.set(false); if (!subCaptureIsActive && subCaptureWasActive) { DebugManager.flags.ForceCsrFlushing.set(true); } DebugManager.flags.ForceCsrReprogramming.set(false); if (subCaptureIsActive && !subCaptureWasActive) { DebugManager.flags.ForceCsrReprogramming.set(true); + DebugManager.flags.OmitTimestampPacketDependencies.set(true); } } } // namespace NEO diff --git a/runtime/os_interface/debug_variables_base.inl b/runtime/os_interface/debug_variables_base.inl index 2750e41c8c..8fa36ad889 100644 --- a/runtime/os_interface/debug_variables_base.inl +++ b/runtime/os_interface/debug_variables_base.inl @@ -75,6 +75,7 @@ DECLARE_DEBUG_VARIABLE(bool, ForceSLML3Config, false, "Forces L3Config with SLM DECLARE_DEBUG_VARIABLE(bool, Force32bitAddressing, false, "Forces 32 bit addresses to be used in 64 bit dll") DECLARE_DEBUG_VARIABLE(bool, ForceCsrFlushing, false, "Forces flushing of command stream receiver") DECLARE_DEBUG_VARIABLE(bool, ForceCsrReprogramming, false, "Forces reprogramming of command stream receiver") +DECLARE_DEBUG_VARIABLE(bool, OmitTimestampPacketDependencies, false, "Clears all node dependences on timestamp packet") DECLARE_DEBUG_VARIABLE(bool, DisableStatelessToStatefulOptimization, false, "Disables stateless to stateful optimization for buffers") DECLARE_DEBUG_VARIABLE(bool, DisableConcurrentBlockExecution, false, "disables concurrent block kernel execution") DECLARE_DEBUG_VARIABLE(bool, UseNoRingFlushesKmdMode, true, "Windows only, passes flag to KMD that informs KMD to not emit any ring buffer flushes.") diff --git a/unit_tests/command_stream/aub_subcapture_tests.cpp b/unit_tests/command_stream/aub_subcapture_tests.cpp index 40e08f1e2f..c82932c4f2 100644 --- a/unit_tests/command_stream/aub_subcapture_tests.cpp +++ b/unit_tests/command_stream/aub_subcapture_tests.cpp @@ -261,9 +261,10 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureKeepsInactiveThenM EXPECT_TRUE(DebugManager.flags.MakeEachEnqueueBlocking.get()); EXPECT_FALSE(DebugManager.flags.ForceCsrFlushing.get()); EXPECT_FALSE(DebugManager.flags.ForceCsrReprogramming.get()); + EXPECT_FALSE(DebugManager.flags.OmitTimestampPacketDependencies.get()); } -TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureGetsActiveThenDontMakeEachEnqueueBlockingAndForceCsrReprogramming) { +TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureGetsActiveThenDontMakeEachEnqueueBlockingButForceCsrReprogrammingAndOmitTimestampPacketDependencies) { AubSubCaptureManagerMock aubSubCaptureManager(""); DispatchInfo dispatchInfo; @@ -279,6 +280,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureGetsActiveThenDont aubSubCaptureManager.activateSubCapture(multiDispatchInfo); EXPECT_FALSE(DebugManager.flags.ForceCsrFlushing.get()); EXPECT_TRUE(DebugManager.flags.ForceCsrReprogramming.get()); + EXPECT_TRUE(DebugManager.flags.OmitTimestampPacketDependencies.get()); EXPECT_FALSE(DebugManager.flags.MakeEachEnqueueBlocking.get()); } @@ -298,6 +300,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureKeepsActiveThenDon aubSubCaptureManager.activateSubCapture(multiDispatchInfo); EXPECT_FALSE(DebugManager.flags.ForceCsrFlushing.get()); EXPECT_FALSE(DebugManager.flags.ForceCsrReprogramming.get()); + EXPECT_FALSE(DebugManager.flags.OmitTimestampPacketDependencies.get()); EXPECT_FALSE(DebugManager.flags.MakeEachEnqueueBlocking.get()); } @@ -317,6 +320,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureGetsInactiveThenMa aubSubCaptureManager.activateSubCapture(multiDispatchInfo); EXPECT_TRUE(DebugManager.flags.ForceCsrFlushing.get()); EXPECT_FALSE(DebugManager.flags.ForceCsrReprogramming.get()); + EXPECT_FALSE(DebugManager.flags.OmitTimestampPacketDependencies.get()); EXPECT_TRUE(DebugManager.flags.MakeEachEnqueueBlocking.get()); } diff --git a/unit_tests/helpers/timestamp_packet_tests.cpp b/unit_tests/helpers/timestamp_packet_tests.cpp index f5b2ec7212..b0298688a2 100644 --- a/unit_tests/helpers/timestamp_packet_tests.cpp +++ b/unit_tests/helpers/timestamp_packet_tests.cpp @@ -1088,6 +1088,36 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingToOoqThenDo EXPECT_EQ(0u, atomicsFound); } +HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingWithOmitTimestampPacketDependenciesThenDontKeepDependencyOnPreviousNodeIfItsNotReady) { + using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; + device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; + + DebugManagerStateRestore restore; + DebugManager.flags.OmitTimestampPacketDependencies.set(true); + + MockCommandQueueHw cmdQ(context, device.get(), nullptr); + TimestampPacketContainer previousNodes; + cmdQ.obtainNewTimestampPacketNodes(1, previousNodes); + + cmdQ.enqueueKernel(kernel->mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); + + HardwareParse hwParser; + hwParser.parseCommands(*cmdQ.commandStream, 0); + + uint32_t semaphoresFound = 0; + uint32_t atomicsFound = 0; + for (auto it = hwParser.cmdList.begin(); it != hwParser.cmdList.end(); it++) { + if (genCmdCast(*it)) { + semaphoresFound++; + } + if (genCmdCast(*it)) { + atomicsFound++; + } + } + EXPECT_EQ(0u, semaphoresFound); + EXPECT_EQ(0u, atomicsFound); +} + HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueueingThenMakeAllTimestampsResident) { TagAllocator tagAllocator(executionEnvironment->memoryManager.get(), 1, 1); auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); diff --git a/unit_tests/test_files/igdrcl.config b/unit_tests/test_files/igdrcl.config index 0505c2b8a7..c7596bc440 100644 --- a/unit_tests/test_files/igdrcl.config +++ b/unit_tests/test_files/igdrcl.config @@ -72,6 +72,7 @@ OverrideAubDeviceId = -1 ForceCompilerUsePlatform = unk ForceCsrFlushing = 0 ForceCsrReprogramming = 0 +OmitTimestampPacketDependencies = 0 AUBDumpBufferFormat = unk AUBDumpImageFormat = unk AUBDumpCaptureFileName = unk