Skip to content

[SYCL][ABI-Break] Drop pi::assertion #14624

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
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
7 changes: 3 additions & 4 deletions sycl/include/sycl/detail/backend_traits_opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ namespace pi {
// Cast for std::vector<cl_event>, according to the spec, make_event
// should create one(?) event from a vector of cl_event
template <class To> inline To cast(std::vector<cl_event> value) {
sycl::detail::pi::assertion(
value.size() == 1,
"Temporary workaround requires that the "
"size of the input vector for make_event be equal to one.");
assert(value.size() == 1 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

technically, it's different behavior in release build (where new assert will be simply ignored), but I'm fine with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is more for correctness of our own SYCL RT code an all our tests are done with assertions enabled, so we should be able to catch it early still

"Temporary workaround requires that the "
"size of the input vector for make_event be equal to one.");
return cast<To>(value[0]);
}

Expand Down
6 changes: 1 addition & 5 deletions sycl/include/sycl/detail/pi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ bool trace(TraceLevel level);
// Report error and no return (keeps compiler happy about no return statements).
[[noreturn]] __SYCL_EXPORT void die(const char *Message);

__SYCL_EXPORT void assertion(bool Condition, const char *Message = nullptr);

using PiPlugin = ::pi_plugin;
using PiResult = ::pi_result;
using PiPlatform = ::pi_platform;
Expand Down Expand Up @@ -260,9 +258,7 @@ namespace pi {
// Want all the needed casts be explicit, do not define conversion
// operators.
template <class To, class From> inline To cast(From value) {
// TODO: see if more sanity checks are possible.
sycl::detail::pi::assertion((sizeof(From) == sizeof(To)),
"assert: cast failed size check");
static_assert(sizeof(From) == sizeof(To), "cast failed size check");
Copy link
Contributor

Choose a reason for hiding this comment

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

This could even have performance benefits! 🥳

return (To)(value);
}

Expand Down
9 changes: 2 additions & 7 deletions sycl/source/detail/pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ std::string platformInfoToString(pi_platform_info info) {
}

std::string memFlagToString(pi_mem_flags Flag) {
assertion(((Flag == 0u) || ((Flag & (Flag - 1)) == 0)) &&
"More than one bit set");
assert(((Flag == 0u) || ((Flag & (Flag - 1)) == 0)) &&
"More than one bit set");

std::stringstream Sstream;

Expand Down Expand Up @@ -522,11 +522,6 @@ template const PluginPtr &getPlugin<backend::ext_oneapi_hip>();
std::terminate();
}

void assertion(bool Condition, const char *Message) {
if (!Condition)
die(Message);
}

// Reads an integer value from ELF data.
template <typename ResT>
static ResT readELFValue(const unsigned char *Data, size_t NumBytes,
Expand Down
1 change: 0 additions & 1 deletion sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -3291,7 +3291,6 @@ _ZN4sycl3_V16detail28getPixelCoordNearestFiltModeENS0_3vecIfLi4EEENS0_15addressi
_ZN4sycl3_V16detail28getValueFromDynamicParameterERNS0_3ext6oneapi12experimental6detail22dynamic_parameter_baseE
_ZN4sycl3_V16detail2pi25contextSetExtendedDeleterERKNS0_7contextEPFvPvES6_
_ZN4sycl3_V16detail2pi3dieEPKc
_ZN4sycl3_V16detail2pi9assertionEbPKc
_ZN4sycl3_V16detail30UnsampledImageAccessorBaseHost10getAccDataEv
_ZN4sycl3_V16detail30UnsampledImageAccessorBaseHost6getPtrEv
_ZN4sycl3_V16detail30UnsampledImageAccessorBaseHostC1ENS0_5rangeILi3EEENS0_6access4modeEPviiNS0_2idILi3EEENS0_18image_channel_typeENS0_19image_channel_orderERKNS0_13property_listE
Expand Down
1 change: 0 additions & 1 deletion sycl/test/abi/sycl_symbols_windows.dump
Original file line number Diff line number Diff line change
Expand Up @@ -3701,7 +3701,6 @@
?alloc_image_mem@experimental@oneapi@ext@_V1@sycl@@YA?AUimage_mem_handle@12345@AEBUimage_descriptor@12345@AEBVdevice@45@AEBVcontext@45@@Z
?alloc_image_mem@experimental@oneapi@ext@_V1@sycl@@YA?AUimage_mem_handle@12345@AEBUimage_descriptor@12345@AEBVqueue@45@@Z
?aspect_selector@_V1@sycl@@YA?AV?$function@$$A6AHAEBVdevice@_V1@sycl@@@Z@std@@AEBV?$vector@W4aspect@_V1@sycl@@V?$allocator@W4aspect@_V1@sycl@@@std@@@4@0@Z
?assertion@pi@detail@_V1@sycl@@YAX_NPEBD@Z
?associateWithHandler@detail@_V1@sycl@@YAXAEAVhandler@23@PEAVAccessorBaseHost@123@W4target@access@23@@Z
?associateWithHandler@detail@_V1@sycl@@YAXAEAVhandler@23@PEAVSampledImageAccessorBaseHost@123@W4image_target@23@@Z
?associateWithHandler@detail@_V1@sycl@@YAXAEAVhandler@23@PEAVUnsampledImageAccessorBaseHost@123@W4image_target@23@@Z
Expand Down
Loading