Run the full SIMD test suite. Returns the number of failures.
| 1392 | |
| 1393 | /// Run the full SIMD test suite. Returns the number of failures. |
| 1394 | inline int runSimdTests() { |
| 1395 | const SimdTestEntry* tests = nullptr; |
| 1396 | int num_tests = 0; |
| 1397 | getTests(&tests, &num_tests); |
| 1398 | |
| 1399 | int passed = 0; |
| 1400 | int failed = 0; |
| 1401 | |
| 1402 | FL_PRINT("\n[SIMD AUTORESEARCH]"); |
| 1403 | FL_PRINT("────────────────────────────────────────────────────────────────"); |
| 1404 | |
| 1405 | #if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) |
| 1406 | FL_PRINT(" SIMD Backend: x86 SSE2"); |
| 1407 | #elif defined(__XTENSA__) && FL_XTENSA_HAS_PIE |
| 1408 | FL_PRINT(" SIMD Backend: Xtensa PIE (ESP32-S3)"); |
| 1409 | #elif defined(__XTENSA__) |
| 1410 | FL_PRINT(" SIMD Backend: Xtensa scalar"); |
| 1411 | #elif defined(__riscv) |
| 1412 | FL_PRINT(" SIMD Backend: RISC-V scalar"); |
| 1413 | #else |
| 1414 | FL_PRINT(" SIMD Backend: Scalar fallback"); |
| 1415 | #endif |
| 1416 | |
| 1417 | fl::sstream ss; |
| 1418 | ss << " Running " << num_tests << " SIMD tests...\n"; |
| 1419 | FL_PRINT(ss.str()); |
| 1420 | |
| 1421 | for (int i = 0; i < num_tests; i++) { |
| 1422 | bool ok = tests[i].func(); |
| 1423 | if (ok) { |
| 1424 | passed++; |
| 1425 | ss.clear(); |
| 1426 | ss << " [PASS] " << tests[i].name; |
| 1427 | FL_PRINT(ss.str()); |
| 1428 | } else { |
| 1429 | failed++; |
| 1430 | ss.clear(); |
| 1431 | ss << " [FAIL] " << tests[i].name; |
| 1432 | FL_ERROR(ss.str()); |
| 1433 | } |
| 1434 | } |
| 1435 | |
| 1436 | ss.clear(); |
| 1437 | ss << "\n[SIMD RESULTS] " << passed << "/" << num_tests << " passed"; |
| 1438 | if (failed > 0) { |
| 1439 | ss << ", " << failed << " FAILED"; |
| 1440 | FL_ERROR(ss.str()); |
| 1441 | } else { |
| 1442 | ss << " - ALL PASSED"; |
| 1443 | FL_PRINT(ss.str()); |
| 1444 | } |
| 1445 | |
| 1446 | return failed; |
| 1447 | } |
| 1448 | |
| 1449 | } // namespace simd_check |
| 1450 | } // namespace autoresearch |