@@ -1957,24 +1957,25 @@ struct test_get_rows : public test_case {
1957
1957
const int n; // cols
1958
1958
const int m; // rows
1959
1959
const int r; // rows to get
1960
- const int b; // batch size
1960
+ const int be1; // batch size
1961
+ const int be2; // batch size
1961
1962
const bool v; // view (non-contiguous src1)
1962
1963
1963
1964
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);
1965
1966
}
1966
1967
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) {}
1969
1970
1970
1971
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 );
1972
1973
ggml_set_name (in, " in" );
1973
1974
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 );
1975
1976
ggml_set_name (rows, " rows" );
1976
1977
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 );
1978
1979
ggml_set_name (rows, " view_of_rows" );
1979
1980
}
1980
1981
@@ -1995,11 +1996,11 @@ struct test_get_rows : public test_case {
1995
1996
if (t->type == GGML_TYPE_I32) {
1996
1997
if (ggml_is_view_op (t->op )) { continue ; }
1997
1998
// 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++) {
2000
2001
data[i] = rand () % m;
2001
2002
}
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 ));
2003
2004
} else {
2004
2005
init_tensor_uniform (t);
2005
2006
}
@@ -5620,17 +5621,23 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
5620
5621
}
5621
5622
}
5622
5623
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 ));
5624
5631
for (ggml_type type : all_types) {
5625
5632
for (int b : {1 , 7 }) {
5626
5633
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));
5628
5635
}
5629
5636
}
5630
5637
}
5631
5638
for (int b : {1 , 7 }) {
5632
5639
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));
5634
5641
}
5635
5642
}
5636
5643
0 commit comments