Skip to content

Commit 2f7b054

Browse files
[SYCL][test] Throw if order of ABI symbols is incorrect (#20424)
Recently, there were several occurrences where developers manually updated the ABI symbol dump file to add a new symbol. This results into unrelated changes on PRs when someone correctly uses `abi_check.py` file to regenerate the ABI symbols, (for example: #20422) This PR makes `abi_check.py` to fail if the order of ABI symbols is incorrect, thus discouraging developers from manually editing the symbol dump file.
1 parent 4dfc9b4 commit 2f7b054

File tree

4 files changed

+29
-9
lines changed

4 files changed

+29
-9
lines changed

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,12 +2985,12 @@ _ZN4sycl3_V121__isgreaterequal_implEdd
29852985
_ZN4sycl3_V121__isgreaterequal_implEff
29862986
_ZN4sycl3_V122accelerator_selector_vERKNS0_6deviceE
29872987
_ZN4sycl3_V128verifyUSMAllocatorPropertiesERKNS0_13property_listE
2988-
_ZN4sycl3_V139submit_kernel_direct_without_event_implILi1EEEvRKNS0_5queueERKNS0_8nd_rangeIXT_EEERNS0_6detail17HostKernelRefBaseEPNS9_16DeviceKernelInfoERKNS9_13code_locationEb
29892988
_ZN4sycl3_V136submit_kernel_direct_with_event_implILi1EEENS0_5eventERKNS0_5queueERKNS0_8nd_rangeIXT_EEERNS0_6detail17HostKernelRefBaseEPNSA_16DeviceKernelInfoERKNSA_13code_locationEb
2989+
_ZN4sycl3_V136submit_kernel_direct_with_event_implILi2EEENS0_5eventERKNS0_5queueERKNS0_8nd_rangeIXT_EEERNS0_6detail17HostKernelRefBaseEPNSA_16DeviceKernelInfoERKNSA_13code_locationEb
29902990
_ZN4sycl3_V136submit_kernel_direct_with_event_implILi3EEENS0_5eventERKNS0_5queueERKNS0_8nd_rangeIXT_EEERNS0_6detail17HostKernelRefBaseEPNSA_16DeviceKernelInfoERKNSA_13code_locationEb
2991+
_ZN4sycl3_V139submit_kernel_direct_without_event_implILi1EEEvRKNS0_5queueERKNS0_8nd_rangeIXT_EEERNS0_6detail17HostKernelRefBaseEPNS9_16DeviceKernelInfoERKNS9_13code_locationEb
29912992
_ZN4sycl3_V139submit_kernel_direct_without_event_implILi2EEEvRKNS0_5queueERKNS0_8nd_rangeIXT_EEERNS0_6detail17HostKernelRefBaseEPNS9_16DeviceKernelInfoERKNS9_13code_locationEb
29922993
_ZN4sycl3_V139submit_kernel_direct_without_event_implILi3EEEvRKNS0_5queueERKNS0_8nd_rangeIXT_EEERNS0_6detail17HostKernelRefBaseEPNS9_16DeviceKernelInfoERKNS9_13code_locationEb
2993-
_ZN4sycl3_V136submit_kernel_direct_with_event_implILi2EEENS0_5eventERKNS0_5queueERKNS0_8nd_rangeIXT_EEERNS0_6detail17HostKernelRefBaseEPNSA_16DeviceKernelInfoERKNSA_13code_locationEb
29942994
_ZN4sycl3_V13ext5intel12experimental9pipe_base13get_pipe_nameB5cxx11EPKv
29952995
_ZN4sycl3_V13ext5intel12experimental9pipe_base17wait_non_blockingERKNS0_5eventE
29962996
_ZN4sycl3_V13ext5intel12experimental9pipe_base18get_pipe_name_implEPKv
@@ -3579,6 +3579,7 @@ _ZN4sycl3_V17handler18RangeRoundingTraceEv
35793579
_ZN4sycl3_V17handler18ext_oneapi_barrierERKSt6vectorINS0_5eventESaIS3_EE
35803580
_ZN4sycl3_V17handler18extractArgsAndReqsEv
35813581
_ZN4sycl3_V17handler19getMaxWorkGroups_v2Ev
3582+
_ZN4sycl3_V17handler19setDeviceKernelInfoEONS0_6kernelE
35823583
_ZN4sycl3_V17handler19supportsUSMMemcpy2DEv
35833584
_ZN4sycl3_V17handler19supportsUSMMemset2DEv
35843585
_ZN4sycl3_V17handler20DisableRangeRoundingEv
@@ -3601,7 +3602,6 @@ _ZN4sycl3_V17handler21setKernelWorkGroupMemEm
36013602
_ZN4sycl3_V17handler21setUserFacingNodeTypeENS0_3ext6oneapi12experimental9node_typeE
36023603
_ZN4sycl3_V17handler22ext_oneapi_fill2d_implEPvmPKvmmm
36033604
_ZN4sycl3_V17handler22memcpyFromDeviceGlobalEPvPKvbmm
3604-
_ZN4sycl3_V17handler19setDeviceKernelInfoEONS0_6kernelE
36053605
_ZN4sycl3_V17handler22setDeviceKernelInfoPtrEPNS0_6detail16DeviceKernelInfoE
36063606
_ZN4sycl3_V17handler22setHandlerKernelBundleENS0_6kernelE
36073607
_ZN4sycl3_V17handler22setHandlerKernelBundleERKSt10shared_ptrINS0_6detail18kernel_bundle_implEE

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,10 @@
288288
??$is_image_handle_supported@Uunsampled_image_handle@experimental@oneapi@ext@_V1@sycl@@@experimental@oneapi@ext@_V1@sycl@@YA_NAEBUimage_descriptor@01234@W4image_memory_handle_type@01234@AEBVqueue@34@@Z
289289
??$submit_kernel_direct_with_event_impl@$00@_V1@sycl@@YA?AVevent@01@AEBVqueue@01@AEBV?$nd_range@$00@01@AEAVHostKernelRefBase@detail@01@PEAVDeviceKernelInfo@601@AEBUcode_location@601@_N@Z
290290
??$submit_kernel_direct_with_event_impl@$01@_V1@sycl@@YA?AVevent@01@AEBVqueue@01@AEBV?$nd_range@$01@01@AEAVHostKernelRefBase@detail@01@PEAVDeviceKernelInfo@601@AEBUcode_location@601@_N@Z
291-
??$submit_kernel_direct_without_event_impl@$02@_V1@sycl@@YAXAEBVqueue@01@AEBV?$nd_range@$02@01@AEAVHostKernelRefBase@detail@01@PEAVDeviceKernelInfo@501@AEBUcode_location@501@_N@Z
291+
??$submit_kernel_direct_with_event_impl@$02@_V1@sycl@@YA?AVevent@01@AEBVqueue@01@AEBV?$nd_range@$02@01@AEAVHostKernelRefBase@detail@01@PEAVDeviceKernelInfo@601@AEBUcode_location@601@_N@Z
292292
??$submit_kernel_direct_without_event_impl@$00@_V1@sycl@@YAXAEBVqueue@01@AEBV?$nd_range@$00@01@AEAVHostKernelRefBase@detail@01@PEAVDeviceKernelInfo@501@AEBUcode_location@501@_N@Z
293293
??$submit_kernel_direct_without_event_impl@$01@_V1@sycl@@YAXAEBVqueue@01@AEBV?$nd_range@$01@01@AEAVHostKernelRefBase@detail@01@PEAVDeviceKernelInfo@501@AEBUcode_location@501@_N@Z
294-
??$submit_kernel_direct_with_event_impl@$02@_V1@sycl@@YA?AVevent@01@AEBVqueue@01@AEBV?$nd_range@$02@01@AEAVHostKernelRefBase@detail@01@PEAVDeviceKernelInfo@601@AEBUcode_location@601@_N@Z
294+
??$submit_kernel_direct_without_event_impl@$02@_V1@sycl@@YAXAEBVqueue@01@AEBV?$nd_range@$02@01@AEAVHostKernelRefBase@detail@01@PEAVDeviceKernelInfo@501@AEBUcode_location@501@_N@Z
295295
??$update_nd_range@$00@node@experimental@oneapi@ext@_V1@sycl@@QEAAXV?$nd_range@$00@45@@Z
296296
??$update_nd_range@$01@node@experimental@oneapi@ext@_V1@sycl@@QEAAXV?$nd_range@$01@45@@Z
297297
??$update_nd_range@$02@node@experimental@oneapi@ext@_V1@sycl@@QEAAXV?$nd_range@$02@45@@Z
@@ -4425,8 +4425,8 @@
44254425
?setKernelClusterLaunch@handler@_V1@sycl@@AEAAXV?$range@$01@23@@Z
44264426
?setKernelClusterLaunch@handler@_V1@sycl@@AEAAXV?$range@$02@23@@Z
44274427
?setKernelClusterLaunch@handler@_V1@sycl@@AEAAXV?$range@$02@23@H@Z
4428-
?setKernelInfo@handler@_V1@sycl@@AEAAXPEAXHP6A?AUkernel_param_desc_t@detail@23@H@Z_N2@Z
44294428
?setKernelFunc@handler@_V1@sycl@@AEAAXPEAX@Z
4429+
?setKernelInfo@handler@_V1@sycl@@AEAAXPEAXHP6A?AUkernel_param_desc_t@detail@23@H@Z_N2@Z
44304430
?setKernelIsCooperative@handler@_V1@sycl@@AEAAX_N@Z
44314431
?setKernelNameBasedCachePtr@handler@_V1@sycl@@AEAAXPEAUKernelNameBasedCacheT@detail@23@@Z
44324432
?setKernelWorkGroupMem@handler@_V1@sycl@@AEAAX_K@Z
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
_start
21
_Z3foov
2+
_start
33
main

sycl/tools/abi_check.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@ def compare_results(ref_records, records):
108108
missing_records = set(ref_records).difference(set(records))
109109
new_records = set(records).difference(set(ref_records))
110110

111-
return (missing_records, new_records)
111+
is_order_incorrect = False
112+
# If missing_records and new_records is null, check the order of symbols.
113+
if not missing_records and not new_records:
114+
if ref_records != records:
115+
is_order_incorrect = True
116+
117+
return (missing_records, new_records, is_order_incorrect)
112118

113119

114120
# Dumps symbols from from binary at target_path and compares with a snapshot
@@ -129,8 +135,11 @@ def check_symbols(ref_path, target_path, ignore_new):
129135
]
130136
)
131137
symbols = parse_readobj_output(readobj_out)
138+
symbols.sort()
132139

133-
missing_symbols, new_symbols = compare_results(ref_symbols, symbols)
140+
missing_symbols, new_symbols, is_order_incorrect = compare_results(
141+
ref_symbols, symbols
142+
)
134143

135144
correct_return = True
136145
if missing_symbols:
@@ -156,6 +165,17 @@ def check_symbols(ref_path, target_path, ignore_new):
156165
print("The following symbols are new to the object file:\n")
157166
print("\n".join(new_symbols))
158167

168+
if is_order_incorrect:
169+
correct_return = False
170+
print(
171+
(
172+
"The order of ABI symbols is incorrect. While it is not a breaking "
173+
"change, please refrain from manually editing the ABI symbol dump file. "
174+
"Refer to sycl/doc/developer/ABIPolicyGuide.md for instructions on automatically "
175+
"updating the ABI symbol dump file."
176+
)
177+
)
178+
159179
if not correct_return:
160180
sys.exit(-1)
161181

0 commit comments

Comments
 (0)