Skip to content

Commit c172f59

Browse files
0cc4mgraehl
authored andcommitted
tests: Fix OPT_STEP_SGD test-backend-ops
1 parent b2abcfd commit c172f59

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

ggml/src/ggml.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,9 @@ static const char * GGML_OP_NAME[GGML_OP_COUNT] = {
10061006
"CROSS_ENTROPY_LOSS",
10071007
"CROSS_ENTROPY_LOSS_BACK",
10081008
"OPT_STEP_ADAMW",
1009-
"GLU",
10101009
"OPT_STEP_SGD",
1010+
1011+
"GLU",
10111012
};
10121013

10131014
static_assert(GGML_OP_COUNT == 87, "GGML_OP_COUNT != 87");
@@ -1106,8 +1107,9 @@ static const char * GGML_OP_SYMBOL[GGML_OP_COUNT] = {
11061107
"cross_entropy_loss(x,y)",
11071108
"cross_entropy_loss_back(x,y)",
11081109
"adamw(x)",
1109-
"glu(x)",
11101110
"sgd(x)",
1111+
1112+
"glu(x)",
11111113
};
11121114

11131115
static_assert(GGML_OP_POOL_COUNT == 2, "GGML_OP_POOL_COUNT != 2");

tests/test-backend-ops.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5110,7 +5110,7 @@ static const ggml_type other_types[] = {
51105110
};
51115111

51125112
// Test cases for evaluation: should try to cover edge cases while using small input sizes to keep the runtime low
5113-
static std::vector<std::unique_ptr<test_case>> make_test_cases_eval(bool test_sgd = true) {
5113+
static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
51145114
std::vector<std::unique_ptr<test_case>> test_cases;
51155115
std::default_random_engine rng(0);
51165116

@@ -5912,8 +5912,7 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval(bool test_sg
59125912
test_cases.emplace_back(new test_cross_entropy_loss_back(GGML_TYPE_F32, {30000, 1, 1, 1}));
59135913

59145914
test_cases.emplace_back(new test_opt_step_adamw(GGML_TYPE_F32, {10, 5, 4, 3}));
5915-
if (test_sgd)
5916-
test_cases.emplace_back(new test_opt_step_sgd(GGML_TYPE_F32, { 10, 5, 4, 3 }));
5915+
test_cases.emplace_back(new test_opt_step_sgd(GGML_TYPE_F32, { 10, 5, 4, 3 }));
59175916

59185917
#if 0
59195918
// these tests are disabled to save execution time, sbut they can be handy for debugging
@@ -6051,10 +6050,6 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
60516050
}
60526051
};
60536052

6054-
char const* name = ggml_backend_name(backend);
6055-
bool const vulkan = strstr(name, "ulkan");
6056-
bool const sgd = !vulkan;
6057-
60586053
if (mode == MODE_TEST) {
60596054
auto test_cases = make_test_cases_eval();
60606055
filter_test_cases(test_cases, params_filter);
@@ -6080,7 +6075,7 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
60806075
}
60816076

60826077
if (mode == MODE_GRAD) {
6083-
auto test_cases = make_test_cases_eval(sgd);
6078+
auto test_cases = make_test_cases_eval();
60846079
filter_test_cases(test_cases, params_filter);
60856080
size_t n_ok = 0;
60866081
for (auto & test : test_cases) {

0 commit comments

Comments
 (0)