Skip to content

[SYCL] Improve UX for abi_check.py tool #2141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 89 additions & 85 deletions sycl/test/abi/pi_level0_symbol_check.dump
Original file line number Diff line number Diff line change
@@ -1,105 +1,109 @@
################################################################################
# This file is automatically generated by abi_check.py tool.
# DO NOT EDIT IT MANUALLY. Refer to sycl/docs/ABIPolicyGuide.md for more info.
################################################################################

# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir python %sycl_tools_src_dir/abi_check.py --mode check_symbols --reference %s %sycl_libs_dir/libpi_level0.so
# REQUIRES: linux

piDeviceGetInfo
piextContextGetNativeHandle
piEnqueueMemImageWrite
piEnqueueMemBufferWrite
piextUSMFree
piEnqueueNativeKernel
piProgramRetain
piProgramGetBuildInfo
piextUSMEnqueueMemAdvise
piKernelCreate
piKernelGetSubGroupInfo
piextUSMEnqueueMemset
piSamplerRetain
piEventRelease
piextDeviceCreateWithNativeHandle
piEventSetCallback
piSamplerRelease
piextMemCreateWithNativeHandle
piEventRetain
piProgramLink
piextUSMSharedAlloc
piContextCreate
piSamplerGetInfo
piEnqueueMemImageCopy
piextMemGetNativeHandle
piEnqueueMemBufferMap
piPluginInit
piextQueueCreateWithNativeHandle
piContextGetInfo
piContextRelease
piextProgramCreateWithNativeHandle
piMemBufferCreate
piextUSMGetMemAllocInfo
piContextRetain
piDeviceGetInfo
piDevicePartition
piDeviceRelease
piDeviceRetain
piDevicesGet
piKernelRetain
piSamplerCreate
piEnqueueEventsWait
piEnqueueEventsWaitWithBarrier
piEnqueueKernelLaunch
piEnqueueMemBufferCopy
piEnqueueMemBufferCopyRect
piEnqueueMemBufferFill
piEnqueueMemBufferMap
piEnqueueMemBufferRead
piPlatformGetInfo
piContextRetain
piextDeviceSelectBinary
piEnqueueMemBufferReadRect
piEnqueueMemBufferWrite
piEnqueueMemBufferWriteRect
piEnqueueMemImageCopy
piEnqueueMemImageFill
piDeviceRelease
piQueueFinish
piEnqueueMemImageRead
piEnqueueMemImageWrite
piEnqueueMemUnmap
piEnqueueNativeKernel
piEventCreate
piEventGetInfo
piEventGetProfilingInfo
piEventRelease
piEventRetain
piEventSetCallback
piEventSetStatus
piEventsWait
piKernelCreate
piKernelGetGroupInfo
piKernelGetInfo
piKernelGetSubGroupInfo
piKernelRelease
piKernelRetain
piKernelSetArg
piKernelSetExecInfo
piMemBufferCreate
piMemBufferPartition
piMemGetInfo
piMemImageCreate
piMemImageGetInfo
piMemRelease
piMemRetain
piPlatformGetInfo
piPlatformsGet
piPluginInit
piProgramBuild
piProgramCompile
piMemGetInfo
piextProgramSetSpecializationConstant
piextQueueGetNativeHandle
piEnqueueMemImageRead
piextUSMEnqueueMemcpy
piProgramCreate
piextContextSetExtendedDeleter
piProgramBuild
piKernelSetExecInfo
piPlatformsGet
piEnqueueMemBufferFill
piMemRetain
piextUSMEnqueuePrefetch
piextKernelSetArgPointer
piEnqueueEventsWait
piEnqueueEventsWaitWithBarrier
piEnqueueMemBufferCopy
piProgramCreateWithBinary
piProgramGetBuildInfo
piProgramGetInfo
piProgramLink
piProgramRelease
piProgramRetain
piQueueCreate
piQueueFinish
piQueueGetInfo
piDevicePartition
piQueueRelease
piQueueRetain
piextDeviceGetNativeHandle
piEventGetInfo
piMemImageGetInfo
piContextGetInfo
piSamplerCreate
piSamplerGetInfo
piSamplerRelease
piSamplerRetain
piclProgramCreateWithSource
piextProgramGetNativeHandle
piEventGetProfilingInfo
piProgramGetInfo
piextContextCreateWithNativeHandle
piextContextGetNativeHandle
piextContextSetExtendedDeleter
piextDeviceCreateWithNativeHandle
piextDeviceGetNativeHandle
piextDeviceSelectBinary
piextEventCreateWithNativeHandle
piextEventGetNativeHandle
piextGetDeviceFunctionPointer
piEnqueueMemUnmap
piextKernelSetArgMemObj
piextKernelSetArgPointer
piextKernelSetArgSampler
piQueueCreate
piEventCreate
piKernelGetInfo
piQueueRelease
piKernelSetArg
piEnqueueMemBufferCopyRect
piEnqueueKernelLaunch
piextContextCreateWithNativeHandle
piProgramCreateWithBinary
piKernelGetGroupInfo
piextEventCreateWithNativeHandle
piEventsWait
piMemRelease
piProgramRelease
piDeviceRetain
piextMemCreateWithNativeHandle
piextMemGetNativeHandle
piextPlatformCreateWithNativeHandle
piextPlatformGetNativeHandle
piextProgramCreateWithNativeHandle
piextProgramGetNativeHandle
piextProgramSetSpecializationConstant
piextQueueCreateWithNativeHandle
piextQueueGetNativeHandle
piextUSMDeviceAlloc
piEventSetStatus
piextEventGetNativeHandle
piEnqueueMemBufferReadRect
piMemBufferPartition
piEnqueueMemBufferWriteRect
piextUSMEnqueueMemAdvise
piextUSMEnqueueMemcpy
piextUSMEnqueueMemset
piextUSMEnqueuePrefetch
piextUSMFree
piextUSMGetMemAllocInfo
piextUSMHostAlloc
piextPlatformGetNativeHandle
piextPlatformCreateWithNativeHandle

