-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add bitwise and compare ops #47
Conversation
q.memcpy( | ||
(void*)value.const_data_ptr<scalar_t>(), | ||
self.const_data_ptr<scalar_t>(), | ||
sizeof(scalar_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.
Need synchronize the copy, or the value on host could not be valid.
|
||
template <typename opmath_t> | ||
struct ClampMaxFunctor { | ||
opmath_t operator()(opmath_t v) 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.
ditto
AT_DISPATCH_ALL_TYPES_AND2( | ||
kHalf, kBFloat16, iter.dtype(), "clamp_min_xpu", [&]() { | ||
auto lower = min_value.to<scalar_t>(); | ||
gpu_kernel(iter, ClampMinFunctor<scalar_t>(lower)); |
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.
ditto, checking opmath.
AT_DISPATCH_ALL_TYPES_AND2( | ||
kHalf, kBFloat16, iter.dtype(), "clamp_max_xpu", [&]() { | ||
auto upper = max_value.to<scalar_t>(); | ||
gpu_kernel(iter, ClampMaxFunctor<scalar_t>(upper)); |
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.
ditto, checking opmath.
split pr |
e.g. isnan, clamp, clamp_min, clamp_max, bitwise_and, bitwise_or, bitwise_xor, bitwise_not, _local_scalar_dense