Skip to content

Commit ab29f52

Browse files
committed
Fixed unitests build failure + added small unittest
Added small unittest case to check that user code location is captured in node_create event: NodeCreation.QueueParallelForWithUserCodeLoc Signed-off-by: Guy Zadicario <[email protected]>
1 parent 8886912 commit ab29f52

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

sycl/unittests/scheduler/HostTaskAndBarrier.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,24 @@ class BarrierHandlingWithHostTask : public ::testing::Test {
6363
[&](handler &CGH) {
6464
CGH.host_task(BlockHostTask ? CustomHostLambda : [] {});
6565
},
66-
QueueDevImpl, nullptr, {});
66+
QueueDevImpl, nullptr, {}, true);
6767
} else if (Type == TestCGType::KERNEL_TASK) {
6868
return QueueDevImpl->submit(
6969
[&](handler &CGH) { CGH.single_task<TestKernel<>>([] {}); },
70-
QueueDevImpl, nullptr, {});
70+
QueueDevImpl, nullptr, {}, true);
7171
} else // (Type == TestCGType::BARRIER)
7272
{
7373
return QueueDevImpl->submit(
7474
[&](handler &CGH) { CGH.ext_oneapi_barrier(); }, QueueDevImpl,
75-
nullptr, {});
75+
nullptr, {}, true);
7676
}
7777
}
7878

7979
sycl::event
8080
InsertBarrierWithWaitList(const std::vector<sycl::event> &WaitList) {
8181
return QueueDevImpl->submit(
8282
[&](handler &CGH) { CGH.ext_oneapi_barrier(WaitList); }, QueueDevImpl,
83-
nullptr, {});
83+
nullptr, {}, true);
8484
}
8585

8686
void BuildAndCheckInnerQueueState(std::vector<EventImplPtr> &Events) {

sycl/unittests/xpti_trace/NodeCreation.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,28 @@ TEST_F(NodeCreation, QueueParallelForWithNoGraphNode) {
8989
EXPECT_THAT(Message, HasSubstr("TestKernel"));
9090
}
9191

92+
TEST_F(NodeCreation, QueueParallelForWithUserCodeLoc) {
93+
sycl::queue Q;
94+
try {
95+
sycl::buffer<int, 1> buf(sycl::range<1>(1));
96+
sycl::detail::tls_code_loc_t myLoc({"LOCAL_CODELOC_FILE", "LOCAL_CODELOC_NAME", 1, 1});
97+
Q.submit(
98+
[&](handler &Cgh) {
99+
sycl::accessor acc(buf, Cgh, sycl::read_write);
100+
Cgh.parallel_for<TestKernel<KernelSize>>(1, [=](sycl::id<1> idx) {});
101+
},
102+
TestCodeLocation);
103+
} catch (sycl::exception &e) {
104+
std::ignore = e;
105+
}
106+
Q.wait();
107+
uint16_t TraceType = 0;
108+
std::string Message;
109+
ASSERT_TRUE(queryReceivedNotifications(TraceType, Message));
110+
EXPECT_EQ(TraceType, xpti::trace_node_create);
111+
EXPECT_THAT(Message, HasSubstr("LOCAL_CODELOC_NAME"));
112+
}
113+
92114
TEST_F(NodeCreation, QueueMemcpyNode) {
93115
sycl::queue Q;
94116

@@ -118,4 +140,4 @@ TEST_F(NodeCreation, QueueMemsetNode) {
118140
ASSERT_TRUE(queryReceivedNotifications(TraceType, Message));
119141
EXPECT_EQ(TraceType, xpti::trace_node_create);
120142
EXPECT_THAT(Message, HasSubstr("memory_transfer_node"));
121-
}
143+
}

0 commit comments

Comments
 (0)