diff --git a/sycl/include/sycl/detail/array.hpp b/sycl/include/sycl/detail/array.hpp index 870cd49f07ac7..2d0ea26110289 100644 --- a/sycl/include/sycl/detail/array.hpp +++ b/sycl/include/sycl/detail/array.hpp @@ -10,7 +10,7 @@ #include // for __SYCL_ALWAYS_INLINE #include // for PI_ERROR_INVALID_VALUE -#include // for invalid_parameter_error +#include #include // for size_t #include // for enable_if_t @@ -106,8 +106,8 @@ template class array { __SYCL_ALWAYS_INLINE void check_dimension(int dimension) const { #ifndef __SYCL_DEVICE_ONLY__ if (dimension >= dimensions || dimension < 0) { - throw sycl::invalid_parameter_error("Index out of range", - PI_ERROR_INVALID_VALUE); + throw sycl::exception(make_error_code(errc::invalid), + "Index out of range"); } #endif (void)dimension; diff --git a/sycl/include/sycl/detail/image_accessor_util.hpp b/sycl/include/sycl/detail/image_accessor_util.hpp index 49ad5b86663ae..03b5faab9d3ad 100644 --- a/sycl/include/sycl/detail/image_accessor_util.hpp +++ b/sycl/include/sycl/detail/image_accessor_util.hpp @@ -18,9 +18,8 @@ #include // for array #include // for __SYCL_EXPORT #include // for max_v, min_v, TryToGe... -#include // for PI_ERROR_INVALID_VALUE #include // for is_contained, type_list -#include // for invalid_parameter_error +#include #include // for id #include // for image_channel_type #include // for range @@ -301,10 +300,9 @@ void convertReadData(const vec PixelData, // OpenCL Spec section 6.12.14.2 does not allow reading uint4 data from an // image with channel datatype other than unsigned_int8,unsigned_int16 and // unsigned_int32. - throw sycl::invalid_parameter_error( - "Datatype of read data - cl_uint4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + throw sycl::exception(make_error_code(errc::invalid), + "Datatype of read data - cl_uint4 is incompatible " + "with the image_channel_type of the image."); } } @@ -322,11 +320,9 @@ void convertReadData(const vec PixelData, // OpenCL Spec section 6.12.14.2 does not allow reading int4 data from an // image with channel datatype other than signed_int8,signed_int16 and // signed_int32. - throw sycl::invalid_parameter_error( - "Datatype of read data - cl_int4 is incompatible with " - "the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + throw sycl::exception(make_error_code(errc::invalid), + "Datatype of read data - cl_int4 is incompatible " + "with the image_channel_type of the image."); } } @@ -404,10 +400,9 @@ void convertReadData(const vec PixelData, // OpenCL Spec section 6.12.14.2 does not allow reading float4 data from an // image with channel datatype - signed/unsigned_int8,signed/unsigned_int16 // and signed/unsigned_int32. - throw sycl::invalid_parameter_error( - "Datatype of read data - cl_float4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + throw sycl::exception(make_error_code(errc::invalid), + "Datatype of read data - cl_float4 is incompatible " + "with the image_channel_type of the image."); case image_channel_type::fp16: // Host has conversion from float to half with accuracy as required in // section 8.3.2 OpenCL spec. @@ -459,18 +454,16 @@ void convertReadData(const vec PixelData, // OpenCL Spec section 6.12.14.2 does not allow reading float4 data to an // image with channel datatype - signed/unsigned_int8,signed/unsigned_int16 // and signed/unsigned_int32. - throw sycl::invalid_parameter_error( - "Datatype to read- cl_half4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + throw sycl::exception(make_error_code(errc::invalid), + "Datatype to read- cl_half4 is incompatible with the " + "image_channel_type of the image."); case image_channel_type::fp16: RetData = PixelData.template convert(); return; case image_channel_type::fp32: - throw sycl::invalid_parameter_error( - "Datatype to read - cl_half4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + throw sycl::exception(make_error_code(errc::invalid), + "Datatype to read - cl_half4 is incompatible with " + "the image_channel_type of the image."); } RetData = RetDataFloat.template convert(); } @@ -507,10 +500,10 @@ convertWriteData(const uint4 WriteData, // OpenCL Spec section 6.12.14.4 does not allow writing uint4 data to an // image with channel datatype other than unsigned_int8,unsigned_int16 and // unsigned_int32. - throw sycl::invalid_parameter_error( + throw sycl::exception( + make_error_code(errc::invalid), "Datatype of data to write - cl_uint4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + "image_channel_type of the image."); } } @@ -540,10 +533,9 @@ convertWriteData(const int4 WriteData, // OpenCL Spec section 6.12.14.4 does not allow writing int4 data to an // image with channel datatype other than signed_int8,signed_int16 and // signed_int32. - throw sycl::invalid_parameter_error( - "Datatype of data to write - cl_int4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + throw sycl::exception(make_error_code(errc::invalid), + "Datatype of data to write - cl_int4 is incompatible " + "with the image_channel_type of the image."); } } @@ -620,10 +612,10 @@ convertWriteData(const float4 WriteData, // OpenCL Spec section 6.12.14.4 does not allow writing float4 data to an // image with channel datatype - signed/unsigned_int8,signed/unsigned_int16 // and signed/unsigned_int32. - throw sycl::invalid_parameter_error( + throw sycl::exception( + make_error_code(errc::invalid), "Datatype of data to write - cl_float4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + "image_channel_type of the image."); case image_channel_type::fp16: // Host has conversion from float to half with accuracy as required in // section 8.3.2 OpenCL spec. @@ -667,17 +659,17 @@ convertWriteData(const half4 WriteData, // OpenCL Spec section 6.12.14.4 does not allow writing float4 data to an // image with channel datatype - signed/unsigned_int8,signed/unsigned_int16 // and signed/unsigned_int32. - throw sycl::invalid_parameter_error( + throw sycl::exception( + make_error_code(errc::invalid), "Datatype of data to write - cl_float4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + "image_channel_type of the image."); case image_channel_type::fp16: return WriteData.convert(); case image_channel_type::fp32: - throw sycl::invalid_parameter_error( + throw sycl::exception( + make_error_code(errc::invalid), "Datatype of data to write - cl_float4 is incompatible with the " - "image_channel_type of the image.", - PI_ERROR_INVALID_VALUE); + "image_channel_type of the image."); } } diff --git a/sycl/source/context.cpp b/sycl/source/context.cpp index 78f26a427834c..80b749d9a585d 100644 --- a/sycl/source/context.cpp +++ b/sycl/source/context.cpp @@ -53,8 +53,7 @@ context::context(const std::vector &DeviceList, context::context(const std::vector &DeviceList, async_handler AsyncHandler, const property_list &PropList) { if (DeviceList.empty()) { - throw invalid_parameter_error("DeviceList is empty.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), "DeviceList is empty."); } const auto &RefPlatform = @@ -64,9 +63,8 @@ context::context(const std::vector &DeviceList, return (detail::getSyclObjImpl(CurrentDevice.get_platform()) ->getHandleRef() != RefPlatform); })) - throw invalid_parameter_error( - "Can't add devices across platforms to a single context.", - PI_ERROR_INVALID_DEVICE); + throw exception(make_error_code(errc::invalid), + "Can't add devices across platforms to a single context."); else impl = std::make_shared(DeviceList, AsyncHandler, PropList); diff --git a/sycl/source/detail/config.hpp b/sycl/source/detail/config.hpp index 71ba0310a24e8..e94be9bd27166 100644 --- a/sycl/source/detail/config.hpp +++ b/sycl/source/detail/config.hpp @@ -272,10 +272,9 @@ template <> class SYCLConfig { if (ValStr) { // Throw if the input string is empty. if (ValStr[0] == '\0') - throw invalid_parameter_error( - "Invalid value for ONEAPI_DEVICE_SELECTOR environment " - "variable: value should not be null.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "Invalid value for ONEAPI_DEVICE_SELECTOR environment " + "variable: value should not be null."); DeviceTargets = &GlobalHandler::instance().getOneapiDeviceSelectorTargets(ValStr); @@ -333,17 +332,16 @@ template <> class SYCLConfig { try { Result = std::stoi(ValueStr); } catch (...) { - throw invalid_parameter_error( - "Invalid value for SYCL_QUEUE_THREAD_POOL_SIZE environment " - "variable: value should be a number", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "Invalid value for SYCL_QUEUE_THREAD_POOL_SIZE " + "environment variable: value should be a number"); } if (Result < 1) - throw invalid_parameter_error( + throw exception( + make_error_code(errc::invalid), "Invalid value for SYCL_QUEUE_THREAD_POOL_SIZE environment " - "variable: value should be larger than zero", - PI_ERROR_INVALID_VALUE); + "variable: value should be larger than zero"); return Result; }(); diff --git a/sycl/source/detail/context_impl.cpp b/sycl/source/detail/context_impl.cpp index 2192884fbaca6..f9e27beb0055f 100644 --- a/sycl/source/detail/context_impl.cpp +++ b/sycl/source/detail/context_impl.cpp @@ -89,19 +89,18 @@ context_impl::context_impl(sycl::detail::pi::PiContext PiContext, sizeof(sycl::detail::pi::PiDevice) * DevicesNum, &DeviceIds[0], nullptr); - if (!DeviceIds.empty()) { - std::shared_ptr Platform = - platform_impl::getPlatformFromPiDevice(DeviceIds[0], Plugin); - for (sycl::detail::pi::PiDevice Dev : DeviceIds) { - MDevices.emplace_back(createSyclObjFromImpl( - Platform->getOrMakeDeviceImpl(Dev, Platform))); - } - MPlatform = Platform; - } else { - throw invalid_parameter_error( - "No devices in the provided device list and native context.", - PI_ERROR_INVALID_VALUE); + if (DeviceIds.empty()) + throw exception( + make_error_code(errc::invalid), + "No devices in the provided device list and native context."); + + std::shared_ptr Platform = + platform_impl::getPlatformFromPiDevice(DeviceIds[0], Plugin); + for (sycl::detail::pi::PiDevice Dev : DeviceIds) { + MDevices.emplace_back(createSyclObjFromImpl( + Platform->getOrMakeDeviceImpl(Dev, Platform))); } + MPlatform = Platform; } // TODO catch an exception and put it to list of asynchronous exceptions // getPlugin() will be the same as the Plugin passed. This should be taken diff --git a/sycl/source/detail/image_impl.cpp b/sycl/source/detail/image_impl.cpp index 0e7b4012617c3..71574991745a1 100644 --- a/sycl/source/detail/image_impl.cpp +++ b/sycl/source/detail/image_impl.cpp @@ -352,76 +352,67 @@ bool image_impl::checkImageDesc(const sycl::detail::pi::PiMemImageDesc &Desc, PI_MEM_TYPE_IMAGE2D_ARRAY, PI_MEM_TYPE_IMAGE2D) && !checkImageValueRange( getDevices(Context), Desc.image_width)) - throw invalid_parameter_error( - "For a 1D/2D image/image array, the width must be a Value >= 1 and " - "<= info::device::image2d_max_width", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "For a 1D/2D image/image array, the width must be a Value " + ">= 1 and <= info::device::image2d_max_width"); if (checkAny(Desc.image_type, PI_MEM_TYPE_IMAGE3D) && !checkImageValueRange( getDevices(Context), Desc.image_width)) - throw invalid_parameter_error( - "For a 3D image, the width must be a Value >= 1 and <= " - "info::device::image3d_max_width", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "For a 3D image, the width must be a Value >= 1 and <= " + "info::device::image3d_max_width"); if (checkAny(Desc.image_type, PI_MEM_TYPE_IMAGE2D, PI_MEM_TYPE_IMAGE2D_ARRAY) && !checkImageValueRange( getDevices(Context), Desc.image_height)) - throw invalid_parameter_error("For a 2D image or image array, the height " - "must be a Value >= 1 and <= " - "info::device::image2d_max_height", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "For a 2D image or image array, the height must be a Value " + ">= 1 and <= info::device::image2d_max_height"); if (checkAny(Desc.image_type, PI_MEM_TYPE_IMAGE3D) && !checkImageValueRange( getDevices(Context), Desc.image_height)) - throw invalid_parameter_error( - "For a 3D image, the heightmust be a Value >= 1 and <= " - "info::device::image3d_max_height", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "For a 3D image, the heightmust be a Value >= 1 and <= " + "info::device::image3d_max_height"); if (checkAny(Desc.image_type, PI_MEM_TYPE_IMAGE3D) && !checkImageValueRange( getDevices(Context), Desc.image_depth)) - throw invalid_parameter_error( - "For a 3D image, the depth must be a Value >= 1 and <= " - "info::device::image2d_max_depth", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "For a 3D image, the depth must be a Value >= 1 and <= " + "info::device::image2d_max_depth"); if (checkAny(Desc.image_type, PI_MEM_TYPE_IMAGE1D_ARRAY, PI_MEM_TYPE_IMAGE2D_ARRAY) && !checkImageValueRange( getDevices(Context), Desc.image_array_size)) - throw invalid_parameter_error( - "For a 1D and 2D image array, the array_size must be a " - "Value >= 1 and <= info::device::image_max_array_size.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "For a 1D and 2D image array, the array_size must be a " + "Value >= 1 and <= info::device::image_max_array_size."); if ((nullptr == UserPtr) && (0 != Desc.image_row_pitch)) - throw invalid_parameter_error( - "The row_pitch must be 0 if host_ptr is nullptr.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "The row_pitch must be 0 if host_ptr is nullptr."); if ((nullptr == UserPtr) && (0 != Desc.image_slice_pitch)) - throw invalid_parameter_error( - "The slice_pitch must be 0 if host_ptr is nullptr.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "The slice_pitch must be 0 if host_ptr is nullptr."); if (0 != Desc.num_mip_levels) - throw invalid_parameter_error("The mip_levels must be 0.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "The mip_levels must be 0."); if (0 != Desc.num_samples) - throw invalid_parameter_error("The num_samples must be 0.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "The num_samples must be 0."); if (nullptr != Desc.buffer) - throw invalid_parameter_error( - "The buffer must be nullptr, because SYCL does not support " - "image creation from memory objects.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "The buffer must be nullptr, because SYCL does not support " + "image creation from memory objects."); return true; } @@ -436,11 +427,11 @@ bool image_impl::checkImageFormat( PI_IMAGE_CHANNEL_TYPE_UNORM_INT16, PI_IMAGE_CHANNEL_TYPE_SNORM_INT8, PI_IMAGE_CHANNEL_TYPE_SNORM_INT16, PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT, PI_IMAGE_CHANNEL_TYPE_FLOAT)) - throw invalid_parameter_error( - "CL_INTENSITY or CL_LUMINANCE format can only be used if channel " - "data type = CL_UNORM_INT8, CL_UNORM_INT16, CL_SNORM_INT8, " - "CL_SNORM_INT16, CL_HALF_FLOAT, or CL_FLOAT.", - PI_ERROR_INVALID_VALUE); + throw exception( + make_error_code(errc::invalid), + "CL_INTENSITY or CL_LUMINANCE format can only be used if channel data " + "type = CL_UNORM_INT8, CL_UNORM_INT16, CL_SNORM_INT8, CL_SNORM_INT16, " + "CL_HALF_FLOAT, or CL_FLOAT."); if (checkAny(Format.image_channel_data_type, PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565, @@ -448,12 +439,10 @@ bool image_impl::checkImageFormat( PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010) && !checkAny(Format.image_channel_order, PI_IMAGE_CHANNEL_ORDER_RGB, PI_IMAGE_CHANNEL_ORDER_RGBx)) - throw invalid_parameter_error( - "type = CL_UNORM_SHORT_565, CL_UNORM_SHORT_555 or " - "CL_UNORM_INT_101010." - "These channel types can only be used with CL_RGB or CL_RGBx channel " - "order.", - PI_ERROR_INVALID_VALUE); + throw exception(make_error_code(errc::invalid), + "type = CL_UNORM_SHORT_565, CL_UNORM_SHORT_555 or " + "CL_UNORM_INT_101010. These channel types can only be used " + "with CL_RGB or CL_RGBx channel order."); if (checkAny(Format.image_channel_order, PI_IMAGE_CHANNEL_ORDER_ARGB, PI_IMAGE_CHANNEL_ORDER_BGRA, PI_IMAGE_CHANNEL_ORDER_ABGR) && @@ -461,11 +450,11 @@ bool image_impl::checkImageFormat( Format.image_channel_data_type, PI_IMAGE_CHANNEL_TYPE_UNORM_INT8, PI_IMAGE_CHANNEL_TYPE_SNORM_INT8, PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8, PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8)) - throw invalid_parameter_error( + throw exception( + make_error_code(errc::invalid), "CL_ARGB, CL_BGRA, CL_ABGR These formats can only be used if " "channel data type = CL_UNORM_INT8, CL_SNORM_INT8, CL_SIGNED_INT8 " - "or CL_UNSIGNED_INT8.", - PI_ERROR_INVALID_VALUE); + "or CL_UNSIGNED_INT8."); return true; } diff --git a/sycl/source/detail/kernel_impl.cpp b/sycl/source/detail/kernel_impl.cpp index 545e4701f360c..2eaea5958ca2d 100644 --- a/sycl/source/detail/kernel_impl.cpp +++ b/sycl/source/detail/kernel_impl.cpp @@ -30,9 +30,9 @@ kernel_impl::kernel_impl(sycl::detail::pi::PiKernel Kernel, getPlugin()->call( MKernel, PI_KERNEL_INFO_CONTEXT, sizeof(Context), &Context, nullptr); if (ContextImpl->getHandleRef() != Context) - throw sycl::invalid_parameter_error( - "Input context must be the same as the context of cl_kernel", - PI_ERROR_INVALID_CONTEXT); + throw sycl::exception( + make_error_code(errc::invalid), + "Input context must be the same as the context of cl_kernel"); // Enable USM indirect access for interoperability kernels. // Some PI Plugins (like OpenCL) require this call to enable USM diff --git a/sycl/source/detail/sycl_mem_obj_t.cpp b/sycl/source/detail/sycl_mem_obj_t.cpp index 63e6aa3735cc1..0436c02cb9bdb 100644 --- a/sycl/source/detail/sycl_mem_obj_t.cpp +++ b/sycl/source/detail/sycl_mem_obj_t.cpp @@ -48,9 +48,9 @@ SYCLMemObjT::SYCLMemObjT(pi_native_handle MemObject, const context &SyclContext, sizeof(Context), &Context, nullptr); if (MInteropContext->getHandleRef() != Context) - throw sycl::invalid_parameter_error( - "Input context must be the same as the context of cl_mem", - PI_ERROR_INVALID_CONTEXT); + throw sycl::exception( + make_error_code(errc::invalid), + "Input context must be the same as the context of cl_mem"); if (MInteropContext->getBackend() == backend::opencl) Plugin->call(MInteropMemObject); @@ -102,9 +102,8 @@ SYCLMemObjT::SYCLMemObjT(pi_native_handle MemObject, const context &SyclContext, sizeof(Context), &Context, nullptr); if (MInteropContext->getHandleRef() != Context) - throw sycl::invalid_parameter_error( - "Input context must be the same as the context of cl_mem", - PI_ERROR_INVALID_CONTEXT); + throw sycl::exception(make_error_code(errc::invalid), + "Input context must be the same as the context of cl_mem"); if (MInteropContext->getBackend() == backend::opencl) Plugin->call(MInteropMemObject); diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index a06e3a534ebc3..ef6d9c77865f9 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -23,8 +23,8 @@ void force_type(info::device_type &t, const info::device_type &ft) { if (t == info::device_type::all) { t = ft; } else if (ft != info::device_type::all && t != ft) { - throw sycl::invalid_parameter_error("No device of forced type.", - PI_ERROR_INVALID_OPERATION); + throw sycl::exception(make_error_code(errc::invalid), + "No device of forced type."); } } } // namespace detail diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index d6d488c45f019..d2fc0b00b60be 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -777,8 +777,8 @@ void handler::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind, case access::target::host_image: case access::target::host_task: case access::target::host_buffer: { - throw sycl::invalid_parameter_error("Unsupported accessor target case.", - PI_ERROR_INVALID_OPERATION); + throw sycl::exception(make_error_code(errc::invalid), + "Unsupported accessor target case."); break; } } diff --git a/sycl/source/stream.cpp b/sycl/source/stream.cpp index 740b6de2f8b2f..c0625e9779281 100644 --- a/sycl/source/stream.cpp +++ b/sycl/source/stream.cpp @@ -26,10 +26,9 @@ static constexpr size_t MAX_STATEMENT_SIZE = // allocated, avoiding memory leaks. static size_t CheckMaxStatementSize(const size_t &MaxStatementSize) { if (MaxStatementSize > MAX_STATEMENT_SIZE) { - throw sycl::invalid_parameter_error( - "Maximum statement size exceeds limit of " + - std::to_string(MAX_STATEMENT_SIZE) + " bytes.", - PI_ERROR_INVALID_VALUE); + throw sycl::exception(make_error_code(errc::invalid), + "Maximum statement size exceeds limit of " + + std::to_string(MAX_STATEMENT_SIZE) + " bytes."); } return MaxStatementSize; } diff --git a/sycl/test-e2e/Basic/context_platforms.cpp b/sycl/test-e2e/Basic/context_platforms.cpp index e8294003a986a..7019d2c2d97da 100644 --- a/sycl/test-e2e/Basic/context_platforms.cpp +++ b/sycl/test-e2e/Basic/context_platforms.cpp @@ -24,7 +24,7 @@ int main(int argc, char const *argv[]) { std::cerr << "Test failed: exception wasn't thrown" << std::endl; return 1; } catch (sycl::exception &E) { - if (E.code() != sycl::errc::kernel_argument || + if (E.code() != sycl::errc::invalid || std::string(E.what()).find( "Can't add devices across platforms to a single context.") == std::string::npos) { diff --git a/sycl/test-e2e/DeprecatedFeatures/kernel_interop.cpp b/sycl/test-e2e/DeprecatedFeatures/kernel_interop.cpp index 1f8d39b5f00ed..9c3b6fd59542e 100644 --- a/sycl/test-e2e/DeprecatedFeatures/kernel_interop.cpp +++ b/sycl/test-e2e/DeprecatedFeatures/kernel_interop.cpp @@ -50,8 +50,9 @@ int main() { context OtherContext{Context.get_devices()[0]}; try { kernel Kernel(ClKernel, OtherContext); - } catch (sycl::invalid_parameter_error e) { - Pass = true; + } catch (const sycl::exception & e) { + if (e.code() == errc::invalid) + Pass = true; } assert(Pass); diff --git a/sycl/unittests/stream/stream.cpp b/sycl/unittests/stream/stream.cpp index 36afde6e06750..c25e744801f6d 100644 --- a/sycl/unittests/stream/stream.cpp +++ b/sycl/unittests/stream/stream.cpp @@ -49,8 +49,9 @@ TEST(Stream, TestStreamConstructorExceptionNoAllocation) { // Try to create stream with invalid workItemBufferSize parameter. sycl::stream InvalidStream{256, std::numeric_limits::max(), CGH}; FAIL() << "No exception was thrown."; - } catch (const sycl::invalid_parameter_error &) { - // Expected exception + } catch (const sycl::exception &e) { + if (e.code() != sycl::errc::invalid) + FAIL() << "Unexpected exception was thrown."; } catch (...) { FAIL() << "Unexpected exception was thrown."; }