-
Notifications
You must be signed in to change notification settings - Fork 326
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
Masked compare and floating point classifications #2427
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Nice :) I think the CLA issue is still unresolved, any update there?
equivalent to, and potentially more efficient than, `And(m, Eq(a, b));` etc. | ||
|
||
* `V`: `{f}` \ | ||
<code>M **MaskedIsNaN**(V v)</code>: returns mask indicating whether `v[i]` |
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.
Let's add the mask argument to the documentation :)
#### Masked floating-point classification | ||
|
||
All ops in this section return `false` for `mask=false` lanes. These are | ||
equivalent to, and potentially more efficient than, `And(m, Eq(a, b));` etc. |
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.
And(m, IsNaN)?
All ops in this section return `false` for `mask=false` lanes. These are | ||
equivalent to, and potentially more efficient than, `And(m, Eq(a, b));` etc. | ||
|
||
* <code>M **MaskedCompEq**(M m, V a, V b)</code>: returns `a[i] == b[i]` or |
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.
Should we just call it MaskedEq for consistency with the usual naming convention, which is only to prepend Masked
to the existing Eq?
} | ||
|
||
namespace detail { | ||
HWY_SVE_FOREACH(HWY_SVE_COMPARE_Z, MaskedEq, cmpeq) |
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 think we can expose these directly. Rather than putting them in detail:: and adding a wrapper function, you can just remove the namespace detail, and specify the desired name of the op as the second to last argument (MaskedEq is already good IMO).
} | ||
|
||
template <class V, class M, class D = DFromV<V>> | ||
HWY_API MFromD<D> MaskedIsInf(const M m, const V v) { |
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.
Do we ever plan to provide a faster implementation of MaskIfInf/IsFinite, or can those be removed?
Apologies, CLA issue has stuck around despite us signing it multiple times. Team was on holiday, now we are back and will resolve CLA and your comments soon. |
Introduces:
MaskedIsNaN(v): returns mask indicating whether
v[i]
is "not a number" (unordered) orfalse
ifm[i]
is false.MaskedIsInf(v): returns mask indicating whether
v[i]
is positive or negative infinity orfalse
ifm[i]
is false.MaskedIsFinite(v): returns mask indicating whether
v[i]
is neither NaN nor infinity, i.e. normal, subnormal or zero orfalse
ifm[i]
is false. Equivalent toNot(Or(IsNaN(v), IsInf(v)))
.MaskedCompEq(m, a, b), MaskedCompNe(m, a, b), MaskedCompLt(m, a, b), MaskedCompGt(m, a, b), MaskedCompLe(m, a, b), MaskedCompGe(m, a, b), returning the output for all versions of
==, !=, <, >, >=, <=
, orfalse
ifm[i]
is false.All operations are written for both
arm_sve-inl.h
andgeneric_ops-inl.h
and, equally, tests are included for all operations.