Skip to content

Commit d4085bd

Browse files
[SYCL][ABI-Break] Drop pi::assertion (#14624)
This function should not be exported and looking at its uses it seems like they call can be replaced with regular `assert` or a `static_assert` without hurting any functionality. This is patch is essentially a by-product of #14145 and it is done to simplify that change, i.e. PI plugins removal should not be ABI-breaking by itself, we just need to cleanup some of our exported symbols.
1 parent ce81199 commit d4085bd

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

sycl/include/sycl/detail/backend_traits_opencl.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,9 @@ namespace pi {
143143
// Cast for std::vector<cl_event>, according to the spec, make_event
144144
// should create one(?) event from a vector of cl_event
145145
template <class To> inline To cast(std::vector<cl_event> value) {
146-
sycl::detail::pi::assertion(
147-
value.size() == 1,
148-
"Temporary workaround requires that the "
149-
"size of the input vector for make_event be equal to one.");
146+
assert(value.size() == 1 &&
147+
"Temporary workaround requires that the "
148+
"size of the input vector for make_event be equal to one.");
150149
return cast<To>(value[0]);
151150
}
152151

sycl/include/sycl/detail/pi.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ bool trace(TraceLevel level);
101101
// Report error and no return (keeps compiler happy about no return statements).
102102
[[noreturn]] __SYCL_EXPORT void die(const char *Message);
103103

104-
__SYCL_EXPORT void assertion(bool Condition, const char *Message = nullptr);
105-
106104
using PiPlugin = ::pi_plugin;
107105
using PiResult = ::pi_result;
108106
using PiPlatform = ::pi_platform;
@@ -260,9 +258,7 @@ namespace pi {
260258
// Want all the needed casts be explicit, do not define conversion
261259
// operators.
262260
template <class To, class From> inline To cast(From value) {
263-
// TODO: see if more sanity checks are possible.
264-
sycl::detail::pi::assertion((sizeof(From) == sizeof(To)),
265-
"assert: cast failed size check");
261+
static_assert(sizeof(From) == sizeof(To), "cast failed size check");
266262
return (To)(value);
267263
}
268264

sycl/source/detail/pi.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ std::string platformInfoToString(pi_platform_info info) {
217217
}
218218

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

223223
std::stringstream Sstream;
224224

@@ -522,11 +522,6 @@ template const PluginPtr &getPlugin<backend::ext_oneapi_hip>();
522522
std::terminate();
523523
}
524524

525-
void assertion(bool Condition, const char *Message) {
526-
if (!Condition)
527-
die(Message);
528-
}
529-
530525
// Reads an integer value from ELF data.
531526
template <typename ResT>
532527
static ResT readELFValue(const unsigned char *Data, size_t NumBytes,

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3288,7 +3288,6 @@ _ZN4sycl3_V16detail28getPixelCoordNearestFiltModeENS0_3vecIfLi4EEENS0_15addressi
32883288
_ZN4sycl3_V16detail28getValueFromDynamicParameterERNS0_3ext6oneapi12experimental6detail22dynamic_parameter_baseE
32893289
_ZN4sycl3_V16detail2pi25contextSetExtendedDeleterERKNS0_7contextEPFvPvES6_
32903290
_ZN4sycl3_V16detail2pi3dieEPKc
3291-
_ZN4sycl3_V16detail2pi9assertionEbPKc
32923291
_ZN4sycl3_V16detail30UnsampledImageAccessorBaseHost10getAccDataEv
32933292
_ZN4sycl3_V16detail30UnsampledImageAccessorBaseHost6getPtrEv
32943293
_ZN4sycl3_V16detail30UnsampledImageAccessorBaseHostC1ENS0_5rangeILi3EEENS0_6access4modeEPviiNS0_2idILi3EEENS0_18image_channel_typeENS0_19image_channel_orderERKNS0_13property_listE

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3703,7 +3703,6 @@
37033703
?alloc_image_mem@experimental@oneapi@ext@_V1@sycl@@YA?AUimage_mem_handle@12345@AEBUimage_descriptor@12345@AEBVdevice@45@AEBVcontext@45@@Z
37043704
?alloc_image_mem@experimental@oneapi@ext@_V1@sycl@@YA?AUimage_mem_handle@12345@AEBUimage_descriptor@12345@AEBVqueue@45@@Z
37053705
?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
3706-
?assertion@pi@detail@_V1@sycl@@YAX_NPEBD@Z
37073706
?associateWithHandler@detail@_V1@sycl@@YAXAEAVhandler@23@PEAVAccessorBaseHost@123@W4target@access@23@@Z
37083707
?associateWithHandler@detail@_V1@sycl@@YAXAEAVhandler@23@PEAVSampledImageAccessorBaseHost@123@W4image_target@23@@Z
37093708
?associateWithHandler@detail@_V1@sycl@@YAXAEAVhandler@23@PEAVUnsampledImageAccessorBaseHost@123@W4image_target@23@@Z

0 commit comments

Comments
 (0)