xtensor-stack / xtensor

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

Is xtensor 32bit safe? #1561

Open emmenlau opened 5 years ago

emmenlau commented 5 years ago

I currently fail to build xtensor on Ubuntu 18.04 i686 Docker image. The same build works on a comparably setup x86_64 Docker image for Ubuntu 18.04, 16.04, and CentOS 7. Since all 64bit builds work so I assume the issues come from 32bit portability problems. Is that possible? The build fails already very early on, here is the error message:

[...]
[4/65] Building CXX object test/CMakeFiles/test_xtensor_lib.dir/test_xaccumulator.cpp.o
FAILED: test/CMakeFiles/test_xtensor_lib.dir/test_xaccumulator.cpp.o 
/usr/bin/c++  -DXTENSOR_USE_XSIMD -I/data/Release/xtensor-0.20.4/include -isystem /target/Release/include -O2 -m32 -march=nehalem -mtune=haswell  -DNDEBUG -march=native -Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion -Wold-style-cast -Wunused-variable -O3 -DNDEBUG -fPIE   -std=c++14 -MD -MT test/CMakeFiles/test_xtensor_lib.dir/test_xaccumulator.cpp.o -MF test/CMakeFiles/test_xtensor_lib.dir/test_xaccumulator.cpp.o.d -o test/CMakeFiles/test_xtensor_lib.dir/test_xaccumulator.cpp.o -c /data/Release/xtensor-0.20.4/test/test_xaccumulator.cpp
In file included from /data/Release/xtensor-0.20.4/include/xtensor/xsemantic.hpp:15:0,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xstrided_view.hpp:24,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xoperation.hpp:21,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xmath.hpp:26,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xcontainer.hpp:23,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xarray.hpp:19,
                 from /data/Release/xtensor-0.20.4/test/test_xaccumulator.cpp:11:
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp: In instantiation of 'static void xt::linear_assigner<simd_assign>::run(E1&, const E2&) [with E1 = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; E2 = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; bool simd_assign = true]':
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:310:46:   required from 'static void xt::xexpression_assigner_base<xt::xtensor_expression_tag>::assign_data(xt::xexpression<E>&, const xt::xexpression<E2>&, bool) [with E1 = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; E2 = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>]'
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:328:31:   required from 'static void xt::xexpression_assigner<Tag>::assign_xexpression(E1&, const E2&) [with E1 = xt::xexpression<xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag> >; E2 = xt::xexpression<xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag> >; Tag = xt::xtensor_expression_tag]'
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:201:58:   required from 'xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&)::<lambda(auto:63)> [with auto:63 = xtl::identity; E1 = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; E2 = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>]'
/target/Release/include/xtl/xmeta_utils.hpp:538:22:   required from 'decltype(auto) xtl::mpl::static_if(std::false_type, const TF&, const FF&) [with TF = xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&) [with E1 = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; E2 = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>]::<lambda(auto:62)>; FF = xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&) [with E1 = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; E2 = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>]::<lambda(auto:63)>; std::false_type = std::integral_constant<bool, false>]'
/target/Release/include/xtl/xmeta_utils.hpp:544:29:   required from 'decltype(auto) xtl::mpl::static_if(const TF&, const FF&) [with bool cond = false; TF = xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&) [with E1 = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; E2 = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>]::<lambda(auto:62)>; FF = xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&) [with E1 = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; E2 = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>]::<lambda(auto:63)>]'
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:195:58:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/data/Release/xtensor-0.20.4/include/xtensor/xsemantic.hpp:453:57:   required from 'xt::xsemantic_base<D>::derived_type& xt::xsemantic_base<D>::assign(const xt::xexpression<E1>&) [with E = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; D = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; xt::xsemantic_base<D>::derived_type = xt::xarray_container<xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>]'
/data/Release/xtensor-0.20.4/include/xtensor/xarray.hpp:480:30:   required from 'xt::xarray_container<EC, L, SC, Tag>::xarray_container(const xt::xexpression<E1>&) [with E = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>; EC = xt::uvector<long long int, xsimd::aligned_allocator<long long int, 32u> >; xt::layout_type L = (xt::layout_type)1; SC = xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>; Tag = xt::xtensor_expression_tag]'
/data/Release/xtensor-0.20.4/include/xtensor/xaccumulator.hpp:198:34:   required from 'auto xt::detail::accumulator_impl(F&&, E&&, std::size_t, xt::evaluation_strategy::immediate_type) [with F = xt::xaccumulator_functor<std::multiplies<long long int>, xtl::identity>; E = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>&; std::size_t = unsigned int]'
/data/Release/xtensor-0.20.4/include/xtensor/xaccumulator.hpp:308:40:   required from 'auto xt::accumulate(F&&, E&&, std::ptrdiff_t, EVS) [with F = xt::xaccumulator_functor<std::multiplies<long long int>, xtl::identity>; E = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>&; EVS = xt::evaluation_strategy::immediate_type; std::ptrdiff_t = int]'
/data/Release/xtensor-0.20.4/include/xtensor/xmath.hpp:2069:26:   required from 'auto xt::cumprod(E&&, std::ptrdiff_t) [with E = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>&; std::ptrdiff_t = int]'
/data/Release/xtensor-0.20.4/test/test_xaccumulator.cpp:191:38:   required from here
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:539:13: error: no matching function for call to 'xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>::load_simd(size_type&) const'
             e1.template store_simd<lhs_align_mode>(i, e2.template load_simd<rhs_align_mode, value_type>(i));
             ^
