Skip to content

Commit 44cbf16

Browse files
committed
adding default switch branch + newline EOF in test
1 parent d9ae9e7 commit 44cbf16

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/csrc/umath/matmul.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ quad_matmul_strided_loop_aligned(PyArrayMethod_Context *context, char *const dat
173173
&beta, C_ptr, ldc_numpy);
174174
break;
175175
}
176+
177+
default:
178+
PyErr_SetString(PyExc_RuntimeError,
179+
"internal error: unknown MatmulOperationType");
180+
return -1;
176181
}
177182

178183
if (result != 0) {
@@ -235,6 +240,10 @@ quad_matmul_strided_loop_unaligned(PyArrayMethod_Context *context, char *const d
235240
temp_B_buffer = new Sleef_quad[n * p];
236241
temp_C_buffer = new Sleef_quad[m * p];
237242
break;
243+
default:
244+
PyErr_SetString(PyExc_RuntimeError,
245+
"internal error: unknown MatmulOperationType");
246+
return -1;
238247
}
239248

240249
int result = 0;
@@ -276,6 +285,12 @@ quad_matmul_strided_loop_unaligned(PyArrayMethod_Context *context, char *const d
276285
}
277286
break;
278287
}
288+
289+
default:
290+
PyErr_SetString(PyExc_RuntimeError,
291+
"internal error: unknown MatmulOperationType");
292+
result = -1;
293+
break;
279294
}
280295

281296
if (result != 0) {
@@ -288,7 +303,9 @@ quad_matmul_strided_loop_unaligned(PyArrayMethod_Context *context, char *const d
288303
delete[] temp_C_buffer; // delete[] on nullptr is a no-op
289304

290305
if (result != 0) {
291-
PyErr_SetString(PyExc_RuntimeError, "QBLAS operation failed");
306+
if (!PyErr_Occurred()) {
307+
PyErr_SetString(PyExc_RuntimeError, "QBLAS operation failed");
308+
}
292309
return -1;
293310
}
294311

tests/test_dot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,4 +1053,4 @@ def test_batched_larger(self, batch, m, k, n):
10531053
A_f = rng.standard_normal((batch, m, k))
10541054
B_f = rng.standard_normal((batch, k, n))
10551055
_assert_matmul_matches_float64(_qnd(A_f), _qnd(B_f), A_f, B_f,
1056-
rtol=1e-13, atol=1e-13)
1056+
rtol=1e-13, atol=1e-13)

0 commit comments

Comments
 (0)