fix arm build warnings

This commit is contained in:
Charles Schlosser 2023-07-17 20:37:27 +00:00 committed by Antonio Sánchez
parent 81fe2d424f
commit 6e7abeae69
4 changed files with 23 additions and 23 deletions

View File

@ -87,21 +87,21 @@ void special_value_pairs(Array<Scalar, Dynamic, Dynamic>& x,
template <typename Scalar, typename Fn, typename RefFn> template <typename Scalar, typename Fn, typename RefFn>
void binary_op_test(std::string name, Fn fun, RefFn ref) { void binary_op_test(std::string name, Fn fun, RefFn ref) {
const Scalar tol = test_precision<Scalar>(); const Scalar tol = test_precision<Scalar>();
Array<Scalar, Dynamic, Dynamic> x; Array<Scalar, Dynamic, Dynamic> lhs;
Array<Scalar, Dynamic, Dynamic> y; Array<Scalar, Dynamic, Dynamic> rhs;
special_value_pairs(x, y); special_value_pairs(lhs, rhs);
Array<Scalar, Dynamic, Dynamic> actual = fun(x, y); Array<Scalar, Dynamic, Dynamic> actual = fun(lhs, rhs);
bool all_pass = true; bool all_pass = true;
for (Index i = 0; i < x.rows(); ++i) { for (Index i = 0; i < lhs.rows(); ++i) {
for (Index j = 0; j < x.cols(); ++j) { for (Index j = 0; j < lhs.cols(); ++j) {
Scalar e = static_cast<Scalar>(ref(x(i,j), y(i,j))); Scalar e = static_cast<Scalar>(ref(lhs(i,j), rhs(i,j)));
Scalar a = actual(i, j); Scalar a = actual(i, j);
bool success = (a==e) || ((numext::isfinite)(e) && internal::isApprox(a, e, tol)) || ((numext::isnan)(a) && (numext::isnan)(e)); bool success = (a==e) || ((numext::isfinite)(e) && internal::isApprox(a, e, tol)) || ((numext::isnan)(a) && (numext::isnan)(e));
if ((a == a) && (e == e)) success &= (bool)numext::signbit(e) == (bool)numext::signbit(a); if ((a == a) && (e == e)) success &= (bool)numext::signbit(e) == (bool)numext::signbit(a);
all_pass &= success; all_pass &= success;
if (!success) { if (!success) {
std::cout << name << "(" << x(i,j) << "," << y(i,j) << ") = " << a << " != " << e << std::endl; std::cout << name << "(" << lhs(i,j) << "," << rhs(i,j) << ") = " << a << " != " << e << std::endl;
} }
} }
} }
@ -139,27 +139,27 @@ template <typename Scalar, typename Fn, typename RefFn>
void unary_op_test(std::string name, Fn fun, RefFn ref) { void unary_op_test(std::string name, Fn fun, RefFn ref) {
const Scalar tol = test_precision<Scalar>(); const Scalar tol = test_precision<Scalar>();
auto values = special_values<Scalar>(); auto values = special_values<Scalar>();
Map<Array<Scalar, Dynamic, 1>> x(values.data(), values.size()); Map<Array<Scalar, Dynamic, 1>> valuesMap(values.data(), values.size());
Array<Scalar, Dynamic, Dynamic> actual = fun(x); Array<Scalar, Dynamic, Dynamic> actual = fun(valuesMap);
bool all_pass = true; bool all_pass = true;
for (Index i = 0; i < x.size(); ++i) { for (Index i = 0; i < valuesMap.size(); ++i) {
Scalar e = static_cast<Scalar>(ref(x(i))); Scalar e = static_cast<Scalar>(ref(valuesMap(i)));
Scalar a = actual(i); Scalar a = actual(i);
bool success = (a == e) || ((numext::isfinite)(e) && internal::isApprox(a, e, tol)) || bool success = (a == e) || ((numext::isfinite)(e) && internal::isApprox(a, e, tol)) ||
((numext::isnan)(a) && (numext::isnan)(e)); ((numext::isnan)(a) && (numext::isnan)(e));
if ((a == a) && (e == e)) success &= (bool)numext::signbit(e) == (bool)numext::signbit(a); if ((a == a) && (e == e)) success &= (bool)numext::signbit(e) == (bool)numext::signbit(a);
all_pass &= success; all_pass &= success;
if (!success) { if (!success) {
std::cout << name << "(" << x(i) << ") = " << a << " != " << e << std::endl; std::cout << name << "(" << valuesMap(i) << ") = " << a << " != " << e << std::endl;
} }
} }
VERIFY(all_pass); VERIFY(all_pass);
} }
#define UNARY_FUNCTOR_TEST_ARGS(fun) #fun, \ #define UNARY_FUNCTOR_TEST_ARGS(fun) #fun, \
[](const auto& x) { return (Eigen::fun)(x); }, \ [](const auto& x_) { return (Eigen::fun)(x_); }, \
[](const auto& x) { return (std::fun)(x); } [](const auto& y_) { return (std::fun)(y_); }
template <typename Scalar> template <typename Scalar>
void unary_ops_test() { void unary_ops_test() {

View File

@ -286,9 +286,9 @@ struct check_signbit_impl {
return all_pass; return all_pass;
}; };
bool all_pass = check_all(non_negative_values, false_mask); bool check_all_pass = check_all(non_negative_values, false_mask);
all_pass = all_pass && check_all(negative_values, (NumTraits<T>::IsSigned ? true_mask : false_mask)); check_all_pass = check_all_pass && check_all(negative_values, (NumTraits<T>::IsSigned ? true_mask : false_mask));
VERIFY(all_pass); VERIFY(check_all_pass);
} }
}; };
template <typename T> template <typename T>

