xtensor-stack / xtensor

C++ tensors with broadcasting and lazy computing
BSD 3-Clause "New" or "Revised" License
3.37k stars 399 forks source link

Enabling xsimd in xtensor build errors in xt::ceil #1678

Open vakokako opened 5 years ago

vakokako commented 5 years ago

When XTENSOR_USE_XSIMD is enabled, this code snippet fails to compile:

xt::xtensor<double, 1> tensor({1.5, 2.5, 3.5, 4.5, 5.5});
xt::xtensor<double, 1> ceiled = xt::ceil(tensor);

The compile error happens when assigning the result to ceiled. The call xt::ceil(tensor) compiles just fine.

vakokako commented 5 years ago

error message:

xtensor/xfunction.hpp:749:56: error: could not convert '((const xt::xfunction<xt::math::ceil_fun, xt::xfunction<xt::detail::divides, xt::xfunction<xt::detail::multiplies, xt::xscalar<int>, xt::xtensor_adaptor<const std::array<long unsigned int, 3>&, 1, (xt::layout_type)1, xt::xtensor_expression_tag> >, xt::xscalar<int> > >*)this)->xt::xfunction<xt::math::ceil_fun, xt::xfunction<xt::detail::divides, xt::xfunction<xt::detail::multiplies, xt::xscalar<int>, xt::xtensor_adaptor<const std::array<long unsigned int, 3>&, 1, (xt::layout_type)1, xt::xtensor_expression_tag> >, xt::xscalar<int> > >::load_simd_impl<xt::inner_aligned_mode, double, 2, 0>((std::make_index_sequence<1>(), std::make_index_sequence<1>()), i)' from 'void' to 'xt::xfunction<xt::math::ceil_fun, xt::xfunction<xt::detail::divides, xt::xfunction<xt::detail::multiplies, xt::xscalar<int>, xt::xtensor_adaptor<const std::array<long unsigned int, 3>&, 1, (xt::layout_type)1, xt::xtensor_expression_tag> >, xt::xscalar<int> > >::simd_return_type<double> {aka xsimd::batch<double, 2>}'
         return load_simd_impl<align, requested_type, N>(std::make_index_sequence<sizeof...(CT)>(), i);
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wolfv commented 5 years ago

Your error says you are calling ceil on a integer expression. That might indeed not work since we might not have implemented the corresponding noop functions in xsimd.

vakokako commented 5 years ago

True, it was called on size_t. Then not a bug, just a feature request)