diff --git a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp index e15d5ed5a6b7a..d18cf3ebc4b3d 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp @@ -13,8 +13,11 @@ #include // for __SYCL_EXPORT #include // for kernel_param_kind_t #include // for DataLessPropKind, PropWith... -#include // for device -#include // for range, nd_range +#ifdef __INTEL_PREVIEW_BREAKING_CHANGES +#include +#endif +#include // for device +#include // for range, nd_range #include // for is_property, is_property_of #include // for property_list @@ -314,7 +317,13 @@ class __SYCL_EXPORT modifiable_command_graph { /// @param path The path to write the DOT file to. /// @param verbose If true, print additional information about the nodes such /// as kernel args or memory access where applicable. +#ifdef __INTEL_PREVIEW_BREAKING_CHANGES + void print_graph(const std::string path, bool verbose = false) const { + print_graph(sycl::detail::string_view{path}, verbose); + } +#else void print_graph(const std::string path, bool verbose = false) const; +#endif /// Get a list of all nodes contained in this graph. std::vector get_nodes() const; @@ -350,7 +359,9 @@ class __SYCL_EXPORT modifiable_command_graph { sycl::detail::getSyclObjImpl(const Obj &SyclObject); template friend T sycl::detail::createSyclObjFromImpl(decltype(T::impl) ImplObj); - +#ifdef __INTEL_PREVIEW_BREAKING_CHANGES + void print_graph(sycl::detail::string_view path, bool verbose = false) const; +#endif std::shared_ptr impl; }; diff --git a/sycl/source/detail/graph_impl.cpp b/sycl/source/detail/graph_impl.cpp index 4df70fc78c1b1..afe32ed7a4fbc 100644 --- a/sycl/source/detail/graph_impl.cpp +++ b/sycl/source/detail/graph_impl.cpp @@ -14,6 +14,9 @@ #include #include #include +#ifdef __INTEL_PREVIEW_BREAKING_CHANGES +#include +#endif #include #include @@ -1680,8 +1683,15 @@ void modifiable_command_graph::end_recording( } } +#ifdef __INTEL_PREVIEW_BREAKING_CHANGES +void modifiable_command_graph::print_graph(sycl::detail::string_view pathstr, +#else void modifiable_command_graph::print_graph(std::string path, +#endif bool verbose) const { +#ifdef __INTEL_PREVIEW_BREAKING_CHANGES + std::string path{pathstr.data()}; +#endif graph_impl::ReadLock Lock(impl->MMutex); if (path.substr(path.find_last_of(".") + 1) == "dot") { impl->printGraphAsDot(path, verbose);