@@ -511,7 +511,7 @@ struct test_result {
511511};
512512
513513// Printer classes for different output formats
514- enum class test_status_t { NOT_SUPPORTED, OK, FAIL };
514+ enum class test_status_t { NOT_SUPPORTED, OK, FAIL, SKIPPED };
515515
516516struct test_operation_info {
517517 std::string op_name;
@@ -687,6 +687,8 @@ struct printer {
687687 virtual void print_backend_status (const backend_status_info & info) { (void ) info; }
688688
689689 virtual void print_overall_summary (const overall_summary_info & info) { (void ) info; }
690+
691+ virtual void print_failed_tests (const std::vector<std::string> & failed_tests) { (void ) failed_tests; }
690692};
691693
692694struct console_printer : public printer {
@@ -804,6 +806,17 @@ struct console_printer : public printer {
804806 }
805807 }
806808
809+ void print_failed_tests (const std::vector<std::string> & failed_tests) override {
810+ if (failed_tests.empty ()) {
811+ return ;
812+ }
813+
814+ printf (" \n Failing tests:\n " );
815+ for (const auto & test_name : failed_tests) {
816+ printf (" %s\n " , test_name.c_str ());
817+ }
818+ }
819+
807820 private:
808821 void print_test_console (const test_result & result) {
809822 printf (" %s(%s): " , result.op_name .c_str (), result.op_params .c_str ());
@@ -1056,6 +1069,8 @@ struct test_case {
10561069
10571070 std::vector<ggml_tensor *> sentinels;
10581071
1072+ std::string current_op_name;
1073+
10591074 void add_sentinel (ggml_context * ctx) {
10601075 if (mode == MODE_PERF || mode == MODE_GRAD || mode == MODE_SUPPORT) {
10611076 return ;
@@ -1127,7 +1142,10 @@ struct test_case {
11271142 }
11281143 }
11291144
1130- bool eval (ggml_backend_t backend1, ggml_backend_t backend2, const char * op_names_filter, printer * output_printer) {
1145+ test_status_t eval (ggml_backend_t backend1,
1146+ ggml_backend_t backend2,
1147+ const char * op_names_filter,
1148+ printer * output_printer) {
11311149 mode = MODE_TEST;
11321150
11331151 ggml_init_params params = {
@@ -1144,11 +1162,12 @@ struct test_case {
11441162 add_sentinel (ctx);
11451163
11461164 ggml_tensor * out = build_graph (ctx);
1147- std::string current_op_name = op_desc (out);
1165+ current_op_name = op_desc (out);
1166+
11481167 if (!matches_filter (out, op_names_filter)) {
11491168 // printf(" %s: skipping\n", op_desc(out).c_str());
11501169 ggml_free (ctx);
1151- return true ;
1170+ return test_status_t ::SKIPPED ;
11521171 }
11531172
11541173 // check if the backends support the ops
@@ -1172,7 +1191,7 @@ struct test_case {
11721191 }
11731192
11741193 ggml_free (ctx);
1175- return true ;
1194+ return test_status_t ::NOT_SUPPORTED ;
11761195 }
11771196
11781197 // post-graph sentinel
@@ -1184,7 +1203,7 @@ struct test_case {
11841203 if (buf == NULL ) {
11851204 printf (" failed to allocate tensors [%s] " , ggml_backend_name (backend1));
11861205 ggml_free (ctx);
1187- return false ;
1206+ return test_status_t ::FAIL ;
11881207 }
11891208
11901209 // build graph
@@ -1289,7 +1308,7 @@ struct test_case {
12891308 output_printer->print_test_result (result);
12901309 }
12911310
1292- return test_passed;
1311+ return test_passed ? test_status_t ::OK : test_status_t ::FAIL ;
12931312 }
12941313
12951314 bool eval_perf (ggml_backend_t backend, const char * op_names_filter, printer * output_printer) {
@@ -1306,7 +1325,7 @@ struct test_case {
13061325 GGML_ASSERT (ctx);
13071326
13081327 ggml_tensor * out = build_graph (ctx.get ());
1309- std::string current_op_name = op_desc (out);
1328+ current_op_name = op_desc (out);
13101329 if (!matches_filter (out, op_names_filter)) {
13111330 // printf(" %s: skipping\n", op_desc(out).c_str());
13121331 return true ;
@@ -1435,8 +1454,9 @@ struct test_case {
14351454 ggml_context_ptr ctx (ggml_init (params)); // smart ptr
14361455 GGML_ASSERT (ctx);
14371456
1438- ggml_tensor * out = build_graph (ctx.get ());
1439- std::string current_op_name = op_desc (out);
1457+ ggml_tensor * out = build_graph (ctx.get ());
1458+ current_op_name = op_desc (out);
1459+
14401460 if (!matches_filter (out, op_names_filter)) {
14411461 return true ;
14421462 }
@@ -7360,16 +7380,26 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
73607380 }
73617381
73627382 size_t n_ok = 0 ;
7383+ size_t tests_run = 0 ;
7384+ std::vector<std::string> failed_tests;
73637385 for (auto & test : test_cases) {
7364- if (test->eval (backend, backend_cpu, op_names_filter, output_printer)) {
7386+ test_status_t status = test->eval (backend, backend_cpu, op_names_filter, output_printer);
7387+ if (status == test_status_t ::SKIPPED || status == test_status_t ::NOT_SUPPORTED) {
7388+ continue ;
7389+ }
7390+ tests_run++;
7391+ if (status == test_status_t ::OK) {
73657392 n_ok++;
7393+ } else if (status == test_status_t ::FAIL) {
7394+ failed_tests.push_back (test->current_op_name + " (" + test->vars () + " )" );
73667395 }
73677396 }
7368- output_printer->print_summary (test_summary_info (n_ok, test_cases.size (), false ));
7397+ output_printer->print_summary (test_summary_info (n_ok, tests_run, false ));
7398+ output_printer->print_failed_tests (failed_tests);
73697399
73707400 ggml_backend_free (backend_cpu);
73717401
7372- return n_ok == test_cases. size () ;
7402+ return n_ok == tests_run ;
73737403 }
73747404
73757405 if (mode == MODE_GRAD) {
0 commit comments