Skip to content

Commit

Permalink
add simd.math (#70)
Browse files Browse the repository at this point in the history
* add simd.math

* update simd.math and add an accurate and performance testing framework for simd.math

* update simd and simd.math

* fix unused func

* fix x86 CI test

* fix 2 test no pass and fix 1 unused

---------

Co-authored-by: 韦存阳 <[email protected]>
  • Loading branch information
Yyyerk and HWWH123 authored Sep 5, 2024
1 parent f9359d6 commit 5faa6f9
Show file tree
Hide file tree
Showing 14 changed files with 28,170 additions and 4 deletions.
24,825 changes: 24,821 additions & 4 deletions libcxx/include/experimental/simd

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

#include "simd_math_head.h"

int main()
{
/////////////////////// ACC /////////////////////////////

{
cout << "\n" << "***Erf float***" << "\n" << endl;
test_accuracy_for_single<float,float, llvm_test_single<float, float, ex::erf, erf>, vml_test_single<float, float, erf>>(1);
cout << "\n" << "***Erf double***" << "\n" << endl;
test_accuracy_for_single<double,double, llvm_test_single<double, double, ex::erf, erf>, vml_test_single<double, double, erf>>(1);
}

{
cout << "\n" << "***Erfc float***" << "\n" << endl;
test_accuracy_for_single<float,float, llvm_test_single<float, float, ex::erfc, erfc>, vml_test_single<float, float, erfc>>(1);
cout << "\n" << "***Erfc double***" << "\n" << endl;
test_accuracy_for_single<double,double, llvm_test_single<double, double, ex::erfc, erfc>, vml_test_single<double, double, erfc>>(1);
}



/////////////////////// ULP /////////////////////////////

{
cout << "\n" << "***Erf float***" << "\n" << endl;
ulp_test_accuracy_for_single<float, float, double, double, llvm_test_single<float, float, ex::erf, erf>, vml_test_single<double, double, erf>>(1);
}

{
cout << "\n" << "***Erfc float***" << endl;
ulp_test_accuracy_for_single<float, float, double, double, llvm_test_single<float, float, ex::erfc, erfc>, vml_test_single<double, double, erfc>>(1);
}

{
// long double test
#ifdef LDOUBLE_TEST
cout << "\n" << "***Erf long double***" << "\n" << endl;
test_accuracy_for_single<long double, long double, llvm_test_single<long double, long double, ex::erf, erf>, vml_test_single<long double, long double, erf>>(1);
cout << "\n" << "***Erfc long double***" << "\n" << endl;
test_accuracy_for_single<long double, long double, llvm_test_single<long double, long double, ex::erf, erf>, vml_test_single<long double, long double, erf>>(1);

cout << "\n" << "***Erf double***" << "\n" << endl;
ulp_test_accuracy_for_single<double, double, long double, long double, llvm_test_single<double, double, ex::erf, erf>, vml_test_single<long double, long double, erf>>(1);
cout << "\n" << "***Erf long double***" << "\n" << endl;
ulp_test_accuracy_for_single<long double, long double, long double, long double, llvm_test_single<long double, long double, ex::erf, erf>, vml_test_single<long double, long double, erf>>(1);

cout << "\n" << "***Erfc double***" << endl;
ulp_test_accuracy_for_single<double, double, long double, long double, llvm_test_single<double, double, ex::erfc, erfc>, vml_test_single<long double, long double, erfc>>(1);
cout << "\n" << "***Erfc long double***" << endl;
ulp_test_accuracy_for_single<long double, long double, long double, long double, llvm_test_single<long double, long double, ex::erfc, erfc>, vml_test_single<long double, long double, erfc>>(1);

#endif
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "simd_math_head.h"


int main()
{
/////////////////////// ACC /////////////////////////////
{
cout << "\n" << "***Expm1 float***" << "\n" << endl;
test_accuracy_for_single<float, float, llvm_test_single<float, float, ex::expm1, expm1>, vml_test_single<float, float, expm1>>(1);
cout << "\n" << "***Expm1 double***" << "\n" << endl;
test_accuracy_for_single<double, double, llvm_test_single<double, double, ex::expm1, expm1>, vml_test_single<double, double, expm1>>(1);
}

/////////////////////// ULP /////////////////////////////

{
cout << "\n" << "***Expm1 float***" << "\n" << endl;
ulp_test_accuracy_for_single<float, float, double, double, llvm_test_single<float, float, ex::expm1, expm1>, vml_test_single<double, double, expm1>>(1);
}

{
// long double test
#ifdef LDOUBLE_TEST
cout << "\n" << "***Exp long double***" << "\n" << endl;
test_accuracy_for_single<long double, long double, llvm_test_single<long double, long double, ex::exp, exp>, vml_test_single<long double, long double, exp>>(1);
cout << "\n" << "***Exp2 long double***" << "\n" << endl;
test_accuracy_for_single<long double, long double, llvm_test_single<long double, long double, ex::exp2, exp2>, vml_test_single<long double, long double, exp2>>(1);

cout << "\n" << "***Expm1 long double***" << "\n" << endl;
test_accuracy_for_single<long double, long double, llvm_test_single<long double, long double, ex::expm1, expm1>, vml_test_single<long double, long double, expm1>>(1);

cout << "\n" << "***Exp long double***" << "\n" << endl;
ulp_test_accuracy_for_single<long double, long double, long double, long double, llvm_test_single<long double, long double, ex::exp, exp>, vml_test_single<long double, long double, exp>>(1);

cout << "\n" << "***Exp2 long double***" << "\n" << endl;
ulp_test_accuracy_for_single<long double, long double, long double, long double, llvm_test_single<long double, long double, ex::exp2, exp2>, vml_test_single<long double, long double, exp2>>(1,1);

cout << "\n" << "***Expm1 double***" << "\n" << endl;
ulp_test_accuracy_for_single<double, double, long double, long double, llvm_test_single<double, double, ex::expm1, expm1>, vml_test_single<long double, long double, expm1>>(1);
cout << "\n" << "***Expm1 long double***" << "\n" << endl;
ulp_test_accuracy_for_single<long double, long double, long double, long double, llvm_test_single<long double, long double, ex::expm1, expm1>, vml_test_single<long double, long double, expm1>>(1);

#endif
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

#include "simd_math_head.h"

int main()
{
/////////////////////// ACC /////////////////////////////

{
cout << "\n" << "***Lgamma float***" << endl;
test_accuracy_for_single<float,float, llvm_test_single<float, float, ex::lgamma, lgamma>, vml_test_single<float, float, lgamma>>(1);
cout << "\n" << "***Lgamma double***" << endl;
test_accuracy_for_single<double,double, llvm_test_single<double, double, ex::lgamma, lgamma>, vml_test_single<double, double, lgamma>>(1);
// test_accuracy_for_single<long double, long double, llvm_test_single<long double, long double, ex::lgamma, lgamma>, vml_test_single<long double, long double, lgamma>>(1);
}

{
cout << "\n" << "***Tgamma float***" << "\n" << endl;
test_accuracy_for_single<float,float, llvm_test_single<float, float, ex::tgamma, tgamma>, vml_test_single<float, float, tgamma>>(1);
cout << "\n" << "***Tgamma double***" << endl;
test_accuracy_for_single<double,double, llvm_test_single<double, double, ex::tgamma, tgamma>, vml_test_single<double, double, tgamma>>(1);
}

/////////////////////// ULP /////////////////////////////


{
cout << "\n" << "***Tgamma float***" << endl;
ulp_test_accuracy_for_single<float,float, double, double, llvm_test_single<float, float, ex::tgamma, tgamma>, vml_test_single<double,double, tgamma>>(1);
}

{
cout << "\n" << "***Lgamma float***" << endl;
ulp_test_accuracy_for_single<float,float, double,double,llvm_test_single<float, float, ex::lgamma, lgamma>, vml_test_single<double,double, lgamma>>(1);
}

{
// long double test
#ifdef LDOUBLE_TEST
cout << "\n" << "***Lgamma long double***" << endl;
test_accuracy_for_single<long double, long double, llvm_test_single<long double, long double, ex::lgamma, lgamma>, vml_test_single<long double, long double, lgamma>>(1);

cout << "\n" << "***Tgamma long double***" << endl;
test_accuracy_for_single<long double, long double, llvm_test_single<long double, long double, ex::tgamma, tgamma>, vml_test_single<long double, long double, tgamma>>(1);

cout << "\n" << "***Tgamma double***" << endl;
ulp_test_accuracy_for_single<double,double, long double, long double, llvm_test_single<double, double, ex::tgamma, tgamma>, vml_test_single<long double, long double, tgamma>>(1);
cout << "\n" << "***Tgamma long double***" << endl;
ulp_test_accuracy_for_single<long double, long double, long double, long double, llvm_test_single<long double, long double, ex::tgamma, tgamma>, vml_test_single<long double, long double, tgamma>>(1);

cout << "\n" << "***Lgamma double***" << endl;
ulp_test_accuracy_for_single<double,double,long double, long double, llvm_test_single<double, double, ex::lgamma, lgamma>, vml_test_single<long double, long double, lgamma>>(1);
cout << "\n" << "***Lgamma long double***" << endl;
ulp_test_accuracy_for_single<long double, long double, long double, long double, llvm_test_single<long double, long double, ex::lgamma, lgamma>, vml_test_single<long double, long double, lgamma>>(1);
#endif
}
}
Loading

0 comments on commit 5faa6f9

Please sign in to comment.