diff --git a/include/eve/detail/compress/compress.hpp b/include/eve/detail/compress/compress.hpp deleted file mode 100644 index 7dd86fd11a..0000000000 --- a/include/eve/detail/compress/compress.hpp +++ /dev/null @@ -1,45 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -// compress -// -// A working horse for compress_store. -// -// Inputs: an ignore, a wide and a mask. -// -// Splits the input wide into parts that we can efficiently compute. -// compresses the individual parts (everything marked as true is moved to the left). -// returns a tuple of results for individual chunks. -// A result for individual chunk is again - a tuple [ compressed_value, number of elements ] - -namespace eve -{ - EVE_REGISTER_CALLABLE(compress_) - EVE_DECLARE_CALLABLE(compress_, compress) - - namespace detail - { - EVE_ALIAS_CALLABLE(compress_, compress); - } - - EVE_CALLABLE_API(compress_, compress) -} - -#include - -#if defined(EVE_INCLUDE_X86_HEADER) -# include -#endif - -#if defined(EVE_INCLUDE_SVE_HEADER) -# include -#endif diff --git a/include/eve/detail/compress/simd/common/compress.hpp b/include/eve/detail/compress/simd/common/compress.hpp deleted file mode 100644 index cebe551ce3..0000000000 --- a/include/eve/detail/compress/simd/common/compress.hpp +++ /dev/null @@ -1,20 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include - -namespace eve::detail -{ - template - EVE_FORCEINLINE - auto compress_(EVE_SUPPORTS(cpu_), C c, wide v, logical> mask) noexcept - { - return compress_using_masks[c](v, mask); - } -} diff --git a/include/eve/detail/compress/simd/x86/compress.hpp b/include/eve/detail/compress/simd/x86/compress.hpp deleted file mode 100644 index 885fdbabf8..0000000000 --- a/include/eve/detail/compress/simd/x86/compress.hpp +++ /dev/null @@ -1,35 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -namespace eve::detail -{ - template - EVE_FORCEINLINE - auto compress_(EVE_SUPPORTS(sse2_), C c, wide v, logical> mask) noexcept - requires (current_api < ssse3) - { - return compress_using_switch[c](v, mask); - } - - template - EVE_FORCEINLINE - auto compress_(EVE_SUPPORTS(avx2_), C c, wide v, logical> mask) noexcept - requires (N() >= 4 && supports_bmi_well) - { - if constexpr ( C::is_complete && !C::is_inverted ) - { - kumi::tuple cur{ v, (std::ptrdiff_t) 0 }; - return kumi::tuple { cur }; - } - else return compress_using_bmi(v, top_bits{mask, c}); - } -} diff --git a/include/eve/detail/function/compress_store_impl.hpp b/include/eve/detail/function/compress_store_impl.hpp deleted file mode 100644 index 49ab7b0f61..0000000000 --- a/include/eve/detail/function/compress_store_impl.hpp +++ /dev/null @@ -1,35 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -// compress_store_impl -// Writes all compressed values to the provided pointer -// Unlike a real compress store, offset of ignore won't move values. -// -// Example: -// [a b c d], [true, true, true, true], ignore_first(1) -// compress_store : [ _ b c d] -// compress_store_impl: [b c d _ ] - -namespace eve -{ - EVE_REGISTER_CALLABLE(compress_store_impl_) - EVE_DECLARE_CALLABLE(compress_store_impl_, compress_store_impl) - - namespace detail - { - EVE_ALIAS_CALLABLE(compress_store_impl_, compress_store_impl); - } - - EVE_CALLABLE_API(compress_store_impl_, compress_store_impl) -} - -#include diff --git a/include/eve/detail/function/simd/common/compress_store_impl.hpp b/include/eve/detail/function/simd/common/compress_store_impl.hpp deleted file mode 100644 index f2ad2f84b8..0000000000 --- a/include/eve/detail/function/simd/common/compress_store_impl.hpp +++ /dev/null @@ -1,69 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ - template> Ptr> - EVE_FORCEINLINE - unaligned_t compress_store_impl_(EVE_SUPPORTS(cpu_), - C c, - wide v, - logical> mask, - Ptr ptr) noexcept - { - if constexpr ( has_emulated_abi_v> ) - { - auto offset = c.offset(as(v)); - auto count = c.count(as(v)); - auto* ptr_ = unalign(ptr); - - for (int idx = offset; idx != (int)(offset + count); ++idx) { - if (mask.get(idx)) *ptr_++ = v.get(idx); - } - - return ptr_; - } - else - { - auto parts = compress[c](v, mask); - - auto uptr = unalign(ptr); - - kumi::for_each([&](auto part_count) mutable { - auto [part, count] = part_count; - eve::store(part, uptr); - uptr += count; - }, parts); - - return uptr; - } - } - - template> Ptr> - EVE_FORCEINLINE - unaligned_t compress_store_impl_(EVE_SUPPORTS(cpu_), - wide v, - logical> mask, - Ptr ptr) noexcept - { - return compress_store_impl(ignore_none, v, mask, ptr); - } -} diff --git a/include/eve/module/algo/algo/fill.hpp b/include/eve/module/algo/algo/fill.hpp index cdf78c4b52..3f7b6e3c8b 100644 --- a/include/eve/module/algo/algo/fill.hpp +++ b/include/eve/module/algo/algo/fill.hpp @@ -18,7 +18,7 @@ namespace eve::algo { //================================================================================================ - //! @addtogroup algorithms + //! @addtogroup algos //! @{ //! @var fill //! @brief a version of `std::fill` diff --git a/include/eve/module/algo/algo/for_each.hpp b/include/eve/module/algo/algo/for_each.hpp index 2a61a00e3a..8d0911912d 100644 --- a/include/eve/module/algo/algo/for_each.hpp +++ b/include/eve/module/algo/algo/for_each.hpp @@ -17,7 +17,7 @@ namespace eve::algo { //================================================================================================ - //! @addtogroup algorithms + //! @addtogroup algos //! @{ //! @var for_each //! @brief a basic for_each algorithm. diff --git a/include/eve/module/algo/algo/iota.hpp b/include/eve/module/algo/algo/iota.hpp index 181c142041..53ef0f4708 100644 --- a/include/eve/module/algo/algo/iota.hpp +++ b/include/eve/module/algo/algo/iota.hpp @@ -14,7 +14,7 @@ namespace eve::algo { //================================================================================================ - //! @addtogroup algorithms + //! @addtogroup algos //! @{ //! @var iota //! diff --git a/include/eve/module/algo/algo/remove.hpp b/include/eve/module/algo/algo/remove.hpp index 982cd815a4..1dd1abd4a4 100644 --- a/include/eve/module/algo/algo/remove.hpp +++ b/include/eve/module/algo/algo/remove.hpp @@ -62,6 +62,22 @@ namespace eve::algo } }; + //================================================================================================ + //! @addtogroup algos + //! @{ + //! @var remove_if + //! @brief SIMD version of std::remove_if + //! + //! **Defined in Header** + //! + //! @code + //! #include + //! @endcode + //! + //! TODO: docs + //! + //! @} + //================================================================================================ inline constexpr auto remove_if = function_with_traits[no_traits]; template @@ -74,5 +90,21 @@ namespace eve::algo } }; + //================================================================================================ + //! @addtogroup algos + //! @{ + //! @var remove + //! @brief SIMD version of std::remove + //! + //! **Defined in Header** + //! + //! @code + //! #include + //! @endcode + //! + //! TODO: docs + //! + //! @} + //================================================================================================ inline constexpr auto remove = function_with_traits[no_traits]; } diff --git a/include/eve/module/algo/algo/reverse.hpp b/include/eve/module/algo/algo/reverse.hpp index 326a39bb95..3d95556485 100644 --- a/include/eve/module/algo/algo/reverse.hpp +++ b/include/eve/module/algo/algo/reverse.hpp @@ -17,7 +17,7 @@ namespace eve::algo { //================================================================================================ - //! @addtogroup algorithms + //! @addtogroup algos //! @{ //! @var reverse //! @@ -75,7 +75,7 @@ namespace eve::algo inline constexpr auto reverse = function_with_traits[no_unrolling][no_aligning]; //================================================================================================ - //! @addtogroup algorithms + //! @addtogroup algos //! @{ //! @var reverse_copy //! diff --git a/include/eve/module/algo/algo/swap_ranges.hpp b/include/eve/module/algo/algo/swap_ranges.hpp index 915275c3ca..494de68d32 100644 --- a/include/eve/module/algo/algo/swap_ranges.hpp +++ b/include/eve/module/algo/algo/swap_ranges.hpp @@ -15,7 +15,7 @@ namespace eve::algo { //================================================================================================ - //! @addtogroup algorithms + //! @addtogroup algos //! @{ //! @var swap_ranges //! diff --git a/include/eve/module/algo/algo/transform.hpp b/include/eve/module/algo/algo/transform.hpp index 0803a2f3f6..c73f18803e 100644 --- a/include/eve/module/algo/algo/transform.hpp +++ b/include/eve/module/algo/algo/transform.hpp @@ -43,7 +43,7 @@ namespace eve::algo } //================================================================================================ - //! @addtogroup algorithms + //! @addtogroup algos //! @{ //! @var transform_inplace //! @@ -72,7 +72,7 @@ namespace eve::algo inline constexpr auto transform_inplace = function_with_traits[default_simple_algo_traits]; //================================================================================================ - //! @addtogroup algorithms + //! @addtogroup algos //! @{ //! @var transform_to //! diff --git a/include/eve/module/core.hpp b/include/eve/module/core.hpp index 4f981af7d4..dbad463618 100644 --- a/include/eve/module/core.hpp +++ b/include/eve/module/core.hpp @@ -93,9 +93,16 @@ //! @ingroup core //! Functions that are just shuffles with a different api. //! +//! @defgroup core_comporess Compress functions +//! @ingroup core +//! Functions that in different way expose `compressing` selected elements +//! together to beginning. This is at the core of `remove_if`, `copy_if` etc. +//! Alternative search keywords: filter, remove, pack +//! //! @} //================================================================================================== +#include #include #include #include diff --git a/include/eve/module/core/compress/compress.hpp b/include/eve/module/core/compress/compress.hpp new file mode 100644 index 0000000000..6d1165eeb1 --- /dev/null +++ b/include/eve/module/core/compress/compress.hpp @@ -0,0 +1,98 @@ +//================================================================================================== +/* + EVE - Expressive Vector Engine + Copyright : EVE Project Contributors + SPDX-License-Identifier: BSL-1.0 +*/ +//================================================================================================== +#pragma once + +#include +#include + +namespace eve +{ + //================================================================================================ + //! @addtogroup core_compress + //! @{ + //! @var compress + //! @brief A low level function to compress one simd value based on a mask. + //! + //! **Defined in Header** + //! + //! @code + //! #include + //! @endcode + //! + //! @note this is very low level function, most likely you are looking for + //! `eve::compress_copy` or `eve::compress_store`. + //! + //! @note FIX-1647: `eve::compress` doesn't support `wide` yet. + //! + //! @note the mask type can be any logical with the same cardinal. + //! + //! Compression in simd is moving selected elements to the front of the simd_value. + //! Unfortunately, not for all `simd_value`, not for all plaftorms that can be done + //! efficiently. So the operation splits the input into chunks for which it's possible. + //! + //! The function pefroms the following steps: + //! 1) splits the simd_value and mask into chunks, that can be processed in one go. + //! This depends on what instructions are availiable. + //! 2) Each chunk, gets shuffled in a way that moves selected elements (mask == true) to + //! the front. The tail of the resulting value is unspecified. + //! [a, b, c, d], (false, true, false, true) -> [b, d, _, _] + //! 3) For each chunk we also compute how many elements are selected. (in the example - 2). + //! 4) Both shuffled chunk and a number are put in a `kumi::tupe` + //! TODO: there is a bug where sometimes it's an `int` and not `std::ptrdiff_t`. + //! 5) Those chunks are combined together in another tuple. + //! + //! List of people who's work was instrumental for building this: + //! @aqrit user on Stack Overflow + //! Peter Cordes + //! + //! Throughout the code of compress there are references to what was taken from where + //! as well as explanations. + //! + //! @groupheader{Callable Signatures} + //! + //! @code + //! namespace eve + //! { + //! template + //! auto compress(T x, L m); // (1) + //! + //! template + //! auto compress[ignore](T x, L m) // (2) + //! } + //! @endcode + //! + //! **Parameters** + //! + //! * x - `simd_value` to compress + //! * m - mask which markes selected elements as true + //! * ignore - optional `eve::relative_conditional_expr`, passed in `[]`. + //! Ignored elements are treated as not selected. + //! + //! **Return value** + //! + //! `kumi::tuple, ...>` - tuple of compressed chunks, + //! constructed as described earlier. + //! + //! @groupheader{Example} + //! + //! @godbolt{doc/core/compress/compress.cpp} + //! + //! @} + //================================================================================================ + EVE_MAKE_CALLABLE(compress_, compress); +} + +#include + +#if defined(EVE_INCLUDE_X86_HEADER) +# include +#endif + +#if defined(EVE_INCLUDE_SVE_HEADER) +# include +#endif diff --git a/include/eve/module/core/compress/compress_store.hpp b/include/eve/module/core/compress/compress_store.hpp new file mode 100644 index 0000000000..e1dc232c88 --- /dev/null +++ b/include/eve/module/core/compress/compress_store.hpp @@ -0,0 +1,123 @@ +//================================================================================================== +/* + EVE - Expressive Vector Engine + Copyright : EVE Project Contributors + SPDX-License-Identifier: BSL-1.0 +*/ +//================================================================================================== +#pragma once + +#include +#include + +namespace eve +{ +//================================================================================================ +//! @addtogroup core_compress +//! @{ +//! @var compress_store +//! @brief A function that stores selected elements from an `eve::simd_value` +//! to an `evesimd_compatible_ptr`, while compressing them to the beginning. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @warning you should use `eve::compress_copy` if possible, it has more opportunities +//! for optimizations. +//! +//! You can think about this function as `copy_if` for `simd_value`. +//! Similar to `copy_if`, it returns you a `ptr` after the last written element. +//! +//! @note many non const `eve::algo::relaxed_iterator` are `simd_compatible_ptr` and +//! can be used with `compress_store` +//! +//! There are 2 versions: `unsafe` and `safe`: +//! * `unsafe` is allowed to write up to `simd_value::size()` elements +//! regardless of how many elements are selected. In other words it +//! is `eve::compress` + `eve::store`. +//! * `safe` version will write exactly how many elements are selected. +//! This makes it slow on most platforms. +//! +//! @note `safe` version does not touch not selected elements. So, for example, +//! other threads can read/write them without a race condition. +//! +//! ## Masked Calls +//! +//! You can pass `eve::relative_conditional_expr` ignore modifier to indicate that +//! some elements should not be considered. +//! +//! Passing `ignore` other than `eve::ignore_none` to `unsafe(compress_store)` +//! converts it into `safe`. +//! +//! Ignored elements are treated as not selected when compressing. +//! We start writing from `c.offset()`. This is the same behaviour as `eve::store`. +//! +//! ignore_first(1), [a, b, c, d], (true, true, false, true) +//! ouput: [_, b, d, _] - here _ indicates previous value that was not modified. +//! +//! +//! @note passing `ignore` other that `ignore_none` to `unsafe(compress_store)` +//! is making it `safe`. +//! As soon as we start not writing some elements, it doesn't cost us extra. +//! Plus it simplifies writing code for ranges with unequal length. +//! +//! Ignored elements are treated as not selected when compressing. +//! We start writing from `c.offset()`. +//! +//! ignore_first(1), [a, b, c, d], (true, true, false, true) +//! ouput: [_, b, d, _] - here _ indicates previous value that was not modified. +//! +//! Another explanation: +//! `unsafe(compress_store[ignore])(x, x != 0)` behaves exactly like `store[ignore]` +//! if none of the elements are 0s. +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace eve +//! { +//! template Ptr> +//! unalign_t unsafe(compress_store)(T x, L m, Ptr ptr) // (1) +//! +//! template Ptr> +//! unalign_t unsafe(compress_store[C ignore])(T x, L m, Ptr ptr) // (2) +//! +//! template Ptr> +//! unalign_t safe(compress_store)(T x, L m, Ptr ptr) // (3) +//! +//! template Ptr> +//! unalign_t safe(compress_store[C ignore])(T x, L m, Ptr ptr) // (4) +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `x`: `simd_value` to compress +//! * `m`: mask indicating selected elements +//! * `ptr`: pointer-like where to write the elements +//! * `ignore` - optional `eve::relative_condiation_expr`, see detailed explanation above +//! +//! **Return value** +//! +//! * ptr after the last selected element written +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/core/compress/compress_store.cpp} +//! +//! @} +//================================================================================================ + +EVE_MAKE_CALLABLE(compress_store_, compress_store); +} + +#include diff --git a/include/eve/module/core/compress/core.hpp b/include/eve/module/core/compress/core.hpp new file mode 100644 index 0000000000..62c1639260 --- /dev/null +++ b/include/eve/module/core/compress/core.hpp @@ -0,0 +1,11 @@ +//================================================================================================== +/** + EVE - Expressive Vector Engine + Copyright : EVE Project Contributors + SPDX-License-Identifier: BSL-1.0 +**/ +//================================================================================================== +#pragma once + +#include +#include diff --git a/include/eve/detail/compress/compress_mask_num.hpp b/include/eve/module/core/compress/detail/compress_mask_num.hpp similarity index 89% rename from include/eve/detail/compress/compress_mask_num.hpp rename to include/eve/module/core/compress/detail/compress_mask_num.hpp index 556d6ca78a..3ebd9d5e6a 100644 --- a/include/eve/detail/compress/compress_mask_num.hpp +++ b/include/eve/module/core/compress/detail/compress_mask_num.hpp @@ -73,16 +73,16 @@ namespace eve EVE_CALLABLE_API(compress_store_swizzle_mask_num_, compress_store_swizzle_mask_num) } -#include +#include #if defined(EVE_INCLUDE_X86_HEADER) -# include +# include #endif #if defined(EVE_INCLUDE_ARM_HEADER) -# include +# include #endif #if defined(EVE_INCLUDE_POWERPC_HEADER) -# include +# include #endif diff --git a/include/eve/detail/compress/compress_using_bmi.hpp b/include/eve/module/core/compress/detail/compress_using_bmi.hpp similarity index 92% rename from include/eve/detail/compress/compress_using_bmi.hpp rename to include/eve/module/core/compress/detail/compress_using_bmi.hpp index d695c457dd..f43b9b4732 100644 --- a/include/eve/detail/compress/compress_using_bmi.hpp +++ b/include/eve/module/core/compress/detail/compress_using_bmi.hpp @@ -30,5 +30,5 @@ namespace eve } #if defined(EVE_INCLUDE_X86_HEADER) -# include +# include #endif diff --git a/include/eve/detail/compress/compress_using_masks.hpp b/include/eve/module/core/compress/detail/compress_using_masks.hpp similarity index 90% rename from include/eve/detail/compress/compress_using_masks.hpp rename to include/eve/module/core/compress/detail/compress_using_masks.hpp index 78ee039daf..47923e6991 100644 --- a/include/eve/detail/compress/compress_using_masks.hpp +++ b/include/eve/module/core/compress/detail/compress_using_masks.hpp @@ -55,8 +55,8 @@ namespace eve EVE_CALLABLE_API(compress_using_masks_to_left_, compress_using_masks_to_left) } -#include +#include #if defined(EVE_INCLUDE_X86_HEADER) -# include +# include #endif diff --git a/include/eve/detail/compress/compress_using_switch.hpp b/include/eve/module/core/compress/detail/compress_using_switch.hpp similarity index 83% rename from include/eve/detail/compress/compress_using_switch.hpp rename to include/eve/module/core/compress/detail/compress_using_switch.hpp index 3ca35fac18..46c62f4006 100644 --- a/include/eve/detail/compress/compress_using_switch.hpp +++ b/include/eve/module/core/compress/detail/compress_using_switch.hpp @@ -27,8 +27,8 @@ namespace eve EVE_CALLABLE_API(compress_using_switch_, compress_using_switch) } -#include +#include #if defined(EVE_INCLUDE_X86_HEADER) -# include +# include #endif diff --git a/include/eve/detail/compress/simd/arm/neon/compress_mask_num.hpp b/include/eve/module/core/compress/detail/simd/arm/neon/compress_mask_num.hpp similarity index 100% rename from include/eve/detail/compress/simd/arm/neon/compress_mask_num.hpp rename to include/eve/module/core/compress/detail/simd/arm/neon/compress_mask_num.hpp diff --git a/include/eve/detail/compress/simd/common/compress_mask_num.hpp b/include/eve/module/core/compress/detail/simd/common/compress_mask_num.hpp similarity index 100% rename from include/eve/detail/compress/simd/common/compress_mask_num.hpp rename to include/eve/module/core/compress/detail/simd/common/compress_mask_num.hpp diff --git a/include/eve/detail/compress/simd/common/compress_using_masks.hpp b/include/eve/module/core/compress/detail/simd/common/compress_using_masks.hpp similarity index 99% rename from include/eve/detail/compress/simd/common/compress_using_masks.hpp rename to include/eve/module/core/compress/detail/simd/common/compress_using_masks.hpp index e2c121fc47..939215743c 100644 --- a/include/eve/detail/compress/simd/common/compress_using_masks.hpp +++ b/include/eve/module/core/compress/detail/simd/common/compress_using_masks.hpp @@ -9,7 +9,7 @@ #include -#include +#include #include #include diff --git a/include/eve/detail/compress/simd/common/compress_using_switch.hpp b/include/eve/module/core/compress/detail/simd/common/compress_using_switch.hpp similarity index 100% rename from include/eve/detail/compress/simd/common/compress_using_switch.hpp rename to include/eve/module/core/compress/detail/simd/common/compress_using_switch.hpp diff --git a/include/eve/detail/compress/simd/ppc/compress_mask_num.hpp b/include/eve/module/core/compress/detail/simd/ppc/compress_mask_num.hpp similarity index 100% rename from include/eve/detail/compress/simd/ppc/compress_mask_num.hpp rename to include/eve/module/core/compress/detail/simd/ppc/compress_mask_num.hpp diff --git a/include/eve/detail/compress/simd/x86/compress_mask_num.hpp b/include/eve/module/core/compress/detail/simd/x86/compress_mask_num.hpp similarity index 100% rename from include/eve/detail/compress/simd/x86/compress_mask_num.hpp rename to include/eve/module/core/compress/detail/simd/x86/compress_mask_num.hpp diff --git a/include/eve/detail/compress/simd/x86/compress_using_bmi.hpp b/include/eve/module/core/compress/detail/simd/x86/compress_using_bmi.hpp similarity index 100% rename from include/eve/detail/compress/simd/x86/compress_using_bmi.hpp rename to include/eve/module/core/compress/detail/simd/x86/compress_using_bmi.hpp diff --git a/include/eve/detail/compress/simd/x86/compress_using_masks.hpp b/include/eve/module/core/compress/detail/simd/x86/compress_using_masks.hpp similarity index 100% rename from include/eve/detail/compress/simd/x86/compress_using_masks.hpp rename to include/eve/module/core/compress/detail/simd/x86/compress_using_masks.hpp diff --git a/include/eve/detail/compress/simd/x86/compress_using_switch.hpp b/include/eve/module/core/compress/detail/simd/x86/compress_using_switch.hpp similarity index 100% rename from include/eve/detail/compress/simd/x86/compress_using_switch.hpp rename to include/eve/module/core/compress/detail/simd/x86/compress_using_switch.hpp diff --git a/include/eve/detail/compress/simd/arm/sve/compress.hpp b/include/eve/module/core/compress/simd/arm/sve/compress.hpp similarity index 93% rename from include/eve/detail/compress/simd/arm/sve/compress.hpp rename to include/eve/module/core/compress/simd/arm/sve/compress.hpp index f6cac297fd..7db76fb619 100644 --- a/include/eve/detail/compress/simd/arm/sve/compress.hpp +++ b/include/eve/module/core/compress/simd/arm/sve/compress.hpp @@ -56,11 +56,7 @@ namespace eve::detail EVE_FORCEINLINE auto compress_(EVE_SUPPORTS(sve_), C c, wide v, logical> mask) noexcept { - if constexpr ( C::is_complete && !C::is_inverted ) - { - kumi::tuple cur{ v, (std::ptrdiff_t) 0 }; - return kumi::tuple { cur }; - } + if constexpr( C::is_complete && !C::is_inverted ) return compress_(EVE_RETARGET(cpu_), c, v, mask); else if constexpr ( !C::is_complete ) { return compress(ignore_none, v, mask && c.mask(as(mask))); diff --git a/include/eve/module/core/compress/simd/common/compress.hpp b/include/eve/module/core/compress/simd/common/compress.hpp new file mode 100644 index 0000000000..d9a4793bd7 --- /dev/null +++ b/include/eve/module/core/compress/simd/common/compress.hpp @@ -0,0 +1,68 @@ +//================================================================================================== +/* + EVE - Expressive Vector Engine + Copyright : EVE Project Contributors + SPDX-License-Identifier: BSL-1.0 +*/ +//================================================================================================== +#pragma once + +#include + +namespace eve::detail +{ + +template +EVE_FORCEINLINE auto +compress_(EVE_SUPPORTS(cpu_), C c, wide v, logical> mask) noexcept +{ + if constexpr( C::is_complete && !C::is_inverted ) + { + kumi::tuple cur {v, (std::ptrdiff_t)0}; + return kumi::tuple {cur}; + } + else return compress_using_masks[c](v, mask); +} + +template struct compress_bits_to_logical +{ + // unfortunately, we are not consistent with integer types + template + EVE_FORCEINLINE auto operator()(kumi::tuple, I> bits_offset) + { + auto [bits, offset] = bits_offset; + + eve::as_wide_t, N> r; + + if constexpr( abi_t::is_wide_logical ) r = bit_cast(bits, as(r)); + else r = bit_cast(to_logical(bits), as(r)); + + return kumi::tuple {r, offset}; + } +}; + +template +EVE_FORCEINLINE auto +compress_(EVE_SUPPORTS(cpu_), C c, T v, L mask) noexcept +requires(T::size() == L::size()) +{ + auto compressed = compress[c](v.bits(), mask); + return kumi::map(compress_bits_to_logical {}, compressed); +} + +template +EVE_FORCEINLINE auto +compress_(EVE_SUPPORTS(cpu_), C, T, L) noexcept +requires(T::size() == L::size()) && (has_bundle_abi_v) +{ + static_assert(!has_bundle_abi_v, "FIX: 1647, eve::compress does not support bundle at the moment."); +} + +template +EVE_FORCEINLINE auto +compress_(EVE_SUPPORTS(cpu_), T v, L mask) noexcept +requires(T::size() == L::size()) +{ + return compress[ignore_none](v, mask); +} +} diff --git a/include/eve/module/core/regular/impl/compress_store.hpp b/include/eve/module/core/compress/simd/common/compress_store.hpp similarity index 71% rename from include/eve/module/core/regular/impl/compress_store.hpp rename to include/eve/module/core/compress/simd/common/compress_store.hpp index 545f2be11a..b19c50b1ff 100644 --- a/include/eve/module/core/regular/impl/compress_store.hpp +++ b/include/eve/module/core/compress/simd/common/compress_store.hpp @@ -7,7 +7,6 @@ //================================================================================================== #pragma once -#include #include #include #include @@ -16,25 +15,61 @@ namespace eve::detail { + + template> Ptr> + EVE_FORCEINLINE + unaligned_t compress_store_core( C c, + wide v, + logical> mask, + Ptr ptr) noexcept + { + if constexpr ( has_emulated_abi_v> ) + { + auto offset = c.offset(as(v)); + auto count = c.count(as(v)); + auto* ptr_ = unalign(ptr); + + for (int idx = offset; idx != (int)(offset + count); ++idx) { + if (mask.get(idx)) *ptr_++ = v.get(idx); + } + + return ptr_; + } + else + { + auto parts = compress[c](v, mask); + + auto uptr = unalign(ptr); + + kumi::for_each([&](auto part_count) mutable { + auto [part, count] = part_count; + eve::store(part, uptr); + uptr += count; + }, parts); + + return uptr; + } + } + template> Ptr> requires(!has_store_equivalent, Ptr>) - EVE_FORCEINLINE unaligned_t compress_store_(EVE_SUPPORTS(cpu_), - C c, - safe_type, - wide v, - logical> mask, - Ptr ptr) +EVE_FORCEINLINE unaligned_t compress_store_(EVE_SUPPORTS(cpu_), + C c, + safe_type, + wide v, + logical> mask, + Ptr ptr) noexcept { if( C::is_complete && !C::is_inverted ) return unalign(ptr); else { stack_buffer> buffer; - auto up_to = compress_store_impl(c, v, mask, buffer.ptr()); + auto up_to = compress_store_core(c, v, mask, buffer.ptr()); std::ptrdiff_t n = up_to - buffer.ptr(); unaligned_t out = unalign(ptr) + c.offset(as(mask)); @@ -61,7 +96,7 @@ requires(!has_store_equivalent, Ptr>) noexcept { if( !C::is_complete || !C::is_inverted ) return safe(compress_store[c])(v, mask, ptr); - else return compress_store_impl(c, v, mask, ptr); + else return compress_store_core(c, v, mask, ptr); } template diff --git a/include/eve/module/core/compress/simd/x86/compress.hpp b/include/eve/module/core/compress/simd/x86/compress.hpp new file mode 100644 index 0000000000..c6b506cf92 --- /dev/null +++ b/include/eve/module/core/compress/simd/x86/compress.hpp @@ -0,0 +1,32 @@ +//================================================================================================== +/* + EVE - Expressive Vector Engine + Copyright : EVE Project Contributors + SPDX-License-Identifier: BSL-1.0 +*/ +//================================================================================================== +#pragma once + +#include +#include + +namespace eve::detail +{ +template +EVE_FORCEINLINE auto +compress_(EVE_SUPPORTS(sse2_), C c, wide v, logical> mask) noexcept +requires(current_api < ssse3) +{ + if constexpr( C::is_complete && !C::is_inverted ) return compress_(EVE_RETARGET(cpu_), c, v, mask); + return compress_using_switch[c](v, mask); +} + +template +EVE_FORCEINLINE auto +compress_(EVE_SUPPORTS(avx2_), C c, wide v, logical> mask) noexcept +requires(N() >= 4 && supports_bmi_well) +{ + if constexpr( C::is_complete && !C::is_inverted ) return compress_(EVE_RETARGET(cpu_), c, v, mask); + else return compress_using_bmi(v, top_bits {mask, c}); +} +} diff --git a/include/eve/module/core/regular/compress_store.hpp b/include/eve/module/core/regular/compress_store.hpp deleted file mode 100644 index 24fdfe2adc..0000000000 --- a/include/eve/module/core/regular/compress_store.hpp +++ /dev/null @@ -1,53 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -namespace eve -{ -//================================================================================================ -//! @addtogroup core_simd -//! @{ -//! @var compress_store -//! @brief Computes the TODO -//! -//! **Defined in Header** -//! -//! @code -//! #include -//! @endcode -//! -//! @groupheader{Callable Signatures} -//! -//! @code -//! namespace eve -//! { -//! TODO -//! } -//! @endcode -//! -//! **Parameters** -//! -//! * `x`: An instance of an [SIMD value](@ref eve::simd_value) -//! -//! **Return value** -//! -//! * TODO -//! -//! @groupheader{Example} -//! -//! TODO -//! @} -//================================================================================================ - -EVE_MAKE_CALLABLE(compress_store_, compress_store); -} - -#include diff --git a/include/eve/module/core/regular/core.hpp b/include/eve/module/core/regular/core.hpp index fdd9b5e62f..09947d27f4 100644 --- a/include/eve/module/core/regular/core.hpp +++ b/include/eve/module/core/regular/core.hpp @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include diff --git a/test/doc/CMakeLists.txt b/test/doc/CMakeLists.txt index cd868357cd..ed5b9d23b7 100644 --- a/test/doc/CMakeLists.txt +++ b/test/doc/CMakeLists.txt @@ -48,6 +48,7 @@ glob_unit("doc" ${doc_root} "quaternion/regular/*.cpp" ) ##================================================================================================== add_custom_target(doc.core.exe ) add_dependencies(doc.exe doc.core.exe ) +glob_unit("doc" ${doc_root} "core/compress/*.cpp" ) glob_unit("doc" ${doc_root} "core/constant/*.cpp" ) glob_unit("doc" ${doc_root} "core/fuzzy/*.cpp" ) glob_unit("doc" ${doc_root} "core/masked/*.cpp" ) diff --git a/test/doc/core/compress/compress.cpp b/test/doc/core/compress/compress.cpp new file mode 100644 index 0000000000..9a942ef6dc --- /dev/null +++ b/test/doc/core/compress/compress.cpp @@ -0,0 +1,104 @@ +#include +#include + +// template to make if constexpr not activate +template +void show_return_type(T) +{ + if constexpr (std::same_as && eve::current_api == eve::sse4_2) + { + // On sse4_2 the default wide::size() == 16 + + // We cannot compress 16 bytes in one step, + // We need to split it into 2 chunks of 8. + // + // So the result will be 2 chunks of 8. + // We will also return how many are in each chunk + + // clang-format off + eve::wide in { + 1, 2, 0, 4, // + 5, 0, 6, 7, // + 8, 9, 10, 11, // + 12, 0, 14, 15, // + }; + // clang-format on + + using i8x8 = eve::wide>; + + using chunk = kumi::tuple; // int should be ptrdiff_t - this is a bug + + // ignore will be interpreted as false in the mask + kumi::tuple compressed = eve::compress[eve::ignore_first(1)](in, in != 0); + + auto [lo, hi] = compressed; + + auto [lo_compressed, lo_count] = lo; + auto [hi_compressed, hi_count] = hi; + + TTS_EQUAL(5, lo_count); // 2 zeroes in the first 8 elements + ignore_first + TTS_EQUAL(7, hi_count); // 1 zero in the second 8 elements + + // The 'tail' after removed elements is unspecified + // so looking at them is not helpful. + lo_compressed.set(5, -1); + lo_compressed.set(6, -1); + lo_compressed.set(7, -1); + hi_compressed.set(7, -1); + + TTS_EXPECT(eve::all(lo_compressed == i8x8{2, 4, 5, 6, 7, -1, -1, -1})); + TTS_EXPECT(eve::all(hi_compressed == i8x8{8, 9, 10, 11, 12, 14, 15, -1})); + } +} + +// Here is how one can use `eve::compress` directly. +// This how for some platforms we can implement `compress_copy_unsafe_dense`. +int* compress_copy_using_compress_directly(const int* in, int* out) +{ + auto loaded = eve::load(in); + + // a tuple or compressed wides. + // each part is not just a wide but is a tuple + // so that you know how to compact values after + // + // So using chunk = kumi::tuple>; + // So kumi::tuple + kumi::tuple compressed_whole = eve::compress(loaded, loaded != 0); + + kumi::for_each([&](auto compressed_lengh) { + auto [compressed, length] = compressed_lengh; + eve::store(compressed, out); + out += length; + }, compressed_whole); + + return out; +} + +void validate_compress_copy(auto f) +{ + constexpr std::size_t N = eve::wide::size(); + std::array in = {}; + + for (std::size_t i = 0; i != N; ++i) { + if (i % 4 == 0) in[i] = 0; + else + { + in[i] = i; + } + } + + std::array expected = {}; + std::copy_if(in.begin(), in.end(), expected.begin(), [](int x) { return x != 0; }); + + std::array out = {}; + auto* o = f(in.data(), out.data()); + std::fill(o, out.data() + out.size(), 0); + + TTS_EQUAL(expected, out); +} + +int main() +{ + show_return_type(std::int8_t{0}); + validate_compress_copy(compress_copy_using_compress_directly); +} diff --git a/test/doc/core/compress/compress_store.cpp b/test/doc/core/compress/compress_store.cpp new file mode 100644 index 0000000000..dcc888940d --- /dev/null +++ b/test/doc/core/compress/compress_store.cpp @@ -0,0 +1,45 @@ +#include +#include + +using n = eve::fixed<4>; +using w_t = eve::wide; +using l_t = eve::logical>; // Note the type mismatch + +int main() +{ + w_t in { 1, 2, 3, 4 }; + l_t m { false, true, true, false }; + + { + // We have to have 4 elements in the output, even if only 2 are selected. + std::array out {}; + + int* o = eve::unsafe(eve::compress_store)(in, m, out.data()); + TTS_EQUAL(2, o - out.data()); // 2 elements are selected and written + + // We don't know what elements are after + out[2] = -1; + out[3] = -1; + TTS_EQUAL((std::array{2, 3, -1, -1}), out); + } + + { + // Here we know we won't write more than selected, + // at the price of it being more expensive + std::array out {}; + int* o = eve::safe(eve::compress_store)(in, m, out.data()); + + TTS_EQUAL(o - out.data(), 2); + TTS_EQUAL((std::array{2, 3}), out); + } + + { + // Ignore affects output as well as input. + // `unsafe` becomes `safe` as soon as we ignore anything. + std::array out {-1, 0, 0}; + int* o = eve::unsafe(eve::compress_store[eve::ignore_first(1)])(in, m, out.data()); + + TTS_EQUAL(o - out.data(), 3); + TTS_EQUAL((std::array{-1, 2, 3}), out); + } +} diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index f50ee80cbb..e7a69fb7dd 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -11,6 +11,7 @@ set(module_root "${PROJECT_SOURCE_DIR}/test/unit/module") ##================================================================================================== add_custom_target(unit.api.exe ) add_dependencies(unit.exe unit.api.exe ) +glob_unit("unit" ${unit_root} "api/compress/*.cpp") glob_unit("unit" ${unit_root} "api/regular/*.cpp") glob_unit("unit" ${unit_root} "api/regular/shuffle/*.cpp") glob_unit("unit" ${unit_root} "api/regular/shuffle_v2/*.cpp") diff --git a/test/unit/api/compress/compress_logical.cpp b/test/unit/api/compress/compress_logical.cpp new file mode 100644 index 0000000000..26deb55a72 --- /dev/null +++ b/test/unit/api/compress/compress_logical.cpp @@ -0,0 +1,16 @@ +#include "unit/api/compress/compress_test.hpp" + +TTS_CASE_WITH( "Check compress behavior for logicals" + , eve::test::simd::all_types + , tts::generate(tts::logicals(1,2)) + ) + (L logical_data) +{ + using N = eve::fixed; + + smaller_test_for(logical_data); + smaller_test_for>>(logical_data); + smaller_test_for>>(logical_data); + smaller_test_for>>(logical_data); + smaller_test_for>>(logical_data); +}; diff --git a/test/unit/memory/compress_store/logical.cpp b/test/unit/api/compress/compress_store_logical.cpp similarity index 58% rename from test/unit/memory/compress_store/logical.cpp rename to test/unit/api/compress/compress_store_logical.cpp index b653003632..54a3e2d85e 100644 --- a/test/unit/memory/compress_store/logical.cpp +++ b/test/unit/api/compress/compress_store_logical.cpp @@ -15,16 +15,12 @@ TTS_CASE_WITH( "Check compress store behavior" ) (L logical_data) { -#if defined(SPY_SIMD_IS_ARM_FIXED_SVE) - TTS_PASS("FIX-ME: 1493"); - return; // not -#endif using N = eve::fixed; - smaller_test_v(logical_data); - smaller_test_v>>(logical_data); - smaller_test_v>>(logical_data); - smaller_test_v>>(logical_data); - smaller_test_v>>(logical_data); + compress_store_test(logical_data); + compress_store_test>>(logical_data); + compress_store_test>>(logical_data); + compress_store_test>>(logical_data); + compress_store_test>>(logical_data); }; diff --git a/test/unit/memory/compress_store/compress_store_test.hpp b/test/unit/api/compress/compress_store_test.hpp similarity index 78% rename from test/unit/memory/compress_store/compress_store_test.hpp rename to test/unit/api/compress/compress_store_test.hpp index 669a43012e..465197e31a 100644 --- a/test/unit/memory/compress_store/compress_store_test.hpp +++ b/test/unit/api/compress/compress_store_test.hpp @@ -5,9 +5,9 @@ SPDX-License-Identifier: BSL-1.0 **/ //================================================================================================== -#include "test.hpp" +#pragma once -#include +#include "test.hpp" #include #include @@ -51,22 +51,11 @@ void ignore_test(T x, L m, C c) } template -void all_ignore_tests(T x, L m) +void ignore_tests(T x, L m) { - if (x.size() < 16) - { - for (int i = 0; i != x.size() + 1; ++i) { - for (int j = 0; j <= x.size() - i; ++j) { - ignore_test(x, m, eve::ignore_extrema{i, j}); - } - } - } - else - { - for (int i = 0; i != x.size() + 1; ++i) { - ignore_test(x, m, eve::ignore_first(i)); - ignore_test(x, m, eve::ignore_last(i)); - } + for (int i = 0; i < x.size() + 1; i += 7) { + ignore_test(x, m, eve::ignore_first(i)); + ignore_test(x, m, eve::ignore_last(i)); } } @@ -138,30 +127,11 @@ void one_test(T x, L m) TTS_EQUAL(T(expected.begin()), T(actual.begin())); } - if constexpr (all_options) - { - all_ignore_tests(x, m); - } -} - -template -void go_through_everything(T x) -{ - L m(false); - auto test = [&](auto& self, std::size_t i) mutable { - if (i == T::size()) { - one_test(x, m); - return; - }; - self(self, i + 1); - m.set(i, true); - self(self, i + 1); - }; - test(test, 0); + ignore_tests(x, m); } template -void smaller_test_v(T x) +void compress_store_test(T x) { { // even elements @@ -194,20 +164,10 @@ void smaller_test_v(T x) return m; }; - for( int i = 0; i < 100; ++i ) { one_test(x, random_l()); } + for( int i = 0; i < 20; ++i ) { one_test(x, random_l()); } } // precise precise_tests(x); } } - -template -void all_tests_for_v(T x) -{ - if constexpr (T::size() <= 8) - { - go_through_everything(x); - } - smaller_test_v(x); -} diff --git a/test/unit/memory/compress_store/tuple.cpp b/test/unit/api/compress/compress_store_tuple.cpp similarity index 100% rename from test/unit/memory/compress_store/tuple.cpp rename to test/unit/api/compress/compress_store_tuple.cpp diff --git a/test/unit/api/compress/compress_store_wide.cpp b/test/unit/api/compress/compress_store_wide.cpp new file mode 100644 index 0000000000..5053c009c5 --- /dev/null +++ b/test/unit/api/compress/compress_store_wide.cpp @@ -0,0 +1,23 @@ +//================================================================================================== +/** + EVE - Expressive Vector Engine + Copyright : EVE Project Contributors + SPDX-License-Identifier: BSL-1.0 +**/ +//================================================================================================== +#include "compress_store_test.hpp" + +#include + +TTS_CASE_WITH("Check compress store behavior", + eve::test::simd::all_types, + tts::generate(tts::ramp(1))) +(T data) +{ + using N = eve::fixed; + + compress_store_test>>(data); + compress_store_test>>(data); + compress_store_test>>(data); + compress_store_test>>(data); +}; diff --git a/test/unit/api/compress/compress_test.hpp b/test/unit/api/compress/compress_test.hpp new file mode 100644 index 0000000000..37c0bebf56 --- /dev/null +++ b/test/unit/api/compress/compress_test.hpp @@ -0,0 +1,187 @@ +//================================================================================================== +/** + EVE - Expressive Vector Engine + Copyright : EVE Project Contributors + SPDX-License-Identifier: BSL-1.0 +**/ +//================================================================================================== +#pragma once + +#include "test.hpp" + +#include +#include +#include + +template +auto make_expected(T x_, L m_, MaybeIgnore ... ignore ) +{ + if constexpr (sizeof...(ignore)) { + m_ = m_ && to_logical(ignore..., eve::as(m_)); + } + + eve::stack_buffer x; + eve::store(x_, x.ptr()); + auto x_ptr = eve::unalign(x.ptr()); + + eve::stack_buffer m; + eve::store(m_, m.ptr()); + auto m_ptr = eve::unalign(m.ptr()); + + std::array, T::size()> r; + r.fill(eve::zero(eve::as>{})); + + auto o = r.begin(); + + for (std::size_t i = 0; i != T::size(); ++i) { + if (m_ptr[i]) *o++ = x_ptr[i]; + } + + return r; +} + +template +auto make_actual(T x, L m, MaybeIgnore ... ignore ) +{ + std::array, T::size()> r; + + auto* o = r.data(); + + auto actual_tuple = eve::compress(ignore..., x, m); + kumi::for_each([&](auto compressed_lengh) { + auto [compressed, length] = compressed_lengh; + eve::store(compressed, o); + o += length; + }, actual_tuple); + + std::fill(o, r.data() + r.size(), eve::zero(eve::as>{})); + return r; +} + + +template +void one_test(T x, L m, MaybeIgnore ... ignore ) +{ + auto expected = make_expected(x, m, ignore...); + auto actual = make_actual(x, m, ignore...); + ((TTS_EQUAL(expected, actual) << "x: " << x << "m: " << m << " ignore: ") << ... << ignore); + if (expected != actual) { + std::terminate(); + } +} + +template +void all_ignore_tests(T x, L m) +{ + // sve takes very long on emulation + + one_test(x, m); + one_test(x, m, eve::ignore_all); + + if (eve::current_api >= eve::sve && eve::logical_value) + { + one_test(x, m, eve::ignore_first(1)); + return; + } + + + if constexpr (!(eve::current_api >= eve::sve)) { + if (x.size() < 8 && !(eve::current_api >= eve::sve)) + { + for (int i = 0; i != x.size() + 1; ++i) { + for (int j = 0; j <= x.size() - i; ++j) { + one_test(x, m, eve::ignore_extrema{i, j}); + } + } + return; + } + } + + if (x.size() < 32) + { + for (int i = 0; i < x.size() + 1; i++) { + one_test(x, m, eve::ignore_first(i)); + one_test(x, m, eve::ignore_last(i)); + } + } + else + { + for (int i = 0; i < x.size() + 1; i += 20) { + one_test(x, m, eve::ignore_first(i)); + one_test(x, m, eve::ignore_last(i)); + } + } +} + +template +void go_through_everything(T x) +{ + L m(false); + auto test = [&](auto& self, std::size_t i) mutable { + if (i == T::size()) { + all_ignore_tests(x, m); + return; + }; + self(self, i + 1); + m.set(i, true); + self(self, i + 1); + }; + test(test, 0); +} + + +template +void smaller_test_for(T x) +{ + { + // even elements + { + L m {false}; + + for( std::ptrdiff_t i = 0; i < T::size(); i += 2 ) + { + m.set(i, true); + all_ignore_tests(x, m); + } + } + + // all/none + { + all_ignore_tests(x, L {true}); + all_ignore_tests(x, L {false}); + } + // bunch of randoms + { + constexpr auto seed = + sizeof(eve::element_type_t) + sizeof(eve::element_type_t) + T::size(); + std::mt19937 g(seed); + std::uniform_int_distribution d(0, 1); + + auto random_l = [&]() mutable + { + L m {false}; + for( int i = 0; i != L::size(); ++i ) { m.set(i, d(g) == 1); } + return m; + }; + + int n = 100; + if (eve::current_api >= eve::sve) n = 20; + + for( int i = 0; i < n; ++i ) { all_ignore_tests(x, random_l()); } + } + } +} + + +template +void compress_store_test(T x) +{ + if constexpr (T::size() <= 8 && !(eve::current_api >= eve::sve) ) + { + go_through_everything(x); + } + else + { + smaller_test_for(x); + } +} diff --git a/test/unit/api/compress/compress_wide.cpp b/test/unit/api/compress/compress_wide.cpp new file mode 100644 index 0000000000..0b930ad9e2 --- /dev/null +++ b/test/unit/api/compress/compress_wide.cpp @@ -0,0 +1,10 @@ +#include "unit/api/compress/compress_test.hpp" + +TTS_CASE_WITH( "Check compress behavior" + , eve::test::simd::all_types + , tts::generate(tts::ramp(1)) + ) + (T data) +{ + compress_store_test>(data); +}; diff --git a/test/unit/memory/compress_store/wide.cpp b/test/unit/api/compress/compress_wide_diff_logicals.cpp similarity index 54% rename from test/unit/memory/compress_store/wide.cpp rename to test/unit/api/compress/compress_wide_diff_logicals.cpp index a290a381d7..bffd29733f 100644 --- a/test/unit/memory/compress_store/wide.cpp +++ b/test/unit/api/compress/compress_wide_diff_logicals.cpp @@ -5,19 +5,19 @@ SPDX-License-Identifier: BSL-1.0 **/ //================================================================================================== -#include "compress_store_test.hpp" +#include "compress_test.hpp" #include -TTS_CASE_WITH( "Check compress store behavior" + +TTS_CASE_WITH( "Check compress wide diff logicals" , eve::test::simd::all_types , tts::generate(tts::ramp(1)) ) (T data) { -#if defined(SPY_SIMD_IS_ARM_FIXED_SVE) - // FIX-ME: 1493 compress test issues - smaller_test_v>(data); - return; -#endif - all_tests_for_v>(data); + using N = eve::fixed; + smaller_test_for>>(data); + smaller_test_for>>(data); + smaller_test_for>>(data); + smaller_test_for>>(data); }; diff --git a/test/unit/internals/compress_mask_num.cpp b/test/unit/internals/compress_mask_num.cpp index 5cb2e639b9..4c7b714a46 100644 --- a/test/unit/internals/compress_mask_num.cpp +++ b/test/unit/internals/compress_mask_num.cpp @@ -13,7 +13,7 @@ TTS_CASE("compress_store helpers") TTS_PASS("Nothing to do here"); }; #else -#include +#include #include #include diff --git a/test/unit/memory/compress_store/wide_diff_logicals.cpp b/test/unit/memory/compress_store/wide_diff_logicals.cpp deleted file mode 100644 index 9da93acc3f..0000000000 --- a/test/unit/memory/compress_store/wide_diff_logicals.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//================================================================================================== -/** - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -**/ -//================================================================================================== -#include "compress_store_test.hpp" -#include - - -TTS_CASE_WITH( "Check compress store behavior" - , eve::test::simd::all_types - , tts::generate(tts::ramp(1)) - ) - (T data) -{ -#if defined(SPY_SIMD_IS_ARM_FIXED_SVE) - TTS_PASS("FIX-ME: 1493"); - return; // not -#endif - using N = eve::fixed; - smaller_test_v>>(data); - smaller_test_v>>(data); - smaller_test_v>>(data); - smaller_test_v>>(data); -};