Skip to content

Commit

Permalink
unit_test/batched: Update BatchedGemm epsilon
Browse files Browse the repository at this point in the history
  • Loading branch information
e10harvey committed Jan 7, 2022
1 parent 8b97147 commit f4c1c66
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
7 changes: 6 additions & 1 deletion unit_test/batched/dense/Test_Batched_BatchedGemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ void impl_test_batched_gemm_with_handle(BatchedGemmHandle* batchedGemmHandle,
using mag_type = float;
mag_type sum(1), diff(0);

mag_type eps = (mag_type)(1 << 1) * KOKKOSKERNELS_IMPL_FP16_EPSILON;
auto eps = static_cast<mag_type>(ats::epsilon());

eps *= std::is_same<ScalarType, Kokkos::Experimental::half_t>::value ||
std::is_same<ScalarType, Kokkos::Experimental::bhalf_t>::value
? 4
: 1e3;

for (int k = 0; k < N; ++k) {
for (int i = 0; i < matCdim1; ++i) {
Expand Down
6 changes: 4 additions & 2 deletions unit_test/batched/dense/Test_Batched_SerialGemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ void impl_test_batched_gemm(const int N, const int matAdim1, const int matAdim2,

mag_type eps = ats::epsilon();

eps *=
std::is_same<value_type, Kokkos::Experimental::half_t>::value ? 4 : 1e3;
eps *= std::is_same<value_type, Kokkos::Experimental::half_t>::value ||
std::is_same<value_type, Kokkos::Experimental::bhalf_t>::value
? 4
: 1e3;

for (int k = 0; k < N; ++k)
for (int i = 0; i < matCdim1; ++i)
Expand Down
6 changes: 4 additions & 2 deletions unit_test/batched/dense/Test_Batched_TeamGemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ void impl_test_batched_teamgemm(const int N, const int matAdim1,
mag_type sum(1), diff(0);
mag_type eps = ats::epsilon();

eps *=
std::is_same<value_type, Kokkos::Experimental::half_t>::value ? 4 : 1e3;
eps *= std::is_same<value_type, Kokkos::Experimental::half_t>::value ||
std::is_same<value_type, Kokkos::Experimental::bhalf_t>::value
? 4
: 1e3;

for (int k = 0; k < N; ++k)
for (int i = 0; i < matCdim1; ++i)
Expand Down
6 changes: 4 additions & 2 deletions unit_test/batched/dense/Test_Batched_TeamVectorGemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ void impl_test_batched_teamvectorgemm(const int N, const int matAdim1,

mag_type eps = ats::epsilon();

eps *=
std::is_same<value_type, Kokkos::Experimental::half_t>::value ? 4 : 1e3;
eps *= std::is_same<value_type, Kokkos::Experimental::half_t>::value ||
std::is_same<value_type, Kokkos::Experimental::bhalf_t>::value
? 4
: 1e3;

for (int k = 0; k < N; ++k)
for (int i = 0; i < matCdim1; ++i)
Expand Down

0 comments on commit f4c1c66

Please sign in to comment.