diff --git a/sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc b/sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc index 5dd73192e6a30..ac49073edd735 100644 --- a/sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc +++ b/sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc @@ -430,7 +430,7 @@ public: class event { public: template - 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 @@ -1125,7 +1125,8 @@ Table {counter: tableNumber}. Additional member functions of the `sycl::event` c [source,c++] ---- template -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 @@ -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. diff --git a/sycl/source/detail/event_impl.cpp b/sycl/source/detail/event_impl.cpp index ba821d3774130..dd867cec3678b 100644 --- a/sycl/source/detail/event_impl.cpp +++ b/sycl/source/detail/event_impl.cpp @@ -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)); + } + } } } @@ -388,10 +392,10 @@ uint64_t event_impl::get_profiling_info( 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), diff --git a/sycl/source/detail/event_impl.hpp b/sycl/source/detail/event_impl.hpp index 7e9d8b5776429..fabe9095ee870 100644 --- a/sycl/source/detail/event_impl.hpp +++ b/sycl/source/detail/event_impl.hpp @@ -102,7 +102,7 @@ class event_impl { /// \return depends on template parameter. template 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 @@ -300,8 +300,8 @@ class event_impl { return MGraph.lock(); } - void setEventFromSubmittedExecGraph(bool value) { - MEventFromSubmittedExecGraph = value; + void setEventFromSubmittedExecGraph(bool Value) { + MEventFromSubmittedExecGraph = Value; } void setExecGraph( diff --git a/sycl/test-e2e/Graph/graph_common.hpp b/sycl/test-e2e/Graph/graph_common.hpp index 786063c93e6eb..337a97ba0fedb 100644 --- a/sycl/test-e2e/Graph/graph_common.hpp +++ b/sycl/test-e2e/Graph/graph_common.hpp @@ -125,7 +125,7 @@ event run_kernels(queue Q, const size_t Size, buffer 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 std::vector add_kernels(exp_ext::command_graph Graph, diff --git a/sycl/test-e2e/Graph/invalid_profiling.cpp b/sycl/test-e2e/Graph/invalid_profiling.cpp index 1bf0393ed178b..55f5ae8358905 100644 --- a/sycl/test-e2e/Graph/invalid_profiling.cpp +++ b/sycl/test-e2e/Graph/invalid_profiling.cpp @@ -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(); @@ -65,7 +65,7 @@ int main() { ExceptionCode = make_error_code(sycl::errc::success); try { auto Start = - KernelEvent + GraphEvent .get_profiling_info(); } catch (sycl::exception &Exception) { ExceptionCode = Exception.code(); @@ -75,7 +75,7 @@ int main() { ExceptionCode = make_error_code(sycl::errc::success); try { auto End = - KernelEvent + GraphEvent .get_profiling_info(); } catch (sycl::exception &Exception) { ExceptionCode = Exception.code(); @@ -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(); @@ -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(); @@ -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(); diff --git a/sycl/test-e2e/Graph/nodes_profiling_info.cpp b/sycl/test-e2e/Graph/nodes_profiling_info.cpp index c1dd7c1981b27..1d3a89891d588 100644 --- a/sycl/test-e2e/Graph/nodes_profiling_info.cpp +++ b/sycl/test-e2e/Graph/nodes_profiling_info.cpp @@ -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