Skip to content

Commit 2d42dd6

Browse files
[SYCL] Support pipe_base::get_pipe_name compiled with pre-C++11 ABI (#16178)
1 parent b0212c3 commit 2d42dd6

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

sycl/include/sycl/ext/intel/experimental/pipes.hpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,41 @@ class pipe_base {
4646
pipe_base() = default;
4747
~pipe_base() = default;
4848

49+
__SYCL_EXPORT static sycl::detail::string
50+
get_pipe_name_impl(const void *HostPipePtr);
51+
52+
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
53+
static std::string get_pipe_name(const void *HostPipePtr) {
54+
return {get_pipe_name_impl(HostPipePtr).c_str()};
55+
}
56+
#else
4957
__SYCL_EXPORT static std::string get_pipe_name(const void *HostPipePtr);
58+
#endif
59+
5060
__SYCL_EXPORT static bool wait_non_blocking(const event &E);
5161
};
5262

63+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
64+
// We want all "new" uses/recompilation to use the "inline" version, yet we
65+
// still need to provide an exported symbol for the code that was compiled
66+
// before that. Make sure we use "inline" everywhere except when compiling
67+
// `pipes.cpp` so that we'd still provide this backward-compatibility ABI symbol
68+
// via `pipes.cpp` TU.
69+
#ifdef __SYCL_PIPES_CPP
70+
// Magic combination found by trial and error:
71+
__SYCL_EXPORT
72+
#ifdef WIN32
73+
inline
74+
#endif
75+
#else
76+
inline
77+
#endif
78+
std::string
79+
pipe_base::get_pipe_name(const void *HostPipePtr) {
80+
return {get_pipe_name_impl(HostPipePtr).c_str()};
81+
}
82+
#endif
83+
5384
template <class _name, class _dataT, int32_t _min_capacity = 0,
5485
class _propertiesT = decltype(oneapi::experimental::properties{}),
5586
class = void>

sycl/source/detail/pipes.cpp

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

9+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
10+
#define __SYCL_PIPES_CPP
11+
#endif
12+
913
#include <detail/event_impl.hpp>
1014
#include <detail/host_pipe_map_entry.hpp>
1115
#include <detail/program_manager/program_manager.hpp>
@@ -16,11 +20,11 @@ inline namespace _V1 {
1620
namespace ext {
1721
namespace intel {
1822
namespace experimental {
19-
20-
__SYCL_EXPORT std::string pipe_base::get_pipe_name(const void *HostPipePtr) {
21-
return sycl::_V1::detail::ProgramManager::getInstance()
22-
.getHostPipeEntry(HostPipePtr)
23-
->MUniqueId;
23+
__SYCL_EXPORT sycl::detail::string
24+
pipe_base::get_pipe_name_impl(const void *HostPipePtr) {
25+
return {std::string_view{sycl::_V1::detail::ProgramManager::getInstance()
26+
.getHostPipeEntry(HostPipePtr)
27+
->MUniqueId}};
2428
}
2529

2630
__SYCL_EXPORT bool pipe_base::wait_non_blocking(const event &E) {

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,6 +2991,7 @@ _ZN4sycl3_V13ext5intel12experimental15online_compilerILNS3_15source_languageE1EE
29912991
_ZN4sycl3_V13ext5intel12experimental15online_compilerILNS3_15source_languageE1EE7compileIJSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISE_EEEEES8_IhSaIhEERKSE_DpRKT_
29922992
_ZN4sycl3_V13ext5intel12experimental9pipe_base13get_pipe_nameB5cxx11EPKv
29932993
_ZN4sycl3_V13ext5intel12experimental9pipe_base17wait_non_blockingERKNS0_5eventE
2994+
_ZN4sycl3_V13ext5intel12experimental9pipe_base18get_pipe_name_implEPKv
29942995
_ZN4sycl3_V13ext6oneapi10level_zero6detail11make_deviceERKNS0_8platformEm
29952996
_ZN4sycl3_V13ext6oneapi12experimental10mem_adviseENS0_5queueEPvmiRKNS0_6detail13code_locationE
29962997
_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_16image_descriptorERKNS0_5queueE

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,6 +4057,7 @@
40574057
?get_nodes@modifiable_command_graph@detail@experimental@oneapi@ext@_V1@sycl@@QEBA?AV?$vector@Vnode@experimental@oneapi@ext@_V1@sycl@@V?$allocator@Vnode@experimental@oneapi@ext@_V1@sycl@@@std@@@std@@XZ
40584058
?get_num_channels@image_mem@experimental@oneapi@ext@_V1@sycl@@QEBAIXZ
40594059
?get_pipe_name@pipe_base@experimental@intel@ext@_V1@sycl@@KA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBX@Z
4060+
?get_pipe_name_impl@pipe_base@experimental@intel@ext@_V1@sycl@@KA?AVstring@detail@56@PEBX@Z
40604061
?get_pitch@image_plain@detail@_V1@sycl@@IEBA?AV?$range@$01@34@XZ
40614062
?get_platform@context@_V1@sycl@@QEBA?AVplatform@23@XZ
40624063
?get_platform@device@_V1@sycl@@QEBA?AVplatform@23@XZ

0 commit comments

Comments
 (0)