piextUSMSharedAlloc
17 changes: 11 additions & 6 deletions sycl/test/abi/pi_opencl_symbol_check.dump
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
################################################################################
# This file is automatically generated by abi_check.py tool.
# DO NOT EDIT IT MANUALLY. Refer to sycl/docs/ABIPolicyGuide.md for more info.
################################################################################

# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir python %sycl_tools_src_dir/abi_check.py --mode check_symbols --reference %s %sycl_libs_dir/libpi_opencl.so
# REQUIRES: linux

Expand All @@ -14,25 +19,27 @@ piMemImageCreate
piPlatformsGet
piPluginInit
piProgramCreate
piProgramCreateWithBinary
piProgramLink
piQueueCreate
piSamplerCreate
piProgramCreateWithBinary
piclProgramCreateWithSource
piextContextCreateWithNativeHandle
piextContextGetNativeHandle
piextDeviceCreateWithNativeHandle
piextDeviceSelectBinary
piextDeviceGetNativeHandle
piextDeviceSelectBinary
piextEventCreateWithNativeHandle
piextGetDeviceFunctionPointer
piextProgramGetNativeHandle
piextKernelSetArgMemObj
piextKernelSetArgSampler
piextKernelSetArgPointer
piextKernelSetArgSampler
piextMemCreateWithNativeHandle
piextMemGetNativeHandle
piextPlatformCreateWithNativeHandle
piextPlatformGetNativeHandle
piextProgramCreateWithNativeHandle
piextProgramGetNativeHandle
piextProgramSetSpecializationConstant
piextQueueCreateWithNativeHandle
piextQueueGetNativeHandle
Expand All @@ -45,5 +52,3 @@ piextUSMFree
piextUSMGetMemAllocInfo
piextUSMHostAlloc
piextUSMSharedAlloc
piextPlatformGetNativeHandle
piextPlatformCreateWithNativeHandle
20 changes: 12 additions & 8 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
################################################################################
# This file is automatically generated by abi_check.py tool.
# DO NOT EDIT IT MANUALLY. Refer to sycl/docs/ABIPolicyGuide.md for more info.
################################################################################

# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir python %sycl_tools_src_dir/abi_check.py --mode check_symbols --reference %s %sycl_libs_dir/libsycl.so
# REQUIRES: linux

