-
Notifications
You must be signed in to change notification settings - Fork 336
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
Masked compare and floating point classifications #2427
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?
g3doc/quick_reference.md
Outdated
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 :)
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.
Apologies, have corrected.
g3doc/quick_reference.md
Outdated
#### 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)?
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.
Very, true. Have corrected.
g3doc/quick_reference.md
Outdated
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?
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.
Agreed, have updated.
hwy/ops/arm_sve-inl.h
Outdated
} | ||
|
||
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?
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've removed these.
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. |
19ff43c
to
bfe4014
Compare
Fix docs for masked floating-point classification Rename MaskedComp* ops to Masked* Remove redundant wrapper functions
bfe4014
to
e8a840c
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.
Nice, one small nit :)
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.