From 47461cb9fdf492ec4408545fb9a1dc36f6e4961e Mon Sep 17 00:00:00 2001 From: Andrei Elovikov Date: Tue, 26 Nov 2024 15:28:50 -0800 Subject: [PATCH 1/2] [SYCL] Support `print_graph` with pre-C++11 ABI in non-preview mode https://github.com/intel/llvm/pull/15694 implemented the change under `-fpreview-breaking-changes` guard but we can do better than that. --- .../sycl/ext/oneapi/experimental/graph.hpp | 25 ++++++++++++------- sycl/source/detail/graph_impl.cpp | 8 ++---- sycl/test/abi/sycl_symbols_linux.dump | 1 + sycl/test/abi/sycl_symbols_windows.dump | 1 + 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp index 2bc3ef1d921ab..13d9d1ea4045e 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp @@ -335,13 +335,7 @@ 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; @@ -378,17 +372,30 @@ class __SYCL_EXPORT modifiable_command_graph { /// added as dependencies. void addGraphLeafDependencies(node Node); + void print_graph(sycl::detail::string_view path, bool verbose = false) const; + template friend const decltype(Obj::impl) & 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; }; +#ifdef __SYCL_GRAPH_IMPL_CPP +__SYCL_EXPORT +#if WIN32 +inline +#endif +#else +inline +#endif + void + modifiable_command_graph::print_graph(const std::string path, + bool verbose) const { + print_graph(sycl::detail::string_view{path}, verbose); +} + // Templateless executable command-graph base class. class __SYCL_EXPORT executable_command_graph { public: diff --git a/sycl/source/detail/graph_impl.cpp b/sycl/source/detail/graph_impl.cpp index 861ec2a883601..10624c7c5fd61 100644 --- a/sycl/source/detail/graph_impl.cpp +++ b/sycl/source/detail/graph_impl.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +#define __SYCL_GRAPH_IMPL_CPP + #include #include #include @@ -1757,15 +1759,9 @@ 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); diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index 853ac28bad1d5..0f71c282e2462 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3613,6 +3613,7 @@ _ZNK4sycl3_V13ext6oneapi12experimental21dynamic_command_group14get_active_cgfEv _ZNK4sycl3_V13ext6oneapi12experimental4node14get_successorsEv _ZNK4sycl3_V13ext6oneapi12experimental4node16get_predecessorsEv _ZNK4sycl3_V13ext6oneapi12experimental4node8get_typeEv +_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph11print_graphENS0_6detail11string_viewEb _ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph11print_graphENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb _ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph14get_root_nodesEv _ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph8finalizeERKNS0_13property_listE diff --git a/sycl/test/abi/sycl_symbols_windows.dump b/sycl/test/abi/sycl_symbols_windows.dump index 8e29aba2726c9..bbd10e05f6640 100644 --- a/sycl/test/abi/sycl_symbols_windows.dump +++ b/sycl/test/abi/sycl_symbols_windows.dump @@ -4202,6 +4202,7 @@ ?prefetch@queue@_V1@sycl@@QEAA?AVevent@23@PEBX_KV423@AEBUcode_location@detail@23@@Z ?prepare_for_device_copy@experimental@oneapi@ext@_V1@sycl@@YAXPEBX_KAEBVcontext@45@@Z ?prepare_for_device_copy@experimental@oneapi@ext@_V1@sycl@@YAXPEBX_KAEBVqueue@45@@Z +?print_graph@modifiable_command_graph@detail@experimental@oneapi@ext@_V1@sycl@@IEBAXVstring_view@267@_N@Z ?print_graph@modifiable_command_graph@detail@experimental@oneapi@ext@_V1@sycl@@QEBAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z ?processArg@handler@_V1@sycl@@AEAAXPEAXAEBW4kernel_param_kind_t@detail@23@H_KAEA_K_N4@Z ?query@tls_code_loc_t@detail@_V1@sycl@@QEAAAEBUcode_location@234@XZ From 08d88f4a4995bea92bf9615cfcf758f68f6a7248 Mon Sep 17 00:00:00 2001 From: aelovikov-intel Date: Wed, 27 Nov 2024 08:42:03 -0800 Subject: [PATCH 2/2] Update sycl/include/sycl/ext/oneapi/experimental/graph.hpp --- sycl/include/sycl/ext/oneapi/experimental/graph.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp index 13d9d1ea4045e..44be91274a60a 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp @@ -383,6 +383,7 @@ class __SYCL_EXPORT modifiable_command_graph { }; #ifdef __SYCL_GRAPH_IMPL_CPP +// Magic combination found by trial and error: __SYCL_EXPORT #if WIN32 inline