15
15
#include < sycl/access/access.hpp> // for address_space, decorated
16
16
#include < sycl/builtins.hpp> // for fabs
17
17
#include < sycl/detail/defines_elementary.hpp> // for __SYCL_ALWAYS_INLINE
18
- #include < sycl/detail/pi.h> // for PI_ERROR_INVALID_DEVICE
19
- #include < sycl/exception.hpp> // for runtime_error
18
+ #include < sycl/exception.hpp>
20
19
#include < sycl/ext/oneapi/bfloat16.hpp> // for bfloat16
21
20
#include < sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr.hpp> // for annotated_ptr
22
21
#include < sycl/group.hpp> // for group
@@ -122,8 +121,8 @@ class wi_element {
122
121
const size_t col = coord[1 ];
123
122
return std::make_tuple (row, col);
124
123
#else
125
- throw runtime_error ( " joint matrix is not supported on host device. " ,
126
- PI_ERROR_INVALID_DEVICE );
124
+ throw exception ( make_error_code (errc::runtime) ,
125
+ " joint matrix is not supported on host. " );
127
126
#endif // __SYCL_DEVICE_ONLY__
128
127
}
129
128
@@ -137,8 +136,8 @@ class wi_element {
137
136
idx);
138
137
return elem;
139
138
#else
140
- throw runtime_error ( " joint matrix is not supported on host device. " ,
141
- PI_ERROR_INVALID_DEVICE );
139
+ throw exception ( make_error_code (errc::runtime) ,
140
+ " joint matrix is not supported on host. " );
142
141
#endif // __SYCL_DEVICE_ONLY__
143
142
}
144
143
@@ -151,8 +150,8 @@ class wi_element {
151
150
spv_scope_traits<Group>::value>(
152
151
M.spvm , idx) != static_cast <storage_element_type>(0 );
153
152
#else
154
- throw runtime_error ( " joint matrix is not supported on host device. " ,
155
- PI_ERROR_INVALID_DEVICE );
153
+ throw exception ( make_error_code (errc::runtime) ,
154
+ " joint matrix is not supported on host. " );
156
155
#endif // __SYCL_DEVICE_ONLY__
157
156
}
158
157
@@ -163,8 +162,8 @@ class wi_element {
163
162
return *this ;
164
163
#else
165
164
(void )rhs;
166
- throw runtime_error ( " joint matrix is not supported on host device. " ,
167
- PI_ERROR_INVALID_DEVICE );
165
+ throw exception ( make_error_code (errc::runtime) ,
166
+ " joint matrix is not supported on host. " );
168
167
#endif // __SYCL_DEVICE_ONLY__
169
168
}
170
169
@@ -182,8 +181,8 @@ class wi_element {
182
181
return *this ;
183
182
#else
184
183
(void )rhs;
185
- throw runtime_error ( " joint matrix is not supported on host device. " ,
186
- PI_ERROR_INVALID_DEVICE );
184
+ throw exception ( make_error_code (errc::runtime) ,
185
+ " joint matrix is not supported on host. " );
187
186
#endif // __SYCL_DEVICE_ONLY__
188
187
}
189
188
@@ -206,8 +205,8 @@ class wi_element {
206
205
#define OP (op ) \
207
206
template <typename T2> wi_element &operator op##=(const T2 & rhs) { \
208
207
(void )rhs; \
209
- throw runtime_error ( " joint matrix is not supported on host device. " , \
210
- PI_ERROR_INVALID_DEVICE); \
208
+ throw exception ( make_error_code (errc::runtime), \
209
+ " joint matrix is not supported on host. " ); \
211
210
}
212
211
#endif // __SYCL_DEVICE_ONLY__
213
212
OP (+)
@@ -242,8 +241,8 @@ class wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, Layout,
242
241
const uint32_t col = coord[1 ];
243
242
return std::make_tuple (row, col);
244
243
#else
245
- throw runtime_error ( " joint matrix is not supported on host device. " ,
246
- PI_ERROR_INVALID_DEVICE );
244
+ throw exception ( make_error_code (errc::runtime) ,
245
+ " joint matrix is not supported on host. " );
247
246
#endif // __SYCL_DEVICE_ONLY__
248
247
}
249
248
@@ -255,8 +254,8 @@ class wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, Layout,
255
254
spv_matrix_layout_traits<Layout>::value,
256
255
spv_scope_traits<Group>::value>(M.spvm , idx);
257
256
#else
258
- throw runtime_error ( " joint matrix is not supported on host device. " ,
259
- PI_ERROR_INVALID_DEVICE );
257
+ throw exception ( make_error_code (errc::runtime) ,
258
+ " joint matrix is not supported on host. " );
260
259
#endif // __SYCL_DEVICE_ONLY__
261
260
}
262
261
@@ -270,8 +269,8 @@ class wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, Layout,
270
269
spv_scope_traits<Group>::value>(M.spvm , idx))) >=
271
270
std::numeric_limits<float >::epsilon ();
272
271
#else
273
- throw runtime_error ( " joint matrix is not supported on host device. " ,
274
- PI_ERROR_INVALID_DEVICE );
272
+ throw exception ( make_error_code (errc::runtime) ,
273
+ " joint matrix is not supported on host. " );
275
274
#endif // __SYCL_DEVICE_ONLY__
276
275
}
277
276
@@ -281,8 +280,8 @@ class wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, Layout,
281
280
return *this ;
282
281
#else
283
282
(void )rhs;
284
- throw runtime_error ( " joint matrix is not supported on host device. " ,
285
- PI_ERROR_INVALID_DEVICE );
283
+ throw exception ( make_error_code (errc::runtime) ,
284
+ " joint matrix is not supported on host. " );
286
285
#endif // __SYCL_DEVICE_ONLY__
287
286
}
288
287
@@ -301,8 +300,8 @@ class wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, Layout,
301
300
return *this ;
302
301
#else
303
302
(void )rhs;
304
- throw runtime_error ( " joint matrix is not supported on host device. " ,
305
- PI_ERROR_INVALID_DEVICE );
303
+ throw exception ( make_error_code (errc::runtime) ,
304
+ " joint matrix is not supported on host. " );
306
305
#endif // __SYCL_DEVICE_ONLY__
307
306
}
308
307
@@ -323,8 +322,8 @@ class wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, Layout,
323
322
#define OP (opassign, op ) \
324
323
wi_element &operator opassign (const sycl::ext::oneapi::bfloat16 & rhs) { \
325
324
(void )rhs; \
326
- throw runtime_error ( " joint matrix is not supported on host device. " , \
327
- PI_ERROR_INVALID_DEVICE); \
325
+ throw exception ( make_error_code (errc::runtime), \
326
+ " joint matrix is not supported on host. " ); \
328
327
}
329
328
#endif // __SYCL_DEVICE_ONLY__
330
329
OP (+=, +)
@@ -398,15 +397,15 @@ class wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, Layout,
398
397
const wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, \
399
398
Layout, Group> &, \
400
399
const sycl::ext::oneapi::bfloat16 &) { \
401
- throw runtime_error ( " joint matrix is not supported on host device. " , \
402
- PI_ERROR_INVALID_DEVICE); \
400
+ throw exception ( make_error_code (errc::runtime), \
401
+ " joint matrix is not supported on host. " ); \
403
402
} \
404
403
friend type operator op ( \
405
404
const sycl::ext::oneapi::bfloat16 &, \
406
405
const wi_element<sycl::ext::oneapi::bfloat16, NumRows, NumCols, Use, \
407
406
Layout, Group> &) { \
408
- throw runtime_error ( " joint matrix is not supported on host device. " , \
409
- PI_ERROR_INVALID_DEVICE); \
407
+ throw exception ( make_error_code (errc::runtime), \
408
+ " joint matrix is not supported on host. " ); \
410
409
}
411
410
OP (sycl::ext::oneapi::bfloat16, +)
412
411
OP(sycl::ext::oneapi::bfloat16, -)
@@ -451,8 +450,8 @@ class wi_data {
451
450
#if __SYCL_DEVICE_ONLY__
452
451
return __spirv_JointMatrixWorkItemLengthINTEL (jm.spvm );
453
452
#else
454
- throw runtime_error ( " joint matrix is not supported on host device. " ,
455
- PI_ERROR_INVALID_DEVICE );
453
+ throw exception ( make_error_code (errc::runtime) ,
454
+ " joint matrix is not supported on host. " );
456
455
#endif
457
456
};
458
457
@@ -496,10 +495,10 @@ joint_matrix_store(Group,
496
495
std::ignore = src;
497
496
std::ignore = dst;
498
497
std::ignore = stride;
499
- throw runtime_error (
498
+ throw exception (
499
+ make_error_code (errc::runtime),
500
500
" This version of the matrix extension is only currently supported on "
501
- " intel devices" ,
502
- PI_ERROR_INVALID_DEVICE);
501
+ " intel devices" );
503
502
#else
504
503
// intel's impl
505
504
using DecorT = typename sycl::detail::DecoratedType<T, Space>::type;
@@ -518,8 +517,8 @@ joint_matrix_store(Group,
518
517
std::ignore = src;
519
518
std::ignore = dst;
520
519
std::ignore = stride;
521
- throw runtime_error ( " joint matrix is not supported on host device. " ,
522
- PI_ERROR_INVALID_DEVICE );
520
+ throw exception ( make_error_code (errc::runtime) ,
521
+ " joint matrix is not supported on host. " );
523
522
#endif // defined(__SYCL_DEVICE_ONLY__)
524
523
}
525
524
@@ -542,10 +541,10 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_store(
542
541
std::ignore = src;
543
542
std::ignore = dst;
544
543
std::ignore = stride;
545
- throw runtime_error (
544
+ throw exception (
545
+ make_error_code (errc::runtime),
546
546
" This version of the matrix extension is only currently supported on "
547
- " intel devices" ,
548
- PI_ERROR_INVALID_DEVICE);
547
+ " intel devices" );
549
548
#else
550
549
// intel's impl
551
550
T *Ptr = dst.get ();
@@ -563,8 +562,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_store(
563
562
std::ignore = src;
564
563
std::ignore = dst;
565
564
std::ignore = stride;
566
- throw runtime_error ( " joint matrix is not supported on host device. " ,
567
- PI_ERROR_INVALID_DEVICE );
565
+ throw exception ( make_error_code (errc::runtime) ,
566
+ " joint matrix is not supported on host. " );
568
567
#endif // defined(__SYCL_DEVICE_ONLY__)
569
568
}
570
569
@@ -599,8 +598,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_apply(
599
598
std::ignore = sg;
600
599
std::ignore = jm;
601
600
std::ignore = lambda;
602
- throw runtime_error ( " joint matrix is not supported on host device. " ,
603
- PI_ERROR_INVALID_DEVICE );
601
+ throw exception ( make_error_code (errc::runtime) ,
602
+ " joint matrix is not supported on host. " );
604
603
#endif
605
604
}
606
605
@@ -630,8 +629,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_fill_checked(
630
629
std::ignore = Width;
631
630
std::ignore = CoordX;
632
631
std::ignore = CoordY;
633
- throw runtime_error ( " joint matrix is not supported on host device. " ,
634
- PI_ERROR_INVALID_DEVICE );
632
+ throw exception ( make_error_code (errc::runtime) ,
633
+ " joint matrix is not supported on host. " );
635
634
#endif // defined(__SYCL_DEVICE_ONLY__)
636
635
}
637
636
@@ -668,8 +667,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_load_checked(
668
667
std::ignore = Layout;
669
668
std::ignore = CoordX;
670
669
std::ignore = CoordY;
671
- throw runtime_error ( " joint matrix is not supported on host device. " ,
672
- PI_ERROR_INVALID_DEVICE );
670
+ throw exception ( make_error_code (errc::runtime) ,
671
+ " joint matrix is not supported on host. " );
673
672
#endif // defined(__SYCL_DEVICE_ONLY__)
674
673
}
675
674
@@ -705,8 +704,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_load_checked(
705
704
std::ignore = Width;
706
705
std::ignore = CoordX;
707
706
std::ignore = CoordY;
708
- throw runtime_error ( " joint matrix is not supported on host device. " ,
709
- PI_ERROR_INVALID_DEVICE );
707
+ throw exception ( make_error_code (errc::runtime) ,
708
+ " joint matrix is not supported on host. " );
710
709
#endif // defined(__SYCL_DEVICE_ONLY__)
711
710
}
712
711
@@ -740,8 +739,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_store_checked(
740
739
std::ignore = Layout;
741
740
std::ignore = CoordX;
742
741
std::ignore = CoordY;
743
- throw runtime_error ( " joint matrix is not supported on host device. " ,
744
- PI_ERROR_INVALID_DEVICE );
742
+ throw exception ( make_error_code (errc::runtime) ,
743
+ " joint matrix is not supported on host. " );
745
744
#endif // defined(__SYCL_DEVICE_ONLY__)
746
745
}
747
746
@@ -773,8 +772,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_store_checked(
773
772
std::ignore = Width;
774
773
std::ignore = CoordX;
775
774
std::ignore = CoordY;
776
- throw runtime_error ( " joint matrix is not supported on host device. " ,
777
- PI_ERROR_INVALID_DEVICE );
775
+ throw exception ( make_error_code (errc::runtime) ,
776
+ " joint matrix is not supported on host. " );
778
777
#endif // defined(__SYCL_DEVICE_ONLY__)
779
778
}
780
779
@@ -808,8 +807,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_load_checked(
808
807
std::ignore = Layout;
809
808
std::ignore = CoordX;
810
809
std::ignore = CoordY;
811
- throw runtime_error ( " joint matrix is not supported on host device. " ,
812
- PI_ERROR_INVALID_DEVICE );
810
+ throw exception ( make_error_code (errc::runtime) ,
811
+ " joint matrix is not supported on host. " );
813
812
#endif // defined(__SYCL_DEVICE_ONLY__)
814
813
}
815
814
@@ -841,8 +840,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_load_checked(
841
840
std::ignore = Width;
842
841
std::ignore = CoordX;
843
842
std::ignore = CoordY;
844
- throw runtime_error ( " joint matrix is not supported on host device. " ,
845
- PI_ERROR_INVALID_DEVICE );
843
+ throw exception ( make_error_code (errc::runtime) ,
844
+ " joint matrix is not supported on host. " );
846
845
#endif // defined(__SYCL_DEVICE_ONLY__)
847
846
}
848
847
@@ -873,8 +872,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_store_checked(
873
872
std::ignore = Layout;
874
873
std::ignore = CoordX;
875
874
std::ignore = CoordY;
876
- throw runtime_error ( " joint matrix is not supported on host device. " ,
877
- PI_ERROR_INVALID_DEVICE );
875
+ throw exception ( make_error_code (errc::runtime) ,
876
+ " joint matrix is not supported on host. " );
878
877
#endif // defined(__SYCL_DEVICE_ONLY__)
879
878
}
880
879
@@ -902,8 +901,8 @@ inline __SYCL_ALWAYS_INLINE void joint_matrix_store_checked(
902
901
std::ignore = Width;
903
902
std::ignore = CoordX;
904
903
std::ignore = CoordY;
905
- throw runtime_error ( " joint matrix is not supported on host device. " ,
906
- PI_ERROR_INVALID_DEVICE );
904
+ throw exception ( make_error_code (errc::runtime) ,
905
+ " joint matrix is not supported on host. " );
907
906
#endif // defined(__SYCL_DEVICE_ONLY__)
908
907
}
909
908
// End out-of-bounds API
0 commit comments