Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing bit-wise (zero-copy) serialization #2511

Merged
merged 1 commit into from Feb 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions hpx/compute/serialization/vector.hpp
Expand Up @@ -82,7 +82,9 @@ namespace hpx { namespace serialization
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<
typename compute::vector<T, Allocator>::value_type
typename std::remove_const<
typename compute::vector<T, Allocator>::value_type
>::type
>::value> use_optimized;

v.clear();
Expand Down Expand Up @@ -129,7 +131,9 @@ namespace hpx { namespace serialization
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<
typename compute::vector<T, Allocator>::value_type
typename std::remove_const<
typename compute::vector<T, Allocator>::value_type
>::type
>::value> use_optimized;

ar << v.size(); //-V128
Expand Down
4 changes: 3 additions & 1 deletion hpx/runtime/serialization/array.hpp
Expand Up @@ -66,7 +66,9 @@ namespace hpx { namespace serialization
void serialize(Archive& ar, unsigned int v)
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<T>::value> use_optimized;
hpx::traits::is_bitwise_serializable<
typename std::remove_const<T>::type
>::value> use_optimized;

#ifdef BOOST_BIG_ENDIAN
bool archive_endianess_differs = ar.endian_little();
Expand Down
3 changes: 2 additions & 1 deletion hpx/runtime/serialization/complex.hpp
Expand Up @@ -10,6 +10,7 @@
#include <hpx/traits/is_bitwise_serializable.hpp>

#include <complex>
#include <type_traits>

namespace hpx { namespace serialization
{
Expand All @@ -33,7 +34,7 @@ namespace hpx { namespace traits
{
template <typename T>
struct is_bitwise_serializable<std::complex<T> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};
}}

Expand Down
3 changes: 2 additions & 1 deletion hpx/runtime/serialization/detail/boost_simd.hpp
Expand Up @@ -14,6 +14,7 @@
#include <hpx/traits/is_bitwise_serializable.hpp>

#include <cstddef>
#include <type_traits>

#include <boost/simd.hpp>

Expand All @@ -39,7 +40,7 @@ namespace hpx { namespace traits
{
template <typename T, std::size_t N, typename Abi>
struct is_bitwise_serializable<boost::simd::pack<T, N, Abi> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};
}}

Expand Down
3 changes: 2 additions & 1 deletion hpx/runtime/serialization/detail/libflatarray.hpp
Expand Up @@ -15,6 +15,7 @@

#include <array>
#include <cstddef>
#include <type_traits>

#include <libflatarray/flat_array.hpp>

Expand Down Expand Up @@ -45,7 +46,7 @@ namespace hpx { namespace traits
{
template <typename T, std::size_t N>
struct is_bitwise_serializable<LibFlatArray::short_vec<T, N> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};
}}
#endif
Expand Down
7 changes: 4 additions & 3 deletions hpx/runtime/serialization/detail/vc.hpp
Expand Up @@ -14,6 +14,7 @@
#include <hpx/traits/is_bitwise_serializable.hpp>

#include <cstddef>
#include <type_traits>

#include <Vc/Vc>

Expand Down Expand Up @@ -91,17 +92,17 @@ namespace hpx { namespace traits
{
template <typename T, typename Abi>
struct is_bitwise_serializable<Vc::Vector<T, Abi> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};

template <typename T>
struct is_bitwise_serializable<Vc::Scalar::Vector<T> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};

template <typename T, std::size_t N, typename V, std::size_t W>
struct is_bitwise_serializable<Vc::SimdArray<T, N, V, W> >
: is_bitwise_serializable<T>
: is_bitwise_serializable<typename std::remove_const<T>::type>
{};
}}

Expand Down
4 changes: 2 additions & 2 deletions hpx/runtime/serialization/map.hpp
Expand Up @@ -23,8 +23,8 @@ namespace hpx
struct is_bitwise_serializable<std::pair<Key, Value> >
: std::integral_constant<
bool,
is_bitwise_serializable<Key>::value
&& is_bitwise_serializable<Value>::value
is_bitwise_serializable<typename std::remove_const<Key>::type>::value
&& is_bitwise_serializable<typename std::remove_const<Value>::type>::value
>
{};
}
Expand Down
8 changes: 6 additions & 2 deletions hpx/runtime/serialization/vector.hpp
Expand Up @@ -83,7 +83,9 @@ namespace hpx { namespace serialization
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<
typename std::vector<T, Allocator>::value_type
typename std::remove_const<
typename std::vector<T, Allocator>::value_type
>::type
>::value> use_optimized;

v.clear();
Expand Down Expand Up @@ -142,7 +144,9 @@ namespace hpx { namespace serialization
{
typedef std::integral_constant<bool,
hpx::traits::is_bitwise_serializable<
typename std::vector<T, Allocator>::value_type
typename std::remove_const<
typename std::vector<T, Allocator>::value_type
>::type
>::value> use_optimized;

ar << v.size(); //-V128
Expand Down
4 changes: 3 additions & 1 deletion hpx/util/tuple.hpp
Expand Up @@ -1012,7 +1012,9 @@ namespace hpx { namespace traits
struct is_bitwise_serializable<
::hpx::util::detail::tuple_impl<Is, Ts...>
> : ::hpx::util::detail::all_of<
hpx::traits::is_bitwise_serializable<Ts>...
hpx::traits::is_bitwise_serializable<
typename std::remove_const<Ts>::type
>...
>
{};
}}
Expand Down
1 change: 0 additions & 1 deletion src/runtime/naming/address.cpp
Expand Up @@ -8,7 +8,6 @@
#include <hpx/throw_exception.hpp>
#include <hpx/runtime/components/component_type.hpp>
#include <hpx/runtime/serialization/serialize.hpp>
#include <hpx/traits/is_bitwise_serializable.hpp>

#include <boost/io/ios_state.hpp>

Expand Down