-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* compress copy tests * compress copy scalar
- Loading branch information
1 parent
64441ad
commit 1e3aed8
Showing
16 changed files
with
733 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/arch.hpp> | ||
#include <eve/detail/overload.hpp> | ||
|
||
namespace eve | ||
{ | ||
EVE_REGISTER_CALLABLE(compress_copy_scalar_impl_) | ||
EVE_DECLARE_CALLABLE(compress_copy_scalar_impl_, compress_copy_scalar_impl) | ||
|
||
namespace detail | ||
{ | ||
EVE_ALIAS_CALLABLE(compress_copy_scalar_impl_, compress_copy_scalar_impl); | ||
} | ||
|
||
EVE_CALLABLE_API(compress_copy_scalar_impl_, compress_copy_scalar_impl) | ||
} | ||
|
||
//================================================================================================ | ||
//! @addtogroup core_compress | ||
//! @{ | ||
//! @var compress_copy_scalar | ||
//! @brief One of the implementations for eve::compress_copy that relies on | ||
//! only scalar reads/writes | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <eve/module/core.hpp> | ||
//! @endcode | ||
//! | ||
//! @warning you should probably use eve::compress_copy. | ||
//! | ||
//! eve::compress_copy will either call this or eve::compress_copy_simd. | ||
//! We believe eve::compress_copy makes correct selection of which one to use | ||
//! but this is exposed in case we didn't. | ||
//! | ||
//! Api completly matches eve::compress_copy. | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace eve | ||
//! { | ||
//! | ||
//! template <relative_conditional_expr C1, | ||
//! relative_conditional_expr C2, | ||
//! typename I, | ||
//! logical_simd_value L, | ||
//! typename O> | ||
//! auto compress_copy_scalar | ||
//! [safe/unsafe][sparse/dense] | ||
//! [C1 ignore_in][C2 ignore_out]( | ||
//! I in, | ||
//! L mask, | ||
//! O out) -> unaligned_t<O>; // (1) | ||
//! | ||
//! template <relative_conditional_expr C1, | ||
//! relative_conditional_expr C2, | ||
//! typename I, | ||
//! logical_simd_value L, | ||
//! typename O> | ||
//! auto compress_copy_scalar | ||
//! [safe/unsafe][sparse/dense] | ||
//! [C1 ignore_in][C2 ignore_out]( | ||
//! I in, | ||
//! wide<value_type_t<I>, fixed<L::size()>> preloaded, | ||
//! L mask, | ||
//! O out) -> unaligned_t<O>; // (2) | ||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! @see eve::compress_copy | ||
//! | ||
//! **Return value** | ||
//! | ||
//! @see eve::compress_copy | ||
//! @} | ||
//================================================================================================ | ||
|
||
#include <eve/module/core/compress/simd/common/compress_copy_scalar.hpp> | ||
|
||
#if defined(EVE_INCLUDE_SVE_HEADER) | ||
# include <eve/module/core/compress/simd/arm/sve/compress_copy_scalar.hpp> | ||
#endif |
27 changes: 0 additions & 27 deletions
27
include/eve/module/core/compress/detail/compress_copy_scalar.hpp
This file was deleted.
Oops, something went wrong.
111 changes: 0 additions & 111 deletions
111
include/eve/module/core/compress/detail/simd/common/compress_copy_scalar.hpp
This file was deleted.
Oops, something went wrong.
95 changes: 95 additions & 0 deletions
95
include/eve/module/core/compress/simd/arm/sve/compress_copy_scalar.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/module/core/regular/logical_andnot.hpp> | ||
|
||
namespace eve::detail | ||
{ | ||
|
||
template <typename I, typename L, typename O> | ||
EVE_FORCEINLINE O | ||
compress_copy_sparse_sve_no_limits(I f, L m, O o) | ||
{ | ||
if constexpr( has_aggregated_abi_v<L> ) | ||
{ | ||
auto [lo, hi] = m.slice(); | ||
o = compress_copy_sparse_sve_no_limits(f, lo, o); | ||
return compress_copy_sparse_sve_no_limits(f + (L::size() / 2), hi, o); | ||
} | ||
else | ||
{ | ||
while( any(m) ) | ||
{ | ||
L ignored_before = svbrka_z(sve_true<element_type_t<L>>(), m); | ||
m = svbic_z(sve_true<element_type_t<L>>(), m, ignored_before); | ||
auto cur = f + count_true(ignored_before) - 1; | ||
eve::write(eve::read(cur), o++); | ||
} | ||
return o; | ||
} | ||
} | ||
|
||
template <typename I, typename L, typename O> | ||
EVE_FORCEINLINE O | ||
compress_copy_sparse_sve_limited(I f, L m, O o, O limit) | ||
{ | ||
if constexpr( has_aggregated_abi_v<L> ) | ||
{ | ||
auto [lo, hi] = m.slice(); | ||
o = compress_copy_sparse_sve_limited(f, lo, o, limit); | ||
return compress_copy_sparse_sve_limited(f + (L::size() / 2), hi, o, limit); | ||
} | ||
else | ||
{ | ||
while( any(m) ) | ||
{ | ||
if (o == limit) return o; | ||
L ignored_before = svbrka_z(sve_true<element_type_t<L>>(), m); | ||
m = svbic_z(sve_true<element_type_t<L>>(), m, ignored_before); | ||
auto cur = f + count_true(ignored_before) - 1; | ||
eve::write(eve::read(cur), o++); | ||
} | ||
return o; | ||
} | ||
} | ||
|
||
template<typename Settings, typename I, typename L, typename O> | ||
EVE_FORCEINLINE auto | ||
compress_copy_scalar_impl_(EVE_SUPPORTS(sve_), Settings settings, I f, L m, O o) -> O | ||
requires(Settings::is_sparse) // | ||
{ | ||
using IC = typename Settings::cond_in_t; | ||
using OC = typename Settings::cond_out_t; | ||
|
||
if constexpr( L::size() < 4 ) | ||
{ | ||
return compress_copy_scalar_impl( | ||
compress_callable_settings(settings.safety, dense, settings.c_in, settings.c_out), f, m, o); | ||
} | ||
else if constexpr( !IC::is_complete ) | ||
{ | ||
return compress_copy_scalar_impl( | ||
compress_callable_settings(settings.safety, settings.density, ignore_none, settings.c_out), | ||
f, | ||
m && to_logical(settings.c_in, as(m)), | ||
o); | ||
} | ||
else if constexpr ( !OC::is_complete ) | ||
{ | ||
o += settings.c_out.offset(eve::as(m)); | ||
O limit = o + settings.c_out.count(eve::as(m)); | ||
return compress_copy_sparse_sve_limited(f, m, o, limit); | ||
} | ||
else | ||
{ | ||
return compress_copy_sparse_sve_no_limits(f, m, o); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.