18
18
#include < sycl/detail/array.hpp> // for array
19
19
#include < sycl/detail/export.hpp> // for __SYCL_EXPORT
20
20
#include < sycl/detail/generic_type_traits.hpp> // for max_v, min_v, TryToGe...
21
- #include < sycl/detail/pi.h> // for PI_ERROR_INVALID_VALUE
22
21
#include < sycl/detail/type_list.hpp> // for is_contained, type_list
23
- #include < sycl/exception.hpp> // for invalid_parameter_error
22
+ #include < sycl/exception.hpp>
24
23
#include < sycl/id.hpp> // for id
25
24
#include < sycl/image.hpp> // for image_channel_type
26
25
#include < sycl/range.hpp> // for range
@@ -301,10 +300,9 @@ void convertReadData(const vec<ChannelType, 4> PixelData,
301
300
// OpenCL Spec section 6.12.14.2 does not allow reading uint4 data from an
302
301
// image with channel datatype other than unsigned_int8,unsigned_int16 and
303
302
// unsigned_int32.
304
- throw sycl::invalid_parameter_error (
305
- " Datatype of read data - cl_uint4 is incompatible with the "
306
- " image_channel_type of the image." ,
307
- PI_ERROR_INVALID_VALUE);
303
+ throw sycl::exception (make_error_code (errc::invalid),
304
+ " Datatype of read data - cl_uint4 is incompatible "
305
+ " with the image_channel_type of the image." );
308
306
}
309
307
}
310
308
@@ -322,11 +320,9 @@ void convertReadData(const vec<ChannelType, 4> PixelData,
322
320
// OpenCL Spec section 6.12.14.2 does not allow reading int4 data from an
323
321
// image with channel datatype other than signed_int8,signed_int16 and
324
322
// signed_int32.
325
- throw sycl::invalid_parameter_error (
326
- " Datatype of read data - cl_int4 is incompatible with "
327
- " the "
328
- " image_channel_type of the image." ,
329
- PI_ERROR_INVALID_VALUE);
323
+ throw sycl::exception (make_error_code (errc::invalid),
324
+ " Datatype of read data - cl_int4 is incompatible "
325
+ " with the image_channel_type of the image." );
330
326
}
331
327
}
332
328
@@ -404,10 +400,9 @@ void convertReadData(const vec<ChannelType, 4> PixelData,
404
400
// OpenCL Spec section 6.12.14.2 does not allow reading float4 data from an
405
401
// image with channel datatype - signed/unsigned_int8,signed/unsigned_int16
406
402
// and signed/unsigned_int32.
407
- throw sycl::invalid_parameter_error (
408
- " Datatype of read data - cl_float4 is incompatible with the "
409
- " image_channel_type of the image." ,
410
- PI_ERROR_INVALID_VALUE);
403
+ throw sycl::exception (make_error_code (errc::invalid),
404
+ " Datatype of read data - cl_float4 is incompatible "
405
+ " with the image_channel_type of the image." );
411
406
case image_channel_type::fp16:
412
407
// Host has conversion from float to half with accuracy as required in
413
408
// section 8.3.2 OpenCL spec.
@@ -459,18 +454,16 @@ void convertReadData(const vec<ChannelType, 4> PixelData,
459
454
// OpenCL Spec section 6.12.14.2 does not allow reading float4 data to an
460
455
// image with channel datatype - signed/unsigned_int8,signed/unsigned_int16
461
456
// and signed/unsigned_int32.
462
- throw sycl::invalid_parameter_error (
463
- " Datatype to read- cl_half4 is incompatible with the "
464
- " image_channel_type of the image." ,
465
- PI_ERROR_INVALID_VALUE);
457
+ throw sycl::exception (make_error_code (errc::invalid),
458
+ " Datatype to read- cl_half4 is incompatible with the "
459
+ " image_channel_type of the image." );
466
460
case image_channel_type::fp16:
467
461
RetData = PixelData.template convert <half>();
468
462
return ;
469
463
case image_channel_type::fp32:
470
- throw sycl::invalid_parameter_error (
471
- " Datatype to read - cl_half4 is incompatible with the "
472
- " image_channel_type of the image." ,
473
- PI_ERROR_INVALID_VALUE);
464
+ throw sycl::exception (make_error_code (errc::invalid),
465
+ " Datatype to read - cl_half4 is incompatible with "
466
+ " the image_channel_type of the image." );
474
467
}
475
468
RetData = RetDataFloat.template convert <half>();
476
469
}
@@ -507,10 +500,10 @@ convertWriteData(const uint4 WriteData,
507
500
// OpenCL Spec section 6.12.14.4 does not allow writing uint4 data to an
508
501
// image with channel datatype other than unsigned_int8,unsigned_int16 and
509
502
// unsigned_int32.
510
- throw sycl::invalid_parameter_error (
503
+ throw sycl::exception (
504
+ make_error_code (errc::invalid),
511
505
" Datatype of data to write - cl_uint4 is incompatible with the "
512
- " image_channel_type of the image." ,
513
- PI_ERROR_INVALID_VALUE);
506
+ " image_channel_type of the image." );
514
507
}
515
508
}
516
509
@@ -540,10 +533,9 @@ convertWriteData(const int4 WriteData,
540
533
// OpenCL Spec section 6.12.14.4 does not allow writing int4 data to an
541
534
// image with channel datatype other than signed_int8,signed_int16 and
542
535
// signed_int32.
543
- throw sycl::invalid_parameter_error (
544
- " Datatype of data to write - cl_int4 is incompatible with the "
545
- " image_channel_type of the image." ,
546
- PI_ERROR_INVALID_VALUE);
536
+ throw sycl::exception (make_error_code (errc::invalid),
537
+ " Datatype of data to write - cl_int4 is incompatible "
538
+ " with the image_channel_type of the image." );
547
539
}
548
540
}
549
541
@@ -620,10 +612,10 @@ convertWriteData(const float4 WriteData,
620
612
// OpenCL Spec section 6.12.14.4 does not allow writing float4 data to an
621
613
// image with channel datatype - signed/unsigned_int8,signed/unsigned_int16
622
614
// and signed/unsigned_int32.
623
- throw sycl::invalid_parameter_error (
615
+ throw sycl::exception (
616
+ make_error_code (errc::invalid),
624
617
" Datatype of data to write - cl_float4 is incompatible with the "
625
- " image_channel_type of the image." ,
626
- PI_ERROR_INVALID_VALUE);
618
+ " image_channel_type of the image." );
627
619
case image_channel_type::fp16:
628
620
// Host has conversion from float to half with accuracy as required in
629
621
// section 8.3.2 OpenCL spec.
@@ -667,17 +659,17 @@ convertWriteData(const half4 WriteData,
667
659
// OpenCL Spec section 6.12.14.4 does not allow writing float4 data to an
668
660
// image with channel datatype - signed/unsigned_int8,signed/unsigned_int16
669
661
// and signed/unsigned_int32.
670
- throw sycl::invalid_parameter_error (
662
+ throw sycl::exception (
663
+ make_error_code (errc::invalid),
671
664
" Datatype of data to write - cl_float4 is incompatible with the "
672
- " image_channel_type of the image." ,
673
- PI_ERROR_INVALID_VALUE);
665
+ " image_channel_type of the image." );
674
666
case image_channel_type::fp16:
675
667
return WriteData.convert <ChannelType>();
676
668
case image_channel_type::fp32:
677
- throw sycl::invalid_parameter_error (
669
+ throw sycl::exception (
670
+ make_error_code (errc::invalid),
678
671
" Datatype of data to write - cl_float4 is incompatible with the "
679
- " image_channel_type of the image." ,
680
- PI_ERROR_INVALID_VALUE);
672
+ " image_channel_type of the image." );
681
673
}
682
674
}
683
675
0 commit comments