Skip to content

Commit 47461cb

Browse files
[SYCL] Support print_graph with pre-C++11 ABI in non-preview mode
intel#15694 implemented the change under `-fpreview-breaking-changes` guard but we can do better than that.
1 parent b5dfdc2 commit 47461cb

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

sycl/include/sycl/ext/oneapi/experimental/graph.hpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,7 @@ class __SYCL_EXPORT modifiable_command_graph {
335335
/// @param path The path to write the DOT file to.
336336
/// @param verbose If true, print additional information about the nodes such
337337
/// as kernel args or memory access where applicable.
338-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
339-
void print_graph(const std::string path, bool verbose = false) const {
340-
print_graph(sycl::detail::string_view{path}, verbose);
341-
}
342-
#else
343338
void print_graph(const std::string path, bool verbose = false) const;
344-
#endif
345339

346340
/// Get a list of all nodes contained in this graph.
347341
std::vector<node> get_nodes() const;
@@ -378,17 +372,30 @@ class __SYCL_EXPORT modifiable_command_graph {
378372
/// added as dependencies.
379373
void addGraphLeafDependencies(node Node);
380374

375+
void print_graph(sycl::detail::string_view path, bool verbose = false) const;
376+
381377
template <class Obj>
382378
friend const decltype(Obj::impl) &
383379
sycl::detail::getSyclObjImpl(const Obj &SyclObject);
384380
template <class T>
385381
friend T sycl::detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
386-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
387-
void print_graph(sycl::detail::string_view path, bool verbose = false) const;
388-
#endif
389382
std::shared_ptr<detail::graph_impl> impl;
390383
};
391384

385+
#ifdef __SYCL_GRAPH_IMPL_CPP
386+
__SYCL_EXPORT
387+
#if WIN32
388+
inline
389+
#endif
390+
#else
391+
inline
392+
#endif
393+
void
394+
modifiable_command_graph::print_graph(const std::string path,
395+
bool verbose) const {
396+
print_graph(sycl::detail::string_view{path}, verbose);
397+
}
398+
392399
// Templateless executable command-graph base class.
393400
class __SYCL_EXPORT executable_command_graph {
394401
public:

sycl/source/detail/graph_impl.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#define __SYCL_GRAPH_IMPL_CPP
10+
911
#include <detail/graph_impl.hpp>
1012
#include <detail/handler_impl.hpp>
1113
#include <detail/kernel_arg_mask.hpp>
@@ -1757,15 +1759,9 @@ void modifiable_command_graph::end_recording(
17571759
}
17581760
}
17591761

1760-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
17611762
void modifiable_command_graph::print_graph(sycl::detail::string_view pathstr,
1762-
#else
1763-
void modifiable_command_graph::print_graph(std::string path,
1764-
#endif
17651763
bool verbose) const {
1766-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
17671764
std::string path{pathstr.data()};
1768-
#endif
17691765
graph_impl::ReadLock Lock(impl->MMutex);
17701766
if (path.substr(path.find_last_of(".") + 1) == "dot") {
17711767
impl->printGraphAsDot(path, verbose);

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,6 +3613,7 @@ _ZNK4sycl3_V13ext6oneapi12experimental21dynamic_command_group14get_active_cgfEv
36133613
_ZNK4sycl3_V13ext6oneapi12experimental4node14get_successorsEv
36143614
_ZNK4sycl3_V13ext6oneapi12experimental4node16get_predecessorsEv
36153615
_ZNK4sycl3_V13ext6oneapi12experimental4node8get_typeEv
3616+
_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph11print_graphENS0_6detail11string_viewEb
36163617
_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph11print_graphENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb
36173618
_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph14get_root_nodesEv
36183619
_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph8finalizeERKNS0_13property_listE

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4202,6 +4202,7 @@
42024202
?prefetch@queue@_V1@sycl@@QEAA?AVevent@23@PEBX_KV423@AEBUcode_location@detail@23@@Z
42034203
?prepare_for_device_copy@experimental@oneapi@ext@_V1@sycl@@YAXPEBX_KAEBVcontext@45@@Z
42044204
?prepare_for_device_copy@experimental@oneapi@ext@_V1@sycl@@YAXPEBX_KAEBVqueue@45@@Z
4205+
?print_graph@modifiable_command_graph@detail@experimental@oneapi@ext@_V1@sycl@@IEBAXVstring_view@267@_N@Z
42054206
?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
42064207
?processArg@handler@_V1@sycl@@AEAAXPEAXAEBW4kernel_param_kind_t@detail@23@H_KAEA_K_N4@Z
42074208
?query@tls_code_loc_t@detail@_V1@sycl@@QEAAAEBUcode_location@234@XZ

0 commit comments

Comments
 (0)