Create timestamp packet container for events if command queue created it

Related-To: NEO-5120
Change-Id: I00505647343da1876b25290b95a2009b5e4041d6
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2020-09-29 15:39:50 +02:00
committed by sys_ocldev
parent 9f9bf38d64
commit 51dcccad76
4 changed files with 21 additions and 1 deletions

View File

@@ -282,6 +282,10 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
return throttle; return throttle;
} }
const TimestampPacketContainer *getTimestampPacketContainer() const {
return timestampPacketContainer.get();
}
const std::vector<uint64_t> &getPropertiesVector() const { return propertiesVector; } const std::vector<uint64_t> &getPropertiesVector() const { return propertiesVector; }
void enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList, void enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList,

View File

@@ -65,7 +65,7 @@ Event::Event(
if ((this->ctx == nullptr) && (cmdQueue != nullptr)) { if ((this->ctx == nullptr) && (cmdQueue != nullptr)) {
this->ctx = &cmdQueue->getContext(); this->ctx = &cmdQueue->getContext();
if (cmdQueue->getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { if (cmdQueue->getTimestampPacketContainer()) {
timestampPacketContainer = std::make_unique<TimestampPacketContainer>(); timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
} }
} }

View File

@@ -1555,3 +1555,17 @@ TEST(EventsDebug, givenEventWhenTrackingOfParentsIsOffThenDoNotTrackParents) {
EXPECT_EQ(0u, parentEvents2.size()); EXPECT_EQ(0u, parentEvents2.size());
event.setStatus(CL_COMPLETE); event.setStatus(CL_COMPLETE);
} }
TEST(CommandQueue, givenTimestampPacketWritesDisabledAndQueueHasTimestampPacketContainerThenCreateTheContainerForEvent) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.EnableTimestampPacket.set(0);
MockContext context{};
MockCommandQueue queue{&context, context.getDevice(0), nullptr};
ASSERT_FALSE(queue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled());
ASSERT_EQ(nullptr, queue.timestampPacketContainer.get());
queue.timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
MockEvent<Event> event{&queue, CL_COMMAND_MARKER, 0, 0};
EXPECT_NE(nullptr, event.timestampPacketContainer);
}

View File

@@ -57,6 +57,8 @@ struct TimestampPacketTests : public TimestampPacketSimpleTests {
}; };
void SetUp() override { void SetUp() override {
DebugManager.flags.EnableTimestampPacket.set(1);
executionEnvironment = platform()->peekExecutionEnvironment(); executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(2); executionEnvironment->prepareRootDeviceEnvironments(2);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {