Skip to content

[SYCL] Support print_graph with pre-C++11 ABI in non-preview mode #16194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions sycl/include/sycl/ext/oneapi/experimental/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<node> get_nodes() const;
Expand Down Expand Up @@ -378,17 +372,31 @@ 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 <class Obj>
friend const decltype(Obj::impl) &
sycl::detail::getSyclObjImpl(const Obj &SyclObject);
template <class T>
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<detail::graph_impl> impl;
};

#ifdef __SYCL_GRAPH_IMPL_CPP
// Magic combination found by trial and error:
__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:
Expand Down
8 changes: 2 additions & 6 deletions sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//

#define __SYCL_GRAPH_IMPL_CPP

#include <detail/graph_impl.hpp>
#include <detail/handler_impl.hpp>
#include <detail/kernel_arg_mask.hpp>
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/sycl_symbols_windows.dump
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down