Skip to content

Commit 93635e6

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

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

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

Lines changed: 17 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,31 @@ 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+
// Magic combination found by trial and error:
387+
__SYCL_EXPORT
388+
#if WIN32
389+
inline
390+
#endif
391+
#else
392+
inline
393+
#endif
394+
void
395+
modifiable_command_graph::print_graph(const std::string path,
396+
bool verbose) const {
397+
print_graph(sycl::detail::string_view{path}, verbose);
398+
}
399+
392400
// Templateless executable command-graph base class.
393401
class __SYCL_EXPORT executable_command_graph {
394402
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
@@ -3616,6 +3616,7 @@ _ZNK4sycl3_V13ext6oneapi12experimental21dynamic_command_group14get_active_cgfEv
36163616
_ZNK4sycl3_V13ext6oneapi12experimental4node14get_successorsEv
36173617
_ZNK4sycl3_V13ext6oneapi12experimental4node16get_predecessorsEv
36183618
_ZNK4sycl3_V13ext6oneapi12experimental4node8get_typeEv
3619+
_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph11print_graphENS0_6detail11string_viewEb
36193620
_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph11print_graphENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb
36203621
_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph14get_root_nodesEv
36213622
_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
@@ -4207,6 +4207,7 @@
42074207
?prefetch@queue@_V1@sycl@@QEAA?AVevent@23@PEBX_KV423@AEBUcode_location@detail@23@@Z
42084208
?prepare_for_device_copy@experimental@oneapi@ext@_V1@sycl@@YAXPEBX_KAEBVcontext@45@@Z
42094209
?prepare_for_device_copy@experimental@oneapi@ext@_V1@sycl@@YAXPEBX_KAEBVqueue@45@@Z
4210+
?print_graph@modifiable_command_graph@detail@experimental@oneapi@ext@_V1@sycl@@IEBAXVstring_view@267@_N@Z
42104211
?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
42114212
?processArg@handler@_V1@sycl@@AEAAXPEAXAEBW4kernel_param_kind_t@detail@23@H_KAEA_K_N4@Z
42124213
?query@tls_code_loc_t@detail@_V1@sycl@@QEAAAEBUcode_location@234@XZ

0 commit comments

Comments
 (0)