Repository navigation
Avoid copying uninitialized float64 buffers to the device in tests - #3110
Open
antonwolfy wants to merge 1 commit into
Open
antonwolfy wants to merge 1 commit into
antonwolfy wants to merge 1 commit into
Conversation
Four tests built an output array with `numpy.empty` in float64 and copied it to the device with `dpnp.array`. On a device without fp64 support the copy casts to float32, and if the uninitialized memory holds a value beyond the float32 range, NumPy raises `RuntimeWarning: overflow encountered in cast`. Initialize the buffers with `numpy.zeros`, or allocate on the device with `dpnp.empty` where the numpy array isn't needed.
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
October 15, 2026 17:17
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3110/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.21.0dev14=np2py314h8d9cdd5_6 ran successfully. |
Collaborator
This branch has not been deployed
This file contains hidden or 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
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.
Four tests built an output array with
numpy.emptyin float64 and copied it to the device withdpnp.array:TestDot::test_out_scalarintest_product.py(numpy.result_type(int, float32_array)is float64)TestMatmul::test_syrk_out_orderintest_product.py(generate_random_numpy_arraydefaults to float64)TestVecdot::test_out_0Dintest_product.pyTestNanProdSum::test_outintest_nanfunctions.pyOn a device without fp64 support the copy casts the buffer to float32. If the uninitialized memory happens to hold a value beyond the float32 range, NumPy raises
RuntimeWarning: overflow encountered in cast, so the warning appears at random in test runs on such devices (it was seen forTestDot::test_out_scalar[float32]on a Windows GPU).The buffers are now created with
numpy.zeros. InTestNanProdSum::test_out, where only a wrongly shapedoutarray is needed, it is allocated on the device withdpnp.emptyinstead. Only test files are changed.