Skip to content

Commit 92684f2

Browse files
non-cont. b in test-backend-ops -o MUL_MAT
1 parent b380e66 commit 92684f2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/test-backend-ops.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ struct test_mul_mat : public test_case {
19811981
const std::array<int64_t, 2> bs; // dims 3 and 4
19821982
const std::array<int64_t, 2> nr; // repeat in dims 3 and 4
19831983
const std::array<int64_t, 4> per; // permutation of dimensions
1984-
const bool v; // whether a is a non-contiguous view
1984+
const bool v; // whether a and b are non-contiguous views
19851985

19861986
std::string vars() override {
19871987
return VARS_TO_STR9(type_a, type_b, m, n, k, bs, nr, per, v);
@@ -2042,12 +2042,15 @@ struct test_mul_mat : public test_case {
20422042
} else {
20432043

20442044
if (v) {
2045-
a = ggml_new_tensor_4d(ctx, type_a, k*2, m, bs[0], bs[1]);
2046-
a = ggml_view_4d(ctx, a, k, m, bs[0], bs[1], a->nb[1], a->nb[2], a->nb[3], 0);
2045+
a = ggml_new_tensor_4d(ctx, type_a, k*2, m, bs[0], bs[1]);
2046+
b = ggml_new_tensor_4d(ctx, type_b, k*2, n, bs[0]*nr[0], bs[1]*nr[1]);
2047+
2048+
a = ggml_view_4d(ctx, a, k, m, bs[0], bs[1], a->nb[1], a->nb[2], a->nb[3], 0);
2049+
b = ggml_view_4d(ctx, b, k, n, bs[0]*nr[0], bs[1]*nr[1], b->nb[1], b->nb[2], b->nb[3], 0);
20472050
} else {
20482051
a = ggml_new_tensor_4d(ctx, type_a, k, m, bs[0], bs[1]);
2052+
b = ggml_new_tensor_4d(ctx, type_b, k, n, bs[0]*nr[0], bs[1]*nr[1]);
20492053
}
2050-
b = ggml_new_tensor_4d(ctx, type_b, k, n, bs[0]*nr[0], bs[1]*nr[1]);
20512054
if (!ggml_is_quantized(type_a)) {
20522055
if (bs[1] == 1 && nr[1] == 1) {
20532056
ggml_set_param(ctx, a);

0 commit comments

Comments
 (0)