@@ -22,12 +22,18 @@ namespace function {
22
22
23
23
namespace {
24
24
25
- #define __ET_PRIM_OP_ERROR_IMPL (a, b, context ) \
26
- else { \
27
- ET_CHECK_MSG (false , " %zu, %zu" , (size_t )a.tag , (size_t )b.tag ); \
25
+ #define __ET_PRIM_OP_ERROR_IMPL (a, b, context ) \
26
+ else { \
27
+ ET_KERNEL_CHECK_MSG ( \
28
+ context, \
29
+ false , \
30
+ InvalidType, \
31
+ /* void */ , \
32
+ " %zu, %zu" , \
33
+ (size_t )a.tag , \
34
+ (size_t )b.tag ); \
28
35
}
29
36
30
- // TODO Fail using runtime context
31
37
#define __NUMBER_ET_PRIM_OP_IMPL (operator, stack, context ) \
32
38
(void )context; \
33
39
EValue& a = *stack[0 ]; \
@@ -168,8 +174,14 @@ static Kernel prim_ops[] = {
168
174
} else if (a.isDouble () && b.isInt ()) {
169
175
floor_div_double (a.toDouble (), static_cast <double >(b.toInt ()), out);
170
176
} else {
171
- // TODO Fail using runtime context
172
- ET_CHECK_MSG (false , " %zu, %zu" , (size_t )a.tag , (size_t )b.tag );
177
+ ET_KERNEL_CHECK_MSG (
178
+ context,
179
+ false ,
180
+ InvalidType,
181
+ /* void */ ,
182
+ " %zu, %zu" ,
183
+ (size_t )a.tag ,
184
+ (size_t )b.tag );
173
185
}
174
186
}),
175
187
@@ -193,8 +205,14 @@ static Kernel prim_ops[] = {
193
205
} else if (a.isDouble () && b.isInt ()) {
194
206
out = EValue (a.toDouble () / b.toInt ());
195
207
} else {
196
- // TODO Fail using runtime context
197
- ET_CHECK_MSG (false , " %zu, %zu" , (size_t )a.tag , (size_t )b.tag );
208
+ ET_KERNEL_CHECK_MSG (
209
+ context,
210
+ false ,
211
+ InvalidType,
212
+ /* void */ ,
213
+ " %zu, %zu" ,
214
+ (size_t )a.tag ,
215
+ (size_t )b.tag );
198
216
}
199
217
}),
200
218
@@ -214,8 +232,8 @@ static Kernel prim_ops[] = {
214
232
// TODO: This should be impossible
215
233
out = EValue (a.toDouble ());
216
234
} else {
217
- // TODO Fail using runtime context
218
- ET_CHECK_MSG ( false , " %zu" , (size_t )a.tag );
235
+ ET_KERNEL_CHECK_MSG (
236
+ context, false , InvalidType, /* void */ , " %zu" , (size_t )a.tag );
219
237
}
220
238
}),
221
239
@@ -265,8 +283,8 @@ static Kernel prim_ops[] = {
265
283
} else if (a.isDouble ()) {
266
284
out = EValue (-a.toDouble ());
267
285
} else {
268
- // TODO Fail using runtime context
269
- ET_CHECK_MSG ( false , " %zu" , (size_t )a.tag );
286
+ ET_KERNEL_CHECK_MSG (
287
+ context, false , InvalidType, /* void */ , " %zu" , (size_t )a.tag );
270
288
}
271
289
}),
272
290
@@ -303,7 +321,14 @@ static Kernel prim_ops[] = {
303
321
if (a.isInt () && b.isInt ()) {
304
322
out = EValue (a.toInt () % b.toInt ());
305
323
} else {
306
- ET_CHECK_MSG (false , " %zu, %zu" , (size_t )a.tag , (size_t )b.tag );
324
+ ET_KERNEL_CHECK_MSG (
325
+ context,
326
+ false ,
327
+ InvalidType,
328
+ /* void */ ,
329
+ " %zu, %zu" ,
330
+ (size_t )a.tag ,
331
+ (size_t )b.tag );
307
332
}
308
333
}),
309
334
@@ -317,7 +342,13 @@ static Kernel prim_ops[] = {
317
342
if (a.isDouble ()) {
318
343
out = EValue (static_cast <int64_t >(ceil (a.toDouble ())));
319
344
} else {
320
- ET_CHECK_MSG (false , " Unsupported DType %zu" , (size_t )a.tag );
345
+ ET_KERNEL_CHECK_MSG (
346
+ context,
347
+ false ,
348
+ InvalidType,
349
+ /* void */ ,
350
+ " Unsupported DType %zu" ,
351
+ (size_t )a.tag );
321
352
}
322
353
}),
323
354
@@ -348,7 +379,13 @@ static Kernel prim_ops[] = {
348
379
349
380
out = EValue (static_cast <int64_t >(res));
350
381
} else {
351
- ET_CHECK_MSG (false , " Unsupported DType %zu" , (size_t )a.tag );
382
+ ET_KERNEL_CHECK_MSG (
383
+ context,
384
+ false ,
385
+ InvalidType,
386
+ /* void */ ,
387
+ " Unsupported DType %zu" ,
388
+ (size_t )a.tag );
352
389
}
353
390
}),
354
391
@@ -362,7 +399,8 @@ static Kernel prim_ops[] = {
362
399
if (a.isDouble ()) {
363
400
out = EValue (static_cast <int64_t >(trunc (a.toDouble ())));
364
401
} else {
365
- ET_CHECK_MSG (false , " %zu" , (size_t )a.tag );
402
+ ET_KERNEL_CHECK_MSG (
403
+ context, false , InvalidType, /* void */ , " %zu" , (size_t )a.tag );
366
404
}
367
405
}),
368
406
0 commit comments