diff --git a/level_zero/core/source/event/event.cpp b/level_zero/core/source/event/event.cpp index 0134410ce8..01bdef4db5 100644 --- a/level_zero/core/source/event/event.cpp +++ b/level_zero/core/source/event/event.cpp @@ -411,6 +411,9 @@ void Event::disableImplicitCounterBasedMode() { } uint64_t Event::getGpuAddress(Device *device) const { + if (inOrderTimestampNode) { + return inOrderTimestampNode->getGpuAddress(); + } return getAllocation(device)->getGpuAddress() + this->eventPoolOffset; } diff --git a/level_zero/core/source/event/event.h b/level_zero/core/source/event/event.h index 0c7bbb3f8d..aec011aa01 100644 --- a/level_zero/core/source/event/event.h +++ b/level_zero/core/source/event/event.h @@ -300,6 +300,8 @@ struct Event : _ze_event_handle_t { void resetInOrderTimestampNode(NEO::TagNodeBase *newNode); + bool hasInOrderTimestampNode() const { return inOrderTimestampNode != nullptr; } + protected: Event(int index, Device *device) : device(device), index(index) {} diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist.cpp index 7630b9c602..8ef6300211 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist.cpp @@ -6628,11 +6628,18 @@ struct StandaloneInOrderTimestampAllocationTests : public InOrderCmdListTests { }; HWTEST2_F(StandaloneInOrderTimestampAllocationTests, givenTimestampEventWhenAskingForAllocationOrGpuAddressThenReturnNodeAllocation, MatchAny) { - auto eventPool = createEvents(1, true); + auto eventPool = createEvents(2, true); auto cmdList = createImmCmdList(); + EXPECT_FALSE(events[0]->hasInOrderTimestampNode()); + EXPECT_FALSE(events[1]->hasInOrderTimestampNode()); + cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false); + cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[1]->toHandle(), 0, nullptr, launchParams, false); + + EXPECT_TRUE(events[0]->hasInOrderTimestampNode()); + EXPECT_TRUE(events[1]->hasInOrderTimestampNode()); EXPECT_NE(events[0]->inOrderTimestampNode->getBaseGraphicsAllocation(), events[0]->eventPoolAllocation); EXPECT_NE(nullptr, events[0]->inOrderTimestampNode->getBaseGraphicsAllocation()); @@ -6641,6 +6648,10 @@ HWTEST2_F(StandaloneInOrderTimestampAllocationTests, givenTimestampEventWhenAski EXPECT_EQ(events[0]->inOrderTimestampNode->getBaseGraphicsAllocation()->getGraphicsAllocation(0), events[0]->getAllocation(device)); EXPECT_EQ(events[0]->inOrderTimestampNode->getBaseGraphicsAllocation()->getGraphicsAllocation(0)->getGpuAddress(), events[0]->getGpuAddress(device)); EXPECT_EQ(events[0]->getGpuAddress(device) + events[0]->getCompletionFieldOffset(), events[0]->getCompletionFieldGpuAddress(device)); + + EXPECT_EQ(events[0]->getGpuAddress(device), events[0]->inOrderTimestampNode->getGpuAddress()); + EXPECT_EQ(events[1]->getGpuAddress(device), events[1]->inOrderTimestampNode->getGpuAddress()); + EXPECT_NE(events[0]->getGpuAddress(device), events[1]->getGpuAddress(device)); } HWTEST2_F(StandaloneInOrderTimestampAllocationTests, givenNonWalkerCounterSignalingWhenPassedNonProfilingEventThenAssignAllocation, IsAtLeastXeHpCore) {