-
Notifications
You must be signed in to change notification settings - Fork 59
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
Move self_logand to the logical_and callable #1959
base: main
Are you sure you want to change the base?
Conversation
af4d016
to
b0012c1
Compare
da4a721
to
e10f67e
Compare
48d1d7b
to
9e3c740
Compare
While attempting to fix this callable for the "no simd" configurations, I encountered the following problem: auto test(logical<short> a, logical<wide<int>> b) {
return logical_and(a, b);
} Because of the rules defined by The current fix involves using a |
This would also improve compile time by not having a convoluted map result computation. |
waiting on the map2 branch |
include/eve/module/core/regular/impl/simd/arm/sve/logical_and.hpp
Outdated
Show resolved
Hide resolved
After some talking we decided to change the behaviour of This is a breaking change. |
fe64b25
to
c7bdc8a
Compare
@DenisYaroshevskiy looks like it works. Your opinion is welcome so we can move forward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that there is a mess with conversions.
We do two or more conversions per operation.
I would like the logical callable to handle that.
I am ok if that happens with the "smaller logical result type"
include/eve/module/core/regular/impl/simd/arm/sve/logical_and.hpp
Outdated
Show resolved
Hide resolved
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually - this type of code would be in regular file (since you have the platform implementations.
Also - seems like conversions should be in behaviour, not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unaddressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do that a lot for small impl in a lot of places. Save on including a file for 5 lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only do that if we don't have the special file includes. Either one file or everyone gets a file.
I mean - that's how it is now. Let's not make this harder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK this is true.
@SadiinsoSnowfall put it back in a common/ file
Note: this PR now also changes the following callables: Also:
The new behaviour is the following: given two types
|
4f076e5
to
c9b000c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick review
} | ||
|
||
template<typename T, typename U> | ||
using priority_t = eve::as_logical_t<decltype(find_priority_type<T, U>())>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm iffy about this:
It seems like you rewrote a chunk of common_logical a second time and compare them.
Is this a fare description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that comparing common_logical_t
to itself would not be that useful. But without knowing exactly what types we are currently processing, it is difficult to know what should be the output of common_logical_t
. If you want I can try to discriminate between floats, signed integrals and unsigned integrals where applicable to make the desired output more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like there is only two usages of priority_t.
Just be explicit about the things you test, don't try to write a function.
Writing a function to validate input is a good idea only if you can somehow write that function in a much easier way than the original.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those two usage are actually used in the test doign a cartesian product of tests over all combo of scalar.
This is not something we can verify easily without missing stuff.
{ | ||
constexpr bool supports_map_no_conversion = requires{ map(this->derived(), x, xs...); }; | ||
|
||
if constexpr (supports_map_no_conversion) return map(this->derived(), x, xs...); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have a use case for this but - why "has_implementation" check is after supports_map_no_conversion
?
Probably a question for @jfalcou, you don't need to fix this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a remnant from before. This is not requried anymore, @SadiinsoSnowfall reverted it.
if constexpr (std::same_as<T, c_t>) return e; | ||
else if constexpr (std::same_as<T, bool> || scalar_value<T>) return c_t{e}; | ||
else return detail::call_convert(e, as_element<c_t>{}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this? I'd expect call_convert
to handle them. The bool? Adding a bool in convert seems like the right fix here then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding bool to convert and required tests is a bit big for this. Let's say this stay and later we PR convert for bool.
@@ -106,15 +106,15 @@ namespace eve | |||
namespace detail | |||
{ | |||
template<value T, value U, callable_options O> | |||
EVE_FORCEINLINE constexpr common_logical_t<T,U> | |||
EVE_FORCEINLINE constexpr auto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the return type changing here? (not that I care, unless it changed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a remnant from resolving the tuple problem. This should be fixed now.
{ return EVE_DISPATCH_CALL(a, b); } | ||
template<typename T, typename U> | ||
constexpr EVE_FORCEINLINE common_logical_t<T, U> operator()(T a, U b) const noexcept | ||
requires (same_lanes_or_scalar<T, U> && !arithmetic_simd_value<T> && !arithmetic_simd_value<U>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very weird requirement. Can't you just require relaxed_logical_value
on T and U?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment in the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what comment.
Like - ok - this is an unacceptable requirement for an interface. We need something reasonable.
if constexpr( scalar_value<T> && scalar_value<U> ) return r_t(a && b); | ||
else return a && b; | ||
if constexpr (relaxed_logical_scalar_value<T>) return a && b; | ||
else return bit_cast(a.bits() & b.bits(), as<T>{}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this else
. You are in cpu
right?
Is this like what - logical_value
&& is_wide_logical
? Can you be more explicit about that, this is very confusing.
At least a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment to clarify.
{ return EVE_DISPATCH_CALL(a, b); } | ||
template<typename T, typename U> | ||
constexpr EVE_FORCEINLINE common_logical_t<T, U> operator()(T a, U b) const noexcept | ||
requires (same_lanes_or_scalar<T, U> && !arithmetic_simd_value<T> && !arithmetic_simd_value<U>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here about the requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the answer to the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not ok for an interface.
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unaddressed.
//! @{ | ||
//! @concept relaxed_logical_scalar_value | ||
//! @brief The concept `relaxed_logical_scalar_value<T>` is satisfied if and only if T is a | ||
//! boolean value or satisfies the `eve::scalar_value` concept. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the scalar value
here is ofc weird but w/e, I don't want to change it now.
} | ||
(std::make_index_sequence<sizeof...(Ts)-1>()); | ||
return res; | ||
(std::make_index_sequence<sizeof...(Us)-1>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with this kumi change? This should probably go in upstream first, no? Or do we need to upgrade in lockstep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upstreal is fixed already as externals CI pass.
This is probably some noise and should be turned back to Ts.
{ | ||
template<value T, value U> | ||
template<typename T, typename U> | ||
requires(eve::same_lanes_or_scalar<T, U>) | ||
constexpr EVE_FORCEINLINE common_logical_t<T,U> operator()(T a, U b) const | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the simd tolerance looks very weird, whatever that is.
{ | ||
template<value T, value U> | ||
template<typename T, typename U> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_not_equal is not a logical element wise callable.
It's just not.
We need to figure out what's up.
auto tmp = is_not_equal(a, b); | ||
if constexpr( floating_value<r_t> ) return tmp && (is_not_nan(a) || is_not_nan(b)); | ||
else return tmp; | ||
if constexpr( floating_value<T> ) return tmp && (is_not_nan(a) || is_not_nan(b)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is weird but it's not on you, i'll just ignore it.
{ return EVE_DISPATCH_CALL(a, b); } | ||
template<typename T, typename U> | ||
constexpr EVE_FORCEINLINE common_logical_t<T, U> operator()(T a, U b) const noexcept | ||
requires (same_lanes_or_scalar<T, U> && !arithmetic_simd_value<T> && !arithmetic_simd_value<U>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what comment.
Like - ok - this is an unacceptable requirement for an interface. We need something reasonable.
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only do that if we don't have the special file includes. Either one file or everyone gets a file.
I mean - that's how it is now. Let's not make this harder.
{ return EVE_DISPATCH_CALL(a, b); } | ||
template<typename T, typename U> | ||
constexpr EVE_FORCEINLINE common_logical_t<T, U> operator()(T a, U b) const noexcept | ||
requires (same_lanes_or_scalar<T, U> && !arithmetic_simd_value<T> && !arithmetic_simd_value<U>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not ok for an interface.
No description provided.