Skip to content

Commit

Permalink
Code format improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrancepillois committed Jan 26, 2024
1 parent 421f303 commit 99c7bf9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public:
class event {
public:
template <typename Param>
typename Param::return_type ext_oneapi_get_profiling_info(ext::oneapi::experimental::node Node) const;
typename Param::return_type ext_oneapi_get_profiling_info(node Node) const;
}
} // namespace sycl
Expand Down Expand Up @@ -1125,7 +1125,8 @@ Table {counter: tableNumber}. Additional member functions of the `sycl::event` c
[source,c++]
----
template <typename Param>
typename Param::return_type event::ext_oneapi_get_profiling_info(ext::oneapi::experimental::node Node) const;
typename Param::return_type
event::ext_oneapi_get_profiling_info(node Node) const;
----

| Queries the profiling information of a SYCL Graph node for the graph
Expand All @@ -1144,7 +1145,7 @@ Exceptions:
associated to a graph execution.
* Throws synchronously with error code `invalid` if the queue on which
the graph is submitted was not constructed with
the property::queue::enable_profiling property.
the `property::queue::enable_profiling` property.
* Throws synchronously with error code `invalid` if `Node` is not associated
to the graph that was executed by event.

Expand Down
20 changes: 12 additions & 8 deletions sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,16 @@ void event_impl::checkProfilingPreconditions() const {
"Profiling information is unavailable as the queue associated with "
"the event does not have the 'enable_profiling' property.");
}
if (isEventFromSubmittedExecGraph() && (MExecGraph.lock()->getPartitions().size() > 1)) {
throw sycl::exception(
sycl::make_error_code(sycl::errc::invalid),
"Profiling information is not available for "
"partitioned graph (i.e. graph that contains a host-task)." +
codeToString(PI_ERROR_INVALID_VALUE));
if (isEventFromSubmittedExecGraph()) {
if (auto ExecGraphSP = MExecGraph.lock()) {
if (ExecGraphSP->getPartitions().size() > 1) {
throw sycl::exception(
sycl::make_error_code(sycl::errc::invalid),
"Profiling information is not available for "
"partitioned graph (i.e. graph that contains a host-task)." +
codeToString(PI_ERROR_INVALID_VALUE));
}
}
}
}

Expand Down Expand Up @@ -388,10 +392,10 @@ uint64_t event_impl::get_profiling_info<info::event_profiling::command_submit>(
codeToString(PI_ERROR_PROFILING_INFO_NOT_AVAILABLE));
}

if (!MExecGraph.expired()) {
if (auto ExecGraphSP = MExecGraph.lock()) {
// check if the node belongs to the graph.
try {
MExecGraph.lock()->getSyncPointFromNode(NodeImpl);
ExecGraphSP->getSyncPointFromNode(NodeImpl);
} catch (...) {
throw sycl::exception(
sycl::make_error_code(sycl::errc::invalid),
Expand Down
6 changes: 3 additions & 3 deletions sycl/source/detail/event_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class event_impl {
/// \return depends on template parameter.
template <typename Param> typename Param::return_type get_profiling_info();

/// Queries the proliling information of a SYCL Graph node for the graph
/// Queries the profiling information of a SYCL Graph node for the graph
/// execution associated with this event.
///
/// If the requested info is not available when this member function is
Expand Down Expand Up @@ -300,8 +300,8 @@ class event_impl {
return MGraph.lock();
}

void setEventFromSubmittedExecGraph(bool value) {
MEventFromSubmittedExecGraph = value;
void setEventFromSubmittedExecGraph(bool Value) {
MEventFromSubmittedExecGraph = Value;
}

void setExecGraph(
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/Graph/graph_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ event run_kernels(queue Q, const size_t Size, buffer<T> BufferA,
/// @param BufferB Second input/output to use in kernels.
/// @param BufferC Third input/output to use in kernels.
///
/// @return Exit node of the submission sequence.
/// @return Vector containing the nodes of the submission sequence.
template <typename T>
std::vector<exp_ext::node>
add_kernels(exp_ext::command_graph<exp_ext::graph_state::modifiable> Graph,
Expand Down
14 changes: 7 additions & 7 deletions sycl/test-e2e/Graph/invalid_profiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ int main() {
auto KernelGraphExec = KernelGraph.finalize();

// Run graphs
auto KernelEvent = Queue.submit(
auto GraphEvent = Queue.submit(
[&](handler &CGH) { CGH.ext_oneapi_graph(KernelGraphExec); });
Queue.wait_and_throw();

// get Submit timestamp should NOT work
std::error_code ExceptionCode = make_error_code(sycl::errc::success);
try {
auto Submit = KernelEvent.get_profiling_info<
auto Submit = GraphEvent.get_profiling_info<
sycl::info::event_profiling::command_submit>();
} catch (sycl::exception &Exception) {
ExceptionCode = Exception.code();
Expand All @@ -65,7 +65,7 @@ int main() {
ExceptionCode = make_error_code(sycl::errc::success);
try {
auto Start =
KernelEvent
GraphEvent
.get_profiling_info<sycl::info::event_profiling::command_start>();
} catch (sycl::exception &Exception) {
ExceptionCode = Exception.code();
Expand All @@ -75,7 +75,7 @@ int main() {
ExceptionCode = make_error_code(sycl::errc::success);
try {
auto End =
KernelEvent
GraphEvent
.get_profiling_info<sycl::info::event_profiling::command_end>();
} catch (sycl::exception &Exception) {
ExceptionCode = Exception.code();
Expand All @@ -85,7 +85,7 @@ int main() {
// get Submit timestamp should NOT work
ExceptionCode = make_error_code(sycl::errc::success);
try {
auto NodeSubmit = KernelEvent.ext_oneapi_get_profiling_info<
auto NodeSubmit = GraphEvent.ext_oneapi_get_profiling_info<
sycl::info::event_profiling::command_submit>(Nodes[0]);
} catch (sycl::exception &Exception) {
ExceptionCode = Exception.code();
Expand All @@ -94,7 +94,7 @@ int main() {
// get Start timestamp should NOT work
ExceptionCode = make_error_code(sycl::errc::success);
try {
auto NodeStart = KernelEvent.ext_oneapi_get_profiling_info<
auto NodeStart = GraphEvent.ext_oneapi_get_profiling_info<
sycl::info::event_profiling::command_start>(Nodes[0]);
} catch (sycl::exception &Exception) {
ExceptionCode = Exception.code();
Expand All @@ -103,7 +103,7 @@ int main() {
// get End timestamp should NOT work
ExceptionCode = make_error_code(sycl::errc::success);
try {
auto NodeEnd = KernelEvent.ext_oneapi_get_profiling_info<
auto NodeEnd = GraphEvent.ext_oneapi_get_profiling_info<
sycl::info::event_profiling::command_end>(Nodes[0]);
} catch (sycl::exception &Exception) {
ExceptionCode = Exception.code();
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/Graph/nodes_profiling_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck --implicit-check-not=LEAK %s %}

// This test checks the profiling of an event returned
// from graph submission with event::get_profiling_info().
// from graph submission with event::ext_oneapi_get_profiling_info().
// It first tests a graph made exclusively of memory operations,
// then tests a graph made of kernels.
// The second run is to check that there are no leaks reported with the embedded
Expand Down

0 comments on commit 99c7bf9

Please sign in to comment.