Skip to content

Commit 215051c

Browse files
Dont program semaphores for cross root device timestamp packets
Related-To: NEO-3691 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 902cce5 commit 215051c

File tree

2 files changed

+55
-9
lines changed

2 files changed

+55
-9
lines changed

opencl/source/helpers/properties_helper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ void EventsRequest::fillCsrDependenciesForTimestampPacketContainer(CsrDependenci
2929
continue;
3030
}
3131

32+
auto sameRootDevice = event->getCommandQueue()->getClDevice().getRootDeviceIndex() == currentCsr.getRootDeviceIndex();
33+
if (!sameRootDevice) {
34+
continue;
35+
}
36+
3237
auto sameCsr = (&event->getCommandQueue()->getGpgpuCommandStreamReceiver() == &currentCsr);
3338
bool pushDependency = (CsrDependencies::DependenciesType::OnCsr == depsType && sameCsr) ||
3439
(CsrDependencies::DependenciesType::OutOfCsr == depsType && !sameCsr) ||

opencl/test/unit_test/helpers/timestamp_packet_tests.cpp

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe
761761
}
762762

763763
HWTEST_F(TimestampPacketTests, givenEventsRequestWhenEstimatingStreamSizeForCsrThenAddSizeForSemaphores) {
764-
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
764+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
765765
MockContext context2(device2.get());
766766
auto cmdQ2 = std::make_unique<MockCommandQueueHw<FamilyType>>(&context2, device2.get(), nullptr);
767767

@@ -861,7 +861,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe
861861
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
862862
using MI_ATOMIC = typename FamilyType::MI_ATOMIC;
863863

864-
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
864+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
865865

866866
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
867867
device2->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
@@ -914,6 +914,47 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe
914914
}
915915
}
916916

917+
HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingOnDifferentRootDeviceThenDontProgramSemaphoresOnCsrStream) {
918+
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
919+
using MI_ATOMIC = typename FamilyType::MI_ATOMIC;
920+
921+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
922+
923+
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
924+
device2->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
925+
926+
MockContext context2(device2.get());
927+
928+
auto cmdQ1 = std::make_unique<MockCommandQueueHw<FamilyType>>(context, device.get(), nullptr);
929+
auto cmdQ2 = std::make_unique<MockCommandQueueHw<FamilyType>>(&context2, device2.get(), nullptr);
930+
931+
const cl_uint eventsOnWaitlist = 6;
932+
MockTimestampPacketContainer timestamp3(*device->getGpgpuCommandStreamReceiver().getTimestampPacketAllocator(), 1);
933+
MockTimestampPacketContainer timestamp4(*device->getGpgpuCommandStreamReceiver().getTimestampPacketAllocator(), 1);
934+
MockTimestampPacketContainer timestamp5(*device->getGpgpuCommandStreamReceiver().getTimestampPacketAllocator(), 1);
935+
MockTimestampPacketContainer timestamp6(*device->getGpgpuCommandStreamReceiver().getTimestampPacketAllocator(), 2);
936+
937+
UserEvent event1;
938+
event1.setStatus(CL_COMPLETE);
939+
UserEvent event2;
940+
event2.setStatus(CL_COMPLETE);
941+
Event event3(cmdQ1.get(), 0, 0, 0);
942+
event3.addTimestampPacketNodes(timestamp3);
943+
Event event4(cmdQ2.get(), 0, 0, 0);
944+
event4.addTimestampPacketNodes(timestamp4);
945+
Event event5(cmdQ1.get(), 0, 0, 0);
946+
event5.addTimestampPacketNodes(timestamp5);
947+
Event event6(cmdQ2.get(), 0, 0, 0);
948+
event6.addTimestampPacketNodes(timestamp6);
949+
950+
cl_event waitlist[] = {&event1, &event2, &event3, &event4, &event5, &event6};
951+
952+
cmdQ1->enqueueKernel(kernel->mockKernel, 1, nullptr, gws, nullptr, eventsOnWaitlist, waitlist, nullptr);
953+
954+
verifyDependencyCounterValues(event4.getTimestampPacketNodes(), 0);
955+
verifyDependencyCounterValues(event6.getTimestampPacketNodes(), 0);
956+
}
957+
917958
HWTEST_F(TimestampPacketTests, givenMultipleDevicesOnCsrWhenIncrementingCpuDependenciesCountThenIncrementByTargetCsrDeviceCountValue) {
918959
DeviceBitfield osContext0DeviceBitfiled = 0b011;
919960
DeviceBitfield osContext1DeviceBitfiled = 0b1011;
@@ -926,7 +967,7 @@ HWTEST_F(TimestampPacketTests, givenMultipleDevicesOnCsrWhenIncrementingCpuDepen
926967
EXPECT_EQ(3u, osContext1->getNumSupportedDevices());
927968

928969
auto device0 = std::make_unique<MockClDevice>(Device::create<MockDevice>(factory.rootDevices[0]->getExecutionEnvironment(), 0u));
929-
auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(factory.rootDevices[0]->getExecutionEnvironment(), 1u));
970+
auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(factory.rootDevices[0]->getExecutionEnvironment(), 0u));
930971

931972
device0->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
932973
device0->getUltCommandStreamReceiver<FamilyType>().setupContext(*osContext0);
@@ -966,7 +1007,7 @@ HWTEST_F(TimestampPacketTests, givenMultipleDevicesOnCsrWhenIncrementingCpuDepen
9661007
}
9671008

9681009
HWTEST_F(TimestampPacketTests, givenAllDependencyTypesModeWhenFillingFromDifferentCsrsThenPushEverything) {
969-
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
1010+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
9701011

9711012
auto &csr1 = device->getUltCommandStreamReceiver<FamilyType>();
9721013
auto &csr2 = device2->getUltCommandStreamReceiver<FamilyType>();
@@ -1053,7 +1094,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledOnDifferentCSRsFr
10531094

10541095
HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingBlockedThenProgramSemaphoresOnCsrStreamOnFlush) {
10551096
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
1056-
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
1097+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
10571098

10581099
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
10591100
device2->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
@@ -1145,7 +1186,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenDispatchingTh
11451186
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
11461187
using WALKER = WALKER_TYPE<FamilyType>;
11471188

1148-
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
1189+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
11491190
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
11501191
device2->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
11511192
MockContext context2(device2.get());
@@ -1484,7 +1525,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingWithOmitTim
14841525
HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueueingThenMakeAllTimestampsResident) {
14851526
TagAllocator<TimestampPackets<uint32_t>> tagAllocator(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1, 1,
14861527
sizeof(TimestampPackets<uint32_t>), false, device->getDeviceBitfield());
1487-
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
1528+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
14881529

14891530
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
14901531
ultCsr.timestampPacketWriteEnabled = true;
@@ -1736,7 +1777,7 @@ HWTEST_F(TimestampPacketTests, givenBlockedEnqueueWithoutKernelWhenSubmittingThe
17361777

17371778
HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingMarkerWithoutKernelThenInheritTimestampPacketsAndProgramSemaphores) {
17381779
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
1739-
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
1780+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
17401781

17411782
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
17421783
device2->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
@@ -1779,7 +1820,7 @@ HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingMarkerWi
17791820

17801821
HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingBarrierWithoutKernelThenInheritTimestampPacketsAndProgramSemaphores) {
17811822
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
1782-
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
1823+
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
17831824

17841825
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
17851826
device2->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;

0 commit comments

Comments
 (0)