In file included from /data/Release/xtensor-0.20.4/include/xtensor/xarray.hpp:19:0,
                 from /data/Release/xtensor-0.20.4/test/test_xaccumulator.cpp:11:
/data/Release/xtensor-0.20.4/include/xtensor/xcontainer.hpp:181:42: note: candidate: template<class align, class requested_type, unsigned int N> xt::xcontainer<D>::simd_return_type<requested_type> xt::xcontainer<D>::load_simd(xt::xcontainer<D>::size_type) const [with align = alignment; requested_type = requested_type; unsigned int N = N; D = xt::xarray_container<xt::uvector<long int, xsimd::aligned_allocator<long int, 32u> >, (xt::layout_type)1, xt::svector<unsigned int, 4u, std::allocator<unsigned int>, true>, xt::xtensor_expression_tag>]
         simd_return_type<requested_type> load_simd(size_type i) const;
                                          ^
/data/Release/xtensor-0.20.4/include/xtensor/xcontainer.hpp:181:42: note:   template argument deduction/substitution failed:
In file included from /data/Release/xtensor-0.20.4/include/xtensor/xsemantic.hpp:15:0,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xstrided_view.hpp:24,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xoperation.hpp:21,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xmath.hpp:26,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xcontainer.hpp:23,
                 from /data/Release/xtensor-0.20.4/include/xtensor/xarray.hpp:19,
                 from /data/Release/xtensor-0.20.4/test/test_xaccumulator.cpp:11:
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp: In instantiation of 'static void xt::linear_assigner<simd_assign>::run(E1&, const E2&) [with E1 = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; E2 = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; bool simd_assign = true]':
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:310:46:   required from 'static void xt::xexpression_assigner_base<xt::xtensor_expression_tag>::assign_data(xt::xexpression<E>&, const xt::xexpression<E2>&, bool) [with E1 = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; E2 = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>]'
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:328:31:   required from 'static void xt::xexpression_assigner<Tag>::assign_xexpression(E1&, const E2&) [with E1 = xt::xexpression<xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag> >; E2 = xt::xexpression<xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag> >; Tag = xt::xtensor_expression_tag]'
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:201:58:   required from 'xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&)::<lambda(auto:63)> [with auto:63 = xtl::identity; E1 = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; E2 = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>]'
/target/Release/include/xtl/xmeta_utils.hpp:538:22:   required from 'decltype(auto) xtl::mpl::static_if(std::false_type, const TF&, const FF&) [with TF = xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&) [with E1 = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; E2 = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>]::<lambda(auto:62)>; FF = xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&) [with E1 = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; E2 = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>]::<lambda(auto:63)>; std::false_type = std::integral_constant<bool, false>]'
/target/Release/include/xtl/xmeta_utils.hpp:544:29:   required from 'decltype(auto) xtl::mpl::static_if(const TF&, const FF&) [with bool cond = false; TF = xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&) [with E1 = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; E2 = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>]::<lambda(auto:62)>; FF = xt::assign_xexpression(xt::xexpression<E>&, const xt::xexpression<E2>&) [with E1 = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; E2 = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>]::<lambda(auto:63)>]'
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:195:58:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/data/Release/xtensor-0.20.4/include/xtensor/xsemantic.hpp:453:57:   required from 'xt::xsemantic_base<D>::derived_type& xt::xsemantic_base<D>::assign(const xt::xexpression<E1>&) [with E = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; D = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; xt::xsemantic_base<D>::derived_type = xt::xfixed_container<long long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>]'
/data/Release/xtensor-0.20.4/include/xtensor/xfixed.hpp:614:30:   required from 'xt::xfixed_container<ET, S, L, Tag>::xfixed_container(const xt::xexpression<E1>&) [with E = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>; ET = long long int; S = xt::fixed_shape<4u, 3u>; xt::layout_type L = (xt::layout_type)1; Tag = xt::xtensor_expression_tag]'
/data/Release/xtensor-0.20.4/include/xtensor/xaccumulator.hpp:198:34:   required from 'auto xt::detail::accumulator_impl(F&&, E&&, std::size_t, xt::evaluation_strategy::immediate_type) [with F = xt::xaccumulator_functor<std::multiplies<long long int>, xtl::identity>; E = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>&; std::size_t = unsigned int]'
/data/Release/xtensor-0.20.4/include/xtensor/xaccumulator.hpp:308:40:   required from 'auto xt::accumulate(F&&, E&&, std::ptrdiff_t, EVS) [with F = xt::xaccumulator_functor<std::multiplies<long long int>, xtl::identity>; E = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>&; EVS = xt::evaluation_strategy::immediate_type; std::ptrdiff_t = int]'
/data/Release/xtensor-0.20.4/include/xtensor/xmath.hpp:2069:26:   required from 'auto xt::cumprod(E&&, std::ptrdiff_t) [with E = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>&; std::ptrdiff_t = int]'
/data/Release/xtensor-0.20.4/test/test_xaccumulator.cpp:217:38:   required from here
/data/Release/xtensor-0.20.4/include/xtensor/xassign.hpp:539:13: error: no matching function for call to 'xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>::load_simd(size_type&) const'
             e1.template store_simd<lhs_align_mode>(i, e2.template load_simd<rhs_align_mode, value_type>(i));
             ^
In file included from /data/Release/xtensor-0.20.4/include/xtensor/xarray.hpp:19:0,
                 from /data/Release/xtensor-0.20.4/test/test_xaccumulator.cpp:11:
/data/Release/xtensor-0.20.4/include/xtensor/xcontainer.hpp:181:42: note: candidate: template<class align, class requested_type, unsigned int N> xt::xcontainer<D>::simd_return_type<requested_type> xt::xcontainer<D>::load_simd(xt::xcontainer<D>::size_type) const [with align = alignment; requested_type = requested_type; unsigned int N = N; D = xt::xfixed_container<long int, xt::fixed_shape<4u, 3u>, (xt::layout_type)1, xt::xtensor_expression_tag>]
         simd_return_type<requested_type> load_simd(size_type i) const;
                                          ^
/data/Release/xtensor-0.20.4/include/xtensor/xcontainer.hpp:181:42: note:   template argument deduction/substitution failed:
JohanMabille commented 5 years ago

It should build fine on 32bits architecture, although we don't have specific tests for it. That's definitely a bug we need to fix.