-
Notifications
You must be signed in to change notification settings - Fork 30
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
Merging developmental snapshot tagged 0.14.6dev2 to gold/2021 #1337
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
usm_ndarray constructor's array_namespace argument's default value of None is now interpreted to mean that usm_ndarray.__array_namespace__ returns dpctl.tensor, rather than None. This directly affects how Python operator special methods of usm_ndarray behave. They would now look up corresponding attribute in dpctl.tensor namespace.
``` In [1]: dpctl.tensor._usmarray as ua ua._basic_slice_meta((0, slice(1, 0, None)), (4, 4), (4, 1), 0) ``` The issue was discovered by array API conformance tests.
``` import dpctl.tensor as dpt x = dpt.empy((0,2), dtype='i4') x[Ellipsis, 1] returns empty 1d array ```
- "power" corrected to "pow, "mod" corrected to "remainder" - logical functions corrected to bitwise
``` import dpctl.tensor as dpt import dpctl.tensor._usmarray as ua x = dpt.asarray([[0, 0], [1, 0]], dtype='int8') key = (None, 0, slice(1, None, -1)) meta = ua._basic_slice_meta(key, x.shape, x.strides, x._element_offset) y = dpt.usm_ndarray.__new__(dpt.usm_ndarray, meta[0], dtype=x.dtype, strides=meta[1], buffer=x.usm_data, offset=meta[2]) print(y.flags) ``` Both 'C' and 'F' flags of the created array used to be set, now both are correctly unset.
- Incorrect test logic was being hidden by the bug
Array API tests pointed out an error in implementation of order='K' in dpctl.tensor.astype. Moved _empty_like_orderK and fried from _type_utils to _copy_utils and used it to implement astype. Modified import statement in _elementwise_common where _empty_like* are used.
The dpctl/tests/test_type_utils.py has been removed.
``` import dpctl.tensor as dpt x1 = dpt.full(tuple(), 77, dtype='u2') x2 = dpt.zeros(2, dtype='uint8')[dpt.newaxis, :] dpt.concat((x1, x2), axis=None) ``` The reason the exception was raised is that _copy_usm_ndarray_for_reshape which is used in the implementation of concat with axis=None requires both source and destination to have the same data-type.
``` In [1]: import dpctl.tensor as dpt In [2]: a = dpt.arange(10, dtype='int64') ...: b = dpt.arange(10, dtype='float32') In [3]: dpt.concat((a,b)) Out[3]: usm_ndarray([0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.], dtype=float32) In [4]: _.sycl_device.name Out[4]: 'Intel(R) Graphics [0x9a49]' ```
- 'or' conditions can sometimes cause wrong results when using the OS compiler
If both arguments are -inf, the result is also -inf.
The change is to suppress RuntimeWarning arising from within assert_allclose utility.
Use `self.flags_` directly, instead of getting it via temporary Flags object.
Enable support for Python operators in usm_ndarray class
This commit short-circuited broadcastability of shapes for zero-size rhs in __setitem__. Refix array API test failure without introducing this regression and reuse _manipulation_functions._broadcast_strides as suggested by @ndgrigorian
…twise_funcs impl_minimum_maximum_elementwise_funcs
Also added comment to explain the logic of the code.
Added declaration, doxygen docs, implementation and tests.
Also enabled overlooked check_default_context
It is not yet supported on Windows.
* Adds `math_utils.hpp` with complex comparison functions * Refactors comparison functions to use math_utils implementations * Refactors maximum and minimum to use math_utils implementations
* Fixed some complex special cases for expm1 * Silence remaining warnings in elementwise tests * Tweaks to expm1 complex special case logic * expm1 special case change For `inf` real part and finite, nonzero imaginary part, now guaranteed to be (+/-`inf`, +/-`inf`), with cosine and sine of the imaginary part determining the sign, respectively
This returns default index type for give device. Since all devices are 64-bit devices, it always returns "i8".
Closes gh-1335. The issue was caused by nonzero using default integral data type, not default index data type.
A non-empty array which is effectively 1D (only one dimension has size greater than one) should be marked as both C- and F- contiguous. ``` In [1]: import dpctl.tensor as dpt In [2]: a = dpt.ones((2, 3)) ...: dpt.reshape(a, (1, 6, 1)).flags Out[2]: C_CONTIGUOUS : True F_CONTIGUOUS : True WRITABLE : True In [3]: a = dpt.ones((2, 3), order='F') ...: dpt.reshape(a, (1, 6, 1), order='F').flags Out[3]: C_CONTIGUOUS : True F_CONTIGUOUS : True WRITABLE : True In [4]: a = dpt.ones((2, 3, 4)) ...: dpt.sum(a, axis=(1, 2), keepdims=True).flags Out[4]: C_CONTIGUOUS : True F_CONTIGUOUS : True WRITABLE : True ```
SyclPlatform equality operator implemented
Fix nonzero result dtype win
usm_ndarray.to_device(dev, stream=queue) support
@xaleryb For awareness. Merging right away. |
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1337/index.html |
Array API standard conformance tests for dpctl=0.14.6dev2=py310h7bf5fec_31 ran successfully. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR merges development snapshot tagged 0.14.6dev2 of dpctl to gold/2021.
This picks up
impl_minimum_maximum_elementwise_funcs #1316
Enable support for Python operators in usm_ndarray class #1324
usm_ndarray.to_device(dev, stream=queue) support #1331
SyclPlatform equality testing and hashing implemented #1333
Fix nonzero result dtype win #1336
Have you provided a meaningful PR description?
Have you added a test, reproducer or referred to an issue with a reproducer?
Have you tested your changes locally for CPU and GPU devices?
Have you made sure that new changes do not introduce compiler warnings?
Have you checked performance impact of proposed changes?
If this PR is a work in progress, are you opening the PR as a draft?