Expand Down Expand Up @@ -3724,7 +3729,9 @@ _ZN2cl4sycl6detail13MemoryManager13releaseMemObjESt10shared_ptrINS1_12context_im
_ZN2cl4sycl6detail13MemoryManager16allocateMemImageESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEPvbmRK14_pi_image_descRK16_pi_image_formatRKS3_INS1_10event_implEERKS5_RP9_pi_event
_ZN2cl4sycl6detail13MemoryManager17allocateMemBufferESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEPvbmRKS3_INS1_10event_implEERKS5_RP9_pi_event
_ZN2cl4sycl6detail13MemoryManager18allocateHostMemoryEPNS1_11SYCLMemObjIEPvbm
_ZN2cl4sycl6detail13MemoryManager18releaseImageBufferESt10shared_ptrINS1_12context_implEEPv
_ZN2cl4sycl6detail13MemoryManager19allocateImageObjectESt10shared_ptrINS1_12context_implEEPvbRK14_pi_image_descRK16_pi_image_format
_ZN2cl4sycl6detail13MemoryManager19wrapIntoImageBufferESt10shared_ptrINS1_12context_implEEPvPNS1_11SYCLMemObjIE
_ZN2cl4sycl6detail13MemoryManager20allocateBufferObjectESt10shared_ptrINS1_12context_implEEPvbm
_ZN2cl4sycl6detail13MemoryManager20allocateMemSubBufferESt10shared_ptrINS1_12context_implEEPvmmNS0_5rangeILi3EEESt6vectorIS3_INS1_10event_implEESaISB_EERP9_pi_event
_ZN2cl4sycl6detail13MemoryManager24allocateInteropMemObjectESt10shared_ptrINS1_12context_implEEPvRKS3_INS1_10event_implEERKS5_RP9_pi_event
Expand All @@ -3736,8 +3743,6 @@ _ZN2cl4sycl6detail13MemoryManager7releaseESt10shared_ptrINS1_12context_implEEPNS
_ZN2cl4sycl6detail13MemoryManager8allocateESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEbPvSt6vectorIS3_INS1_10event_implEESaISB_EERP9_pi_event
_ZN2cl4sycl6detail13MemoryManager8copy_usmEPKvSt10shared_ptrINS1_10queue_implEEmPvSt6vectorIP9_pi_eventSaISB_EERSB_
_ZN2cl4sycl6detail13MemoryManager8fill_usmEPvSt10shared_ptrINS1_10queue_implEEmiSt6vectorIP9_pi_eventSaIS9_EERS9_
_ZN2cl4sycl6detail13MemoryManager18releaseImageBufferESt10shared_ptrINS1_12context_implEEPv
_ZN2cl4sycl6detail13MemoryManager19wrapIntoImageBufferESt10shared_ptrINS1_12context_implEEPvPNS1_11SYCLMemObjIE
_ZN2cl4sycl6detail14getBorderColorENS0_19image_channel_orderE
_ZN2cl4sycl6detail14host_half_impl4halfC1ERKf
_ZN2cl4sycl6detail14host_half_impl4halfC2ERKf
Expand Down Expand Up @@ -3784,6 +3789,10 @@ _ZN2cl4sycl6kernelC1EP10_cl_kernelRKNS0_7contextE
_ZN2cl4sycl6kernelC1ESt10shared_ptrINS0_6detail11kernel_implEE
_ZN2cl4sycl6kernelC2EP10_cl_kernelRKNS0_7contextE
_ZN2cl4sycl6kernelC2ESt10shared_ptrINS0_6detail11kernel_implEE
_ZN2cl4sycl6level010make_queueERKNS0_7contextEm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should sort symbols to make it easier to understand what symbols were changed between releases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script sorts symbols:

symbols.sort()

Developers, however, not necessarily use it. This is why I also updated header to discourage people from editing these files manually.

_ZN2cl4sycl6level011make_deviceERKNS0_8platformEm
_ZN2cl4sycl6level012make_programERKNS0_7contextEm
_ZN2cl4sycl6level013make_platformEm
_ZN2cl4sycl6mallocEmRKNS0_5queueENS0_3usm5allocE
_ZN2cl4sycl6mallocEmRKNS0_6deviceERKNS0_7contextENS0_3usm5allocE
_ZN2cl4sycl6opencl10make_queueERKNS0_7contextEm
Expand Down Expand Up @@ -4044,6 +4053,7 @@ _ZNK2cl4sycl7program7is_hostEv
_ZNK2cl4sycl7program8get_infoILNS0_4info7programE4448EEENS3_12param_traitsIS4_XT_EE11return_typeEv
_ZNK2cl4sycl7program8get_infoILNS0_4info7programE4449EEENS3_12param_traitsIS4_XT_EE11return_typeEv
_ZNK2cl4sycl7program8get_infoILNS0_4info7programE4451EEENS3_12param_traitsIS4_XT_EE11return_typeEv
_ZNK2cl4sycl7program9getNativeEv
_ZNK2cl4sycl7program9get_stateEv
_ZNK2cl4sycl7sampler18get_filtering_modeEv
_ZNK2cl4sycl7sampler19get_addressing_modeEv
Expand All @@ -4067,9 +4077,3 @@ _ZNK2cl4sycl9exception11has_contextEv
_ZNK2cl4sycl9exception4whatEv
__sycl_register_lib
__sycl_unregister_lib
_ZN2cl4sycl6level011make_deviceERKNS0_8platformEm
_ZN2cl4sycl6level010make_queueERKNS0_7contextEm
_ZN2cl4sycl6level012make_programERKNS0_7contextEm
_ZN2cl4sycl6level013make_platformEm
_ZNK2cl4sycl8platform9getNativeEv
_ZNK2cl4sycl7program9getNativeEv
12 changes: 12 additions & 0 deletions sycl/tools/abi_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,23 @@ def parse_readobj_output(output):

def dump_symbols(target_path, output):
with open(output, "w") as out:
out.write("################################################################################")
out.write("\n# This file is automatically generated by abi_check.py tool.")
out.write("\n# DO NOT EDIT IT MANUALLY. Refer to sycl/docs/ABIPolicyGuide.md for more info.")
out.write("\n################################################################################")
out.write("\n\n# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir python")
out.write(" %sycl_tools_src_dir/abi_check.py --mode check_symbols")
out.write(" --reference %s %sycl_libs_dir/")
out.write(os.path.basename(target_path))
# TODO properly put OS name once Windows is supported
out.write("\n# REQUIRES: linux")
out.write("\n\n")
readobj_out = subprocess.check_output([get_llvm_bin_path()+"llvm-readobj",
"-t", target_path])
symbols = parse_readobj_output(readobj_out)
symbols.sort()
out.write("\n".join(symbols))
out.write("\n")


def compare_results(ref_records, records):
Expand Down