-
Notifications
You must be signed in to change notification settings - Fork 61
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
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. |
73fbf38
to
6090b71
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
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.
{ 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.
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 has been updated following our decision to disallow passing non-logical scalar values as parameters to logical_xxx callables.
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.
include/eve/deps/kumi/tuple.hpp
Outdated
} | ||
(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.
{ 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.
{ 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.
2c46b48
to
e54acc0
Compare
auto const order = [&]<typename Index>(Index i) | ||
{ | ||
auto y_less_x_prev = rhs[i] < lhs[i]; | ||
auto x_less_y = lhs[index_t<Index::value+1>{}] < rhs[index_t<Index::value+1>{}]; | ||
res = res || (x_less_y && !y_less_x_prev); | ||
return (x_less_y && !y_less_x_prev); |
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 the kumi changes.
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.
these are for doign a proper fold instead of the bad code from before. This is coming from KUMI head
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.
Would be nice as a separate change, why is this here? (don't bother 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.
Almost there!
auto const order = [&]<typename Index>(Index i) | ||
{ | ||
auto y_less_x_prev = rhs[i] < lhs[i]; | ||
auto x_less_y = lhs[index_t<Index::value+1>{}] < rhs[index_t<Index::value+1>{}]; | ||
res = res || (x_less_y && !y_less_x_prev); | ||
return (x_less_y && !y_less_x_prev); |
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.
Would be nice as a separate change, why is this here? (don't bother now)
TTS_CASE("eve::common_logical on boolean x boolean") | ||
{ | ||
TTS_TYPE_IS((eve::common_logical_t<bool, bool>), bool); | ||
}; |
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.
Nit:
common_logical_t is always simmetrical. Extract a function:
template <typename L, typename R, typename Res>
void common_logical_res_test()
And use that one. This way you halve the number of test cases you need to write.
You can also put all "logical/non-logical" common logical stuff in there.
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 should be fixed, let me know
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.
Please address that french file
597475b
to
c2e88d6
Compare
No description provided.