RISC-V: enabled intrinsics in dotProd, relaxed test thresholds

This commit is contained in:
Maksim Shabunin 2024-12-23 23:58:37 +03:00
parent b42075f3e2
commit 0756dbfe3d
3 changed files with 15 additions and 5 deletions

View File

@ -2536,8 +2536,7 @@ double dotProd_16s(const short* src1, const short* src2, int len)
double dotProd_32s(const int* src1, const int* src2, int len) double dotProd_32s(const int* src1, const int* src2, int len)
{ {
#if CV_SIMD_64F // TODO: enable for CV_SIMD_SCALABLE_64F #if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
// Test failed on RVV(QEMU): Too big difference (=1.20209e-08 > 1.11022e-12)
double r = .0; double r = .0;
int i = 0; int i = 0;
const int step = VTraits<v_int32>::vlanes(); const int step = VTraits<v_int32>::vlanes();

View File

@ -477,8 +477,9 @@ class Core_DotProductTest : public Core_MatrixTest
public: public:
Core_DotProductTest(); Core_DotProductTest();
protected: protected:
void run_func(); void run_func() CV_OVERRIDE;
void prepare_to_validation( int test_case_idx ); void prepare_to_validation( int test_case_idx ) CV_OVERRIDE;
double get_success_error_level( int test_case_idx, int i, int j ) CV_OVERRIDE;
}; };
@ -498,6 +499,15 @@ void Core_DotProductTest::prepare_to_validation( int )
test_mat[REF_OUTPUT][0].at<Scalar>(0,0) = Scalar(cvtest::crossCorr( test_mat[INPUT][0], test_mat[INPUT][1] )); test_mat[REF_OUTPUT][0].at<Scalar>(0,0) = Scalar(cvtest::crossCorr( test_mat[INPUT][0], test_mat[INPUT][1] ));
} }
double Core_DotProductTest::get_success_error_level( int test_case_idx, int i, int j )
{
#ifdef __riscv
const int depth = test_mat[i][j].depth();
if (depth == CV_64F)
return 1.7e-5;
#endif
return Core_MatrixTest::get_success_error_level( test_case_idx, i, j );
}
///////// crossproduct ////////// ///////// crossproduct //////////

View File

@ -1078,6 +1078,7 @@ int CV_CompareHistTest::validate_test_results( int /*test_case_idx*/ )
i == CV_COMP_BHATTACHARYYA ? "Bhattacharyya" : i == CV_COMP_BHATTACHARYYA ? "Bhattacharyya" :
i == CV_COMP_KL_DIV ? "Kullback-Leibler" : "Unknown"; i == CV_COMP_KL_DIV ? "Kullback-Leibler" : "Unknown";
const auto thresh = FLT_EPSILON*14*MAX(fabs(v0),0.17);
if( cvIsNaN(v) || cvIsInf(v) ) if( cvIsNaN(v) || cvIsInf(v) )
{ {
ts->printf( cvtest::TS::LOG, "The comparison result using the method #%d (%s) is invalid (=%g)\n", ts->printf( cvtest::TS::LOG, "The comparison result using the method #%d (%s) is invalid (=%g)\n",
@ -1085,7 +1086,7 @@ int CV_CompareHistTest::validate_test_results( int /*test_case_idx*/ )
code = cvtest::TS::FAIL_INVALID_OUTPUT; code = cvtest::TS::FAIL_INVALID_OUTPUT;
break; break;
} }
else if( fabs(v0 - v) > FLT_EPSILON*14*MAX(fabs(v0),0.1) ) else if( fabs(v0 - v) > thresh )
{ {
ts->printf( cvtest::TS::LOG, "The comparison result using the method #%d (%s)\n\tis inaccurate (=%g, should be =%g)\n", ts->printf( cvtest::TS::LOG, "The comparison result using the method #%d (%s)\n\tis inaccurate (=%g, should be =%g)\n",
i, method_name, v, v0 ); i, method_name, v, v0 );