View File

@ -91,8 +91,8 @@ struct TensorContractionBlockMemAllocator {
eigen_assert(rhs_block); eigen_assert(rhs_block);
BlockSizes sz = ComputeLhsRhsBlockSizes(bm, bk, bn); BlockSizes sz = ComputeLhsRhsBlockSizes(bm, bk, bn);
char* block_mem = static_cast<char*>(d.allocate(sz.lhs_size + sz.rhs_size)); char* block_mem = static_cast<char*>(d.allocate(sz.lhs_size + sz.rhs_size));
*lhs_block = reinterpret_cast<LhsScalar*>(block_mem); *lhs_block = static_cast<LhsScalar*>(static_cast<void*>(block_mem));
*rhs_block = reinterpret_cast<RhsScalar*>(block_mem + sz.lhs_size); *rhs_block = static_cast<RhsScalar*>(static_cast<void*>(block_mem + sz.lhs_size));
return block_mem; return block_mem;
} }
@ -115,12 +115,12 @@ struct TensorContractionBlockMemAllocator {
for (Index x = 0; x < num_slices; x++) { for (Index x = 0; x < num_slices; x++) {
if (num_lhs > 0) lhs_blocks[x].resize(num_lhs); if (num_lhs > 0) lhs_blocks[x].resize(num_lhs);
for (Index m = 0; m < num_lhs; m++) { for (Index m = 0; m < num_lhs; m++) {
lhs_blocks[x][m] = reinterpret_cast<LhsScalar*>(mem); lhs_blocks[x][m] = static_cast<LhsScalar*>(static_cast<void*>(mem));
mem += sz.lhs_size; mem += sz.lhs_size;
} }
if (num_rhs > 0) rhs_blocks[x].resize(num_rhs); if (num_rhs > 0) rhs_blocks[x].resize(num_rhs);
for (Index n = 0; n < num_rhs; n++) { for (Index n = 0; n < num_rhs; n++) {
rhs_blocks[x][n] = reinterpret_cast<RhsScalar*>(mem); rhs_blocks[x][n] = static_cast<RhsScalar*>(static_cast<void*>(mem));
mem += sz.rhs_size; mem += sz.rhs_size;
} }
} }

View File

@ -423,7 +423,7 @@ struct sizes_match_below_dim {
template <typename Dims1, typename Dims2, ptrdiff_t n> template <typename Dims1, typename Dims2, ptrdiff_t n>
struct sizes_match_below_dim<Dims1, Dims2, n, n> { struct sizes_match_below_dim<Dims1, Dims2, n, n> {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool run(Dims1& dims1, Dims2& dims2) { static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool run(Dims1& dims1, Dims2& dims2) {
return (array_get<n-1>(dims1) == array_get<n-1>(dims2)) && return numext::equal_strict(array_get<n - 1>(dims1), array_get<n - 1>(dims2)) &&
sizes_match_below_dim<Dims1, Dims2, n-1, n-1>::run(dims1, dims2); sizes_match_below_dim<Dims1, Dims2, n-1, n-1>::run(dims1, dims2);
} }
}; };