Skip to content

Commit fef08f0

Browse files
sbera77shaobo.xie
authored andcommitted
test-backend-ops : fix segfault in moe-expert-reduce test in support mode and coverage (#16936)
* tests: fix segfault in moe-expert-reduce test in support mode and --show-coverage * tests: init gf and filter out fusion tests for support mode * tests: filter out fusion cases before calling eval_support * tests: filter out fusion cases from show_test_coverage as well, fix lint
1 parent f559c88 commit fef08f0

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/test-backend-ops.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,8 @@ struct test_case {
18101810
ggml_context_ptr ctx(ggml_init(params)); // smart ptr
18111811
GGML_ASSERT(ctx);
18121812

1813+
gf = ggml_new_graph_custom(ctx.get(), graph_nodes, false);
1814+
18131815
ggml_tensor * out = build_graph(ctx.get());
18141816
current_op_name = op_desc(out);
18151817

@@ -8250,6 +8252,15 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
82508252
if (mode == MODE_SUPPORT) {
82518253
auto test_cases = make_test_cases_eval();
82528254
filter_test_cases(test_cases, params_filter);
8255+
8256+
// Filter out fusion cases
8257+
test_cases.erase(
8258+
std::remove_if(test_cases.begin(), test_cases.end(), [](const std::unique_ptr<test_case> & tc) {
8259+
return tc->run_whole_graph();
8260+
}),
8261+
test_cases.end()
8262+
);
8263+
82538264
for (auto & test : test_cases) {
82548265
test->eval_support(backend, op_names_filter, output_printer);
82558266
}
@@ -8300,6 +8311,14 @@ static void show_test_coverage() {
83008311
all_ops.insert(ggml_glu_op_name((enum ggml_glu_op)i));
83018312
}
83028313
auto test_cases = make_test_cases_eval();
8314+
// Filter out fusion cases
8315+
test_cases.erase(
8316+
std::remove_if(test_cases.begin(), test_cases.end(), [](const std::unique_ptr<test_case> & tc) {
8317+
return tc->run_whole_graph();
8318+
}),
8319+
test_cases.end()
8320+
);
8321+
83038322
std::set<std::string> tested_ops;
83048323

83058324
ggml_init_params params = {

0 commit comments

Comments
 (0)