Skip to content

Commit 7281d69

Browse files
[SYCL] Fix ignored_symbols processing in aby_check.py (#7138)
Same should be done both when checking the symbols and when generating the ref list.
1 parent a0254c9 commit 7281d69

File tree

2 files changed

+47
-49
lines changed

2 files changed

+47
-49
lines changed

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,7 @@
412412
??0gpu_selector@_V1@sycl@@QEAA@$$QEAV012@@Z
413413
??0gpu_selector@_V1@sycl@@QEAA@AEBV012@@Z
414414
??0gpu_selector@_V1@sycl@@QEAA@XZ
415-
??0half@host_half_impl@detail@_V1@sycl@@QEAA@$$QEAV01234@@Z
416415
??0half@host_half_impl@detail@_V1@sycl@@QEAA@AEBM@Z
417-
??0half@host_half_impl@detail@_V1@sycl@@QEAA@AEBV01234@@Z
418416
??0half@host_half_impl@detail@_V1@sycl@@QEAA@G@Z
419417
??0handler@_V1@sycl@@AEAA@V?$shared_ptr@Vqueue_impl@detail@_V1@sycl@@@std@@00_N@Z
420418
??0handler@_V1@sycl@@AEAA@V?$shared_ptr@Vqueue_impl@detail@_V1@sycl@@@std@@_N@Z

sycl/tools/abi_check.py

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,53 @@ def parse_readobj_output(output):
5151
sym_section = re.search(r"(?<=Section:\s)[\.\w]+", sym)
5252
if match_symbol(sym_binding, sym_type, sym_section):
5353
parsed_symbols.append(name.group())
54+
55+
# Presence of _dl_relocate_static_pie depends on whether ld.gold or ld.lld
56+
# is used. Ignore it for the purpose of the library ABI check.
57+
ignore_symbols = ["_dl_relocate_static_pie"]
58+
59+
# In some scenarios MSVC and clang-cl exhibit differences in regards to the exported symbols they generate.
60+
# Some of them happen in the SYCL RT library and we think clang-cl's behavior is more reasonable.
61+
#
62+
# Case 1:
63+
# pi.hpp:
64+
# template <backend BE> __SYCL_EXPORT const plugin &getPlugin();
65+
#
66+
# pi.cpp:
67+
# template <backend BE> const plugin &getPlugin() {
68+
# static const plugin *Plugin = nullptr;
69+
# ...
70+
# }
71+
# // explicit dllexport instantiations.
72+
#
73+
# clang-cl generates exported symbols for the static variables Plugin. These are never referenced
74+
# in the user's headers so cannot be used outside DLL and not exporting them should not affect any
75+
# usage scenario.
76+
#
77+
# In general, the compiler doesn't know if the definition is in the DLL or in the header and inline
78+
# dllexport/dllimport functions have to be supported, hence clang-cl's behavior.
79+
#
80+
# See also https://devblogs.microsoft.com/oldnewthing/20140109-00/?p=2123.
81+
ignore_symbols += ["?Plugin@?1???$getPlugin@$01@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB",
82+
"?Plugin@?1???$getPlugin@$00@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB",
83+
"?Plugin@?1???$getPlugin@$04@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB",
84+
"?Plugin@?1???$getPlugin@$02@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB"]
85+
# Case 2:
86+
# half_type.hpp:
87+
# class __SYCL_EXPORT half {
88+
# ...
89+
# constexpr half(const half &) = default;
90+
# constexpr half(half &&) = default;
91+
# ...
92+
# };
93+
#
94+
# For some reason MSVC creates exported symbols for the constexpr versions of those defaulted ctors
95+
# although it never calls them at use point. Instead, those trivially copyable/moveable objects are
96+
# memcpy/memmove'ed. We don't expect these symbols are ever referenced directly so having or not
97+
# having them won't cause ABI issues.
98+
ignore_symbols += ["??0half@host_half_impl@detail@_V1@sycl@@QEAA@AEBV01234@@Z",
99+
"??0half@host_half_impl@detail@_V1@sycl@@QEAA@$$QEAV01234@@Z"]
100+
parsed_symbols = [s for s in parsed_symbols if s not in ignore_symbols]
54101
return parsed_symbols
55102

56103

@@ -103,53 +150,6 @@ def check_symbols(ref_path, target_path):
103150
readobj_opts, target_path])
104151
symbols = parse_readobj_output(readobj_out)
105152

106-
# Presence of _dl_relocate_static_pie depends on whether ld.gold or ld.lld
107-
# is used. Ignore it for the purpose of the library ABI check.
108-
ignore_symbols = ["_dl_relocate_static_pie"]
109-
110-
# In some scenarios MSVC and clang-cl exhibit differences in regards to the exported symbols they generate.
111-
# Some of them happen in the SYCL RT library and we think clang-cl's behavior is more reasonable.
112-
#
113-
# Case 1:
114-
# pi.hpp:
115-
# template <backend BE> __SYCL_EXPORT const plugin &getPlugin();
116-
#
117-
# pi.cpp:
118-
# template <backend BE> const plugin &getPlugin() {
119-
# static const plugin *Plugin = nullptr;
120-
# ...
121-
# }
122-
# // explicit dllexport instantiations.
123-
#
124-
# clang-cl generates exported symbols for the static variables Plugin. These are never referenced
125-
# in the user's headers so cannot be used outside DLL and not exporting them should not affect any
126-
# usage scenario.
127-
#
128-
# In general, the compiler doesn't know if the definition is in the DLL or in the header and inline
129-
# dllexport/dllimport functions have to be supported, hence clang-cl's behavior.
130-
#
131-
# See also https://devblogs.microsoft.com/oldnewthing/20140109-00/?p=2123.
132-
ignore_symbols += ["?Plugin@?1???$getPlugin@$01@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB",
133-
"?Plugin@?1???$getPlugin@$00@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB",
134-
"?Plugin@?1???$getPlugin@$04@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB",
135-
"?Plugin@?1???$getPlugin@$02@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB"]
136-
# Case 2:
137-
# half_type.hpp:
138-
# class __SYCL_EXPORT half {
139-
# ...
140-
# constexpr half(const half &) = default;
141-
# constexpr half(half &&) = default;
142-
# ...
143-
# };
144-
#
145-
# For some reason MSVC creates exported symbols for the constexpr versions of those defaulted ctors
146-
# although it never calls them at use point. Instead, those trivially copyable/moveable objects are
147-
# memcpy/memmove'ed. We don't expect these symbols are ever referenced directly so having or not
148-
# having them won't cause ABI issues.
149-
ignore_symbols += ["??0half@host_half_impl@detail@_V1@sycl@@QEAA@AEBV01234@@Z",
150-
"??0half@host_half_impl@detail@_V1@sycl@@QEAA@$$QEAV01234@@Z"]
151-
symbols = [s for s in symbols if s not in ignore_symbols]
152-
153153
missing_symbols, new_symbols = compare_results(ref_symbols, symbols)
154154

155155
correct_return = True

0 commit comments

Comments
 (0)