Skip to content

Commit 19e7409

Browse files
0cc4mgraehl
authored andcommitted
tests: Fix OPT_STEP_SGD test-backend-ops
1 parent 12d5b75 commit 19e7409

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
@@ -1012,8 +1012,9 @@ static const char * GGML_OP_NAME[GGML_OP_COUNT] = {
10121012
"CROSS_ENTROPY_LOSS",
10131013
"CROSS_ENTROPY_LOSS_BACK",
10141014
"OPT_STEP_ADAMW",
1015-
"GLU",
10161015
"OPT_STEP_SGD",
1016+
1017+
"GLU",
10171018
};
10181019

10191020
static const char * GGML_OP_SYMBOL[GGML_OP_COUNT] = {
@@ -1111,8 +1112,9 @@ static const char * GGML_OP_SYMBOL[GGML_OP_COUNT] = {
11111112
"cross_entropy_loss(x,y)",
11121113
"cross_entropy_loss_back(x,y)",
11131114
"adamw(x)",
1114-
"glu(x)",
11151115
"sgd(x)",
1116+
1117+
"glu(x)",
11161118
};
11171119

11181120
static_assert(GGML_OP_COUNT == 88, "GGML_OP_COUNT != 88");

tests/test-backend-ops.cpp

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

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

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

60996099
test_cases.emplace_back(new test_opt_step_adamw(GGML_TYPE_F32, {10, 5, 4, 3}));
6100-
if (test_sgd)
6101-
test_cases.emplace_back(new test_opt_step_sgd(GGML_TYPE_F32, { 10, 5, 4, 3 }));
6100+
test_cases.emplace_back(new test_opt_step_sgd(GGML_TYPE_F32, { 10, 5, 4, 3 }));
61026101

61036102
#if 0
61046103
// these tests are disabled to save execution time, sbut they can be handy for debugging
@@ -6242,10 +6241,6 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
62426241
}
62436242
};
62446243

6245-
char const* name = ggml_backend_name(backend);
6246-
bool const vulkan = strstr(name, "ulkan");
6247-
bool const sgd = !vulkan;
6248-
62496244
if (mode == MODE_TEST) {
62506245
auto test_cases = make_test_cases_eval();
62516246
filter_test_cases(test_cases, params_filter);
@@ -6271,7 +6266,7 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
62716266
}
62726267

62736268
if (mode == MODE_GRAD) {
6274-
auto test_cases = make_test_cases_eval(sgd);
6269+
auto test_cases = make_test_cases_eval();
62756270
filter_test_cases(test_cases, params_filter);
62766271
size_t n_ok = 0;
62776272
for (auto & test : test_cases) {

0 commit comments

Comments
 (0)