-
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
Implement asynchronous fill
method using dpctl
kernels
#2055
Implement asynchronous fill
method using dpctl
kernels
#2055
Conversation
fill
method using dpctl
kernelsfill
method using dpctl
kernels
7e3662b
to
b8dad1e
Compare
@antonwolfy @vtavana @vlad-perevezentsev
|
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.
@ndgrigorian, thank you for implementing so great improvement.
Please find some comments below.
ef96194
to
151b6a9
Compare
23e9c9f
to
9466f9e
Compare
@antonwolfy The CuPy test looks for filling the array with a NumPy I've also updated docstring per request. |
Leverages dpctl's strided fill and memset for setting contiguous memory to 0
New fill implementation does not permit NumPy array values, consistent with fill_diagonal
9466f9e
to
985b4fa
Compare
NumPy arrays are no longer permitted and queue coercion does not occur in the `fill` method, so `astype` is sufficient
1890180
to
865867a
Compare
`test_fill_non_scalar` now checks for strings and `test_fill_bool` added to verify bools are properly cast to 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.
Thank you @ndgrigorian for significant improvement of the fill
method. No more comments from me.
@antonwolfy |
* Enhance `dpnp_array.fill` method Leverages dpctl's strided fill and memset for setting contiguous memory to 0 * Fix missing disclaimer in dpnp_arraycreation.py * Import `dpnp_array` directly * Skip `test_fill_with_numpy_scalar_ndarray` New fill implementation does not permit NumPy array values, consistent with fill_diagonal * Add dependencies to zeros and full kernels in `dpnp_fill` * Remove redundant validation of first `dpnp_fill` argument * Improve `dpnp_fill` array/scalar path logic * Disallow inputs to `dpnp_fill` on separate queues * Adjust skip message for `test_fill_with_numpy_scalar_ndarray` * Tweak error messages in `dpnp_fill` * Add tests for new `fill` method * Update docstring for `fill` method * Fix pre-commit in cupy fill tests * Change `asarray` to `astype` in `dpnp_fill` NumPy arrays are no longer permitted and queue coercion does not occur in the `fill` method, so `astype` is sufficient * Expand TEST_SCOPE to include `test_fill.py` * Remove redundant check from `dpnp_fill` * Use `_cast_fill_val` private function from `dpctl.tensor._ctors` * Add tests per PR review by @antonwolfy * Improve validation of `val` for `fill` method * Add to permit NumPy bools as `dpnp_fill` scalar fill values * Use `dpnp.bool` in `dpnp_fill` and make `isinstance` check more efficient * Replace branching for `fill` scalar type with `_cast_fill_value` * Add additional tests for `fill` `test_fill_non_scalar` now checks for strings and `test_fill_bool` added to verify bools are properly cast to 1 --------- Co-authored-by: Anton <100830759+antonwolfy@users.noreply.github.com> 29239b6
This PR proposes a change to
dpnp_array.fill
method which leverages dpctl kernels to makefill
asynchronous and more efficient, avoiding repeated calls to index the array and copying scalars to the device for each element.Shows significant performance gains on Iris Xe in WSL
Before
After