Replies: 1 comment
-
Sample POC for NTTP lane (https://godbolt.org/z/3n5jWKMb6) #include <bit>
#include <cstdint>
#include <compare>
struct fixed_lane
{
consteval fixed_lane(std::ptrdiff_t v) : value(v)
{
if( v!=0 && !std::has_single_bit( static_cast<std::size_t>(v)) )
throw "[eve] Lane must be a power of 2";
}
consteval auto operator<=>(const fixed_lane&) const noexcept = default;
friend consteval fixed_lane operator*(fixed_lane l, int n) noexcept { return {l.value * n}; }
friend consteval fixed_lane operator*(int n, fixed_lane l) noexcept { return {l.value * n}; }
friend consteval fixed_lane operator/(fixed_lane l, int n) noexcept { return {l.value / n}; }
std::ptrdiff_t const value;
};
template<std::ptrdiff_t N> inline constexpr fixed_lane lane{N}; The consteval constructor with the test+throw means you can never have a non power of 2 lane and if you try stupid thign like lane * 3, it fails at compile time. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
#1193 and some other issues showed that the naming and usage of the API for retrieving the size of a wide is a bit ajar.
There was also a POC that showed promise of better API when using a NTTP instead of fixed.
As both are tied, here is a list of actions to stabilize this:
eve::scalar_cardinal
as it is nto used anywhere elseeve::simd_value
to not requireeve::scalar_cardinal
([PROJECT] Cleanup basic concepts & tests #1144).eve::lane<N>
inline variableeve::cardinal_*
and useeve::wide<T,N>::size()
everywhere it should have beeneve::lane
as a constexpr object with proper semanticeve::wide
accepteve::lane
object as NTTPThis induces multiple API BREAKING CHANGES and will need to be advertised as such.
Moving forward this will require a release.
Beta Was this translation helpful? Give feedback.
All reactions