Skip to content

Commit 17a2b36

Browse files
fix: allocation information from standalone profiling CB event
Related-To: NEO-11925 Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent 79bffdb commit 17a2b36

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

level_zero/core/source/event/event.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ void Event::disableImplicitCounterBasedMode() {
411411
}
412412

413413
uint64_t Event::getGpuAddress(Device *device) const {
414+
if (inOrderTimestampNode) {
415+
return inOrderTimestampNode->getGpuAddress();
416+
}
414417
return getAllocation(device)->getGpuAddress() + this->eventPoolOffset;
415418
}
416419

level_zero/core/source/event/event.h

+2
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ struct Event : _ze_event_handle_t {
300300

301301
void resetInOrderTimestampNode(NEO::TagNodeBase *newNode);
302302

303+
bool hasInOrderTimestampNode() const { return inOrderTimestampNode != nullptr; }
304+
303305
protected:
304306
Event(int index, Device *device) : device(device), index(index) {}
305307

level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -6628,11 +6628,18 @@ struct StandaloneInOrderTimestampAllocationTests : public InOrderCmdListTests {
66286628
};
66296629

66306630
HWTEST2_F(StandaloneInOrderTimestampAllocationTests, givenTimestampEventWhenAskingForAllocationOrGpuAddressThenReturnNodeAllocation, MatchAny) {
6631-
auto eventPool = createEvents<FamilyType>(1, true);
6631+
auto eventPool = createEvents<FamilyType>(2, true);
66326632

66336633
auto cmdList = createImmCmdList<gfxCoreFamily>();
66346634

6635+
EXPECT_FALSE(events[0]->hasInOrderTimestampNode());
6636+
EXPECT_FALSE(events[1]->hasInOrderTimestampNode());
6637+
66356638
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false);
6639+
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[1]->toHandle(), 0, nullptr, launchParams, false);
6640+
6641+
EXPECT_TRUE(events[0]->hasInOrderTimestampNode());
6642+
EXPECT_TRUE(events[1]->hasInOrderTimestampNode());
66366643

66376644
EXPECT_NE(events[0]->inOrderTimestampNode->getBaseGraphicsAllocation(), events[0]->eventPoolAllocation);
66386645
EXPECT_NE(nullptr, events[0]->inOrderTimestampNode->getBaseGraphicsAllocation());
@@ -6641,6 +6648,10 @@ HWTEST2_F(StandaloneInOrderTimestampAllocationTests, givenTimestampEventWhenAski
66416648
EXPECT_EQ(events[0]->inOrderTimestampNode->getBaseGraphicsAllocation()->getGraphicsAllocation(0), events[0]->getAllocation(device));
66426649
EXPECT_EQ(events[0]->inOrderTimestampNode->getBaseGraphicsAllocation()->getGraphicsAllocation(0)->getGpuAddress(), events[0]->getGpuAddress(device));
66436650
EXPECT_EQ(events[0]->getGpuAddress(device) + events[0]->getCompletionFieldOffset(), events[0]->getCompletionFieldGpuAddress(device));
6651+
6652+
EXPECT_EQ(events[0]->getGpuAddress(device), events[0]->inOrderTimestampNode->getGpuAddress());
6653+
EXPECT_EQ(events[1]->getGpuAddress(device), events[1]->inOrderTimestampNode->getGpuAddress());
6654+
EXPECT_NE(events[0]->getGpuAddress(device), events[1]->getGpuAddress(device));
66446655
}
66456656

66466657
HWTEST2_F(StandaloneInOrderTimestampAllocationTests, givenNonWalkerCounterSignalingWhenPassedNonProfilingEventThenAssignAllocation, IsAtLeastXeHpCore) {

0 commit comments

Comments
 (0)