Skip to content

Commit

Permalink
Move test to unitest + typo
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrancepillois committed Feb 29, 2024
1 parent 49630d8 commit e4ee57e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@ class assume_buffer_outlives_graph {
assume_buffer_outlives_graph() = default;
};
public:
enable_profiling() = default;
class enable_profiling {
public:
enable_profiling() = default;
};
} // namespace graph
Expand Down
15 changes: 0 additions & 15 deletions sycl/test-e2e/Graph/event_profiling_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,6 @@ int main() {
assert(verifyProfiling(CopyEvent) && verifyProfiling(KernelEvent1) &&
verifyProfiling(KernelEvent2) &&
compareProfiling(KernelEvent1, KernelEvent2));

// Checks exception thrown if profiling is requested while the
// enable_profiling property has not been passed to `finalize()`.
auto CopyGraphExecInOrder = CopyGraph.finalize();
auto EventInOrder = Queue.submit(
[&](handler &CGH) { CGH.ext_oneapi_graph(CopyGraphExecInOrder); });
Queue.wait_and_throw();
bool Success = false;
try {
EventInOrder
.get_profiling_info<sycl::info::event_profiling::command_start>();
} catch (sycl::exception &E) {
Success = true;
}
assert(Success);
}

host_accessor HostData(BufferTo);
Expand Down
28 changes: 28 additions & 0 deletions sycl/unittests/Extensions/CommandGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2265,6 +2265,34 @@ TEST_F(CommandGraphTest, ProfilingException) {
}
}

TEST_F(CommandGraphTest, ProfilingExceptionProperty) {
Graph.begin_recording(Queue);
auto Event1 = Queue.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<>>([]() {}); });
Graph.end_recording(Queue);

// Checks exception thrown if profiling is requested while the
// enable_profiling property has not been passed to `finalize()`.
auto GraphExecInOrder = Graph.finalize();
queue QueueProfile{Dev, {sycl::property::queue::enable_profiling()}};
auto EventInOrder = QueueProfile.submit(
[&](handler &CGH) { CGH.ext_oneapi_graph(GraphExecInOrder); });
QueueProfile.wait_and_throw();
bool Success = true;
try {
EventInOrder
.get_profiling_info<sycl::info::event_profiling::command_start>();
} catch (sycl::exception &Exception) {
ASSERT_FALSE(std::string(Exception.what())
.find("Profiling information is unavailable as the queue "
"associated with the event does not have the "
"'enable_profiling' property.") ==
std::string::npos);
Success = false;
}
ASSERT_EQ(Success, false);
}

class MultiThreadGraphTest : public CommandGraphTest {
public:
MultiThreadGraphTest()
Expand Down

0 comments on commit e4ee57e

Please sign in to comment.