@@ -1957,24 +1957,25 @@ struct test_get_rows : public test_case {
19571957 const int n; // cols
19581958 const int m; // rows
19591959 const int r; // rows to get
1960- const int b; // batch size
1960+ const int be1; // batch size
1961+ const int be2; // batch size
19611962 const bool v; // view (non-contiguous src1)
19621963
19631964 std::string vars () override {
1964- return VARS_TO_STR6 (type, n, m, r, b , v);
1965+ return VARS_TO_STR7 (type, n, m, r, be1, be2 , v);
19651966 }
19661967
1967- test_get_rows (ggml_type type = GGML_TYPE_F32, int n = 10 , int m = 5 , int r = 3 , int b = 1 , bool v = false )
1968- : type(type), n(n), m(m), r(r), b(b ), v(v) {}
1968+ test_get_rows (ggml_type type = GGML_TYPE_F32, int n = 10 , int m = 5 , int r = 3 , int be1 = 1 , int be2 = 1 , bool v = false )
1969+ : type(type), n(n), m(m), r(r), be1(be1), be2(be2 ), v(v) {}
19691970
19701971 ggml_tensor * build_graph (ggml_context * ctx) override {
1971- ggml_tensor * in = ggml_new_tensor_3d (ctx, type, n, m, b );
1972+ ggml_tensor * in = ggml_new_tensor_4d (ctx, type, n, m, be1, be2 );
19721973 ggml_set_name (in, " in" );
19731974
1974- ggml_tensor * rows = ggml_new_tensor_2d (ctx, GGML_TYPE_I32, r, b );
1975+ ggml_tensor * rows = ggml_new_tensor_3d (ctx, GGML_TYPE_I32, r, be1, be2 );
19751976 ggml_set_name (rows, " rows" );
19761977 if (v) {
1977- rows = ggml_view_2d (ctx, rows, r/2 , b, rows->nb [1 ], 0 );
1978+ rows = ggml_view_3d (ctx, rows, r/2 , be1, be2, rows->nb [1 ], rows-> nb [ 2 ], 0 );
19781979 ggml_set_name (rows, " view_of_rows" );
19791980 }
19801981
@@ -1995,11 +1996,11 @@ struct test_get_rows : public test_case {
19951996 if (t->type == GGML_TYPE_I32) {
19961997 if (ggml_is_view_op (t->op )) { continue ; }
19971998 // rows
1998- std::vector<int > data (r*b );
1999- for (int i = 0 ; i < r*b ; i++) {
1999+ std::vector<int > data (r*be1*be2 );
2000+ for (int i = 0 ; i < r*be1*be2 ; i++) {
20002001 data[i] = rand () % m;
20012002 }
2002- ggml_backend_tensor_set (t, data.data (), 0 , r * b * sizeof (int ));
2003+ ggml_backend_tensor_set (t, data.data (), 0 , r * be1 * be2 * sizeof (int ));
20032004 } else {
20042005 init_tensor_uniform (t);
20052006 }
@@ -5620,17 +5621,23 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
56205621 }
56215622 }
56225623
5623- test_cases.emplace_back (new test_get_rows (GGML_TYPE_F32, 1 , 8 , 2 , 1 , false ));
5624+ for (ggml_type type : {GGML_TYPE_F32, GGML_TYPE_Q4_0}) {
5625+ test_cases.emplace_back (new test_get_rows (type, 300 *256 , 5 , 4 , 1 , 2 , false ));
5626+ test_cases.emplace_back (new test_get_rows (type, 256 , 80000 , 70000 , 2 , 1 , false ));
5627+ test_cases.emplace_back (new test_get_rows (type, 256 , 5 , 4 , 700 , 100 , false ));
5628+ }
5629+
5630+ test_cases.emplace_back (new test_get_rows (GGML_TYPE_F32, 1 , 8 , 2 , 1 , 1 , false ));
56245631 for (ggml_type type : all_types) {
56255632 for (int b : {1 , 7 }) {
56265633 for (bool v : {false , true }) {
5627- test_cases.emplace_back (new test_get_rows (type, 256 , 5 , 4 , b, v));
5634+ test_cases.emplace_back (new test_get_rows (type, 256 , 5 , 4 , b, 1 , v));
56285635 }
56295636 }
56305637 }
56315638 for (int b : {1 , 7 }) {
56325639 for (bool v : {false , true }) {
5633- test_cases.emplace_back (new test_get_rows (GGML_TYPE_I32, 256 , 5 , 4 , b, v));
5640+ test_cases.emplace_back (new test_get_rows (GGML_TYPE_I32, 256 , 5 , 4 , b, 1 , v));
56345641 }
56355642 }
56365643
0 commit comments