@@ -22,12 +22,11 @@ namespace function {
2222
2323namespace {
2424
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 (context, false , InvalidType, /* void */ ); \
2828 }
2929
30- // TODO Fail using runtime context
3130#define __NUMBER_ET_PRIM_OP_IMPL (operator, stack, context ) \
3231 (void )context; \
3332 EValue& a = *stack[0 ]; \
@@ -168,8 +167,7 @@ static Kernel prim_ops[] = {
168167 } else if (a.isDouble () && b.isInt ()) {
169168 floor_div_double (a.toDouble (), static_cast <double >(b.toInt ()), out);
170169 } else {
171- // TODO Fail using runtime context
172- ET_CHECK_MSG (false , " %zu, %zu" , (size_t )a.tag , (size_t )b.tag );
170+ ET_KERNEL_CHECK (context, false , InvalidType, /* void */ );
173171 }
174172 }),
175173
@@ -193,8 +191,7 @@ static Kernel prim_ops[] = {
193191 } else if (a.isDouble () && b.isInt ()) {
194192 out = EValue (a.toDouble () / b.toInt ());
195193 } else {
196- // TODO Fail using runtime context
197- ET_CHECK_MSG (false , " %zu, %zu" , (size_t )a.tag , (size_t )b.tag );
194+ ET_KERNEL_CHECK (context, false , InvalidType, /* void */ );
198195 }
199196 }),
200197
@@ -214,8 +211,7 @@ static Kernel prim_ops[] = {
214211 // TODO: This should be impossible
215212 out = EValue (a.toDouble ());
216213 } else {
217- // TODO Fail using runtime context
218- ET_CHECK_MSG (false , " %zu" , (size_t )a.tag );
214+ ET_KERNEL_CHECK (context, false , InvalidType, /* void */ );
219215 }
220216 }),
221217
@@ -265,8 +261,7 @@ static Kernel prim_ops[] = {
265261 } else if (a.isDouble ()) {
266262 out = EValue (-a.toDouble ());
267263 } else {
268- // TODO Fail using runtime context
269- ET_CHECK_MSG (false , " %zu" , (size_t )a.tag );
264+ ET_KERNEL_CHECK (context, false , InvalidType, /* void */ );
270265 }
271266 }),
272267
@@ -303,7 +298,7 @@ static Kernel prim_ops[] = {
303298 if (a.isInt () && b.isInt ()) {
304299 out = EValue (a.toInt () % b.toInt ());
305300 } else {
306- ET_CHECK_MSG ( false , " %zu, %zu " , ( size_t )a. tag , ( size_t )b. tag );
301+ ET_KERNEL_CHECK (context, false , InvalidType, /* void */ );
307302 }
308303 }),
309304
@@ -317,7 +312,7 @@ static Kernel prim_ops[] = {
317312 if (a.isDouble ()) {
318313 out = EValue (static_cast <int64_t >(ceil (a.toDouble ())));
319314 } else {
320- ET_CHECK_MSG ( false , " Unsupported DType %zu " , ( size_t )a. tag );
315+ ET_KERNEL_CHECK (context, false , InvalidType, /* void */ );
321316 }
322317 }),
323318
@@ -348,7 +343,7 @@ static Kernel prim_ops[] = {
348343
349344 out = EValue (static_cast <int64_t >(res));
350345 } else {
351- ET_CHECK_MSG ( false , " Unsupported DType %zu " , ( size_t )a. tag );
346+ ET_KERNEL_CHECK (context, false , InvalidType, /* void */ );
352347 }
353348 }),
354349
@@ -362,7 +357,7 @@ static Kernel prim_ops[] = {
362357 if (a.isDouble ()) {
363358 out = EValue (static_cast <int64_t >(trunc (a.toDouble ())));
364359 } else {
365- ET_CHECK_MSG ( false , " %zu " , ( size_t )a. tag );
360+ ET_KERNEL_CHECK (context, false , InvalidType, /* void */ );
366361 }
367362 }),
368363
0 commit comments