Repository navigation
Drop OpenCL GPU and skip queue checks with only the default device in test_sycl_queue.py #3189
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,14 +35,24 @@ | |
| pass | ||
| elif device.device_type.name not in list_of_device_type_str: | ||
| pass | ||
| elif device.backend.name in "opencl" and device.is_gpu: | ||
| # due to reported crash on Windows: CMPLRLLVM-55640 | ||
| elif device.backend.name == "opencl" and device.is_gpu: | ||
| # Level Zero is the GPU backend users target | ||
| pass | ||
| else: | ||
| valid_dev.append(device) | ||
|
|
||
| dev_ids = [device.filter_string for device in valid_dev] | ||
|
|
||
| # inputs on the default device share its queue, so placement goes unchecked | ||
| only_default_dev = all(d == dpctl.select_default_device() for d in valid_dev) | ||
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def skip_if_only_default_device(request): | ||
| marked = request.node.get_closest_marker("single_device") is not None | ||
| if only_default_dev and not marked: | ||
| pytest.skip("needs a SYCL device other than the default one") | ||
|
Comment on lines
+47
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With only the default device these checks still catch real bugs: import dpctl, dpnp
import dpnp.tensor as dpt
x = dpnp.ones(10) # default device, default queue
y = dpnp.asarray(x, sycl_queue=dpctl.SyclQueue(x.sycl_device))
print(dpt.get_execution_queue([x.sycl_queue, y.sycl_queue])) # None on GPU and CPUCould we keep them running? To catch a dropped placement too, the inputs could be built on |
||
|
|
||
|
|
||
| def assert_sycl_queue_equal(result, expected): | ||
| assert result.backend == expected.backend | ||
|
|
@@ -654,6 +664,7 @@ def test_2in_broadcasting(func, data1, data2, device): | |
| assert_sycl_queue_equal(result.sycl_queue, x1.sycl_queue) | ||
|
|
||
|
|
||
| @pytest.mark.single_device | ||
| @pytest.mark.parametrize( | ||
| "func", | ||
| [ | ||
|
|
@@ -694,6 +705,7 @@ def test_flat(device): | |
| assert_sycl_queue_equal(x.flat[y].sycl_queue, x.sycl_queue) | ||
|
|
||
|
|
||
| @pytest.mark.single_device | ||
| @pytest.mark.parametrize("device", valid_dev, ids=dev_ids) | ||
| def test_flat_setitem_diff_queue(device): | ||
| a = dpnp.arange(6, device=device) | ||
|
|
@@ -843,6 +855,7 @@ def test_vecmat(device, shape1, shape2): | |
| assert_sycl_queue_equal(result_queue, b.sycl_queue) | ||
|
|
||
|
|
||
| @pytest.mark.single_device | ||
| @pytest.mark.parametrize( | ||
| "func, args, kwargs", | ||
| [ | ||
|
|
@@ -887,6 +900,7 @@ def test_random(func, args, kwargs, device, usm_type): | |
| assert_sycl_queue_equal(res_array.sycl_queue, sycl_queue) | ||
|
|
||
|
|
||
| @pytest.mark.single_device | ||
| @pytest.mark.parametrize( | ||
| "func, args, kwargs", | ||
| [ | ||
|
|
@@ -1039,6 +1053,7 @@ def test_basic(self, device_from, device_to): | |
| assert y.sycl_device == device_to | ||
| assert (x.asnumpy() == y.asnumpy()).all() | ||
|
|
||
| @pytest.mark.single_device | ||
| def test_to_queue(self): | ||
| x = dpnp.full(100, 2, dtype=dpnp.int64) | ||
| q_prof = dpctl.SyclQueue(x.sycl_device, property="enable_profiling") | ||
|
|
@@ -1047,6 +1062,7 @@ def test_to_queue(self): | |
| assert (x.asnumpy() == y.asnumpy()).all() | ||
| assert_sycl_queue_equal(y.sycl_queue, q_prof) | ||
|
|
||
| @pytest.mark.single_device | ||
| def test_stream(self): | ||
| x = dpnp.full(100, 2, dtype=dpnp.int64) | ||
| q_prof = dpctl.SyclQueue(x.sycl_device, property="enable_profiling") | ||
|
|
@@ -1062,6 +1078,7 @@ def test_stream(self): | |
| assert (x.asnumpy() == y.asnumpy()).all() | ||
| assert_sycl_queue_equal(y.sycl_queue, q_prof) | ||
|
|
||
| @pytest.mark.single_device | ||
| def test_stream_no_sync(self): | ||
| x = dpnp.full(100, 2, dtype=dpnp.int64) | ||
| q_prof = dpctl.SyclQueue(x.sycl_device, property="enable_profiling") | ||
|
|
@@ -1071,6 +1088,7 @@ def test_stream_no_sync(self): | |
| assert (x.asnumpy() == y.asnumpy()).all() | ||
| assert_sycl_queue_equal(y.sycl_queue, q_prof) | ||
|
|
||
| @pytest.mark.single_device | ||
| @pytest.mark.parametrize( | ||
| "stream", | ||
| [1, dict(), dpctl.SyclDevice()], | ||
|
|
@@ -1783,6 +1801,7 @@ def test_cho_solve(self, a_data, b_data, device): | |
| assert_sycl_queue_equal(result.sycl_queue, a.sycl_queue) | ||
| assert_sycl_queue_equal(result.sycl_queue, b.sycl_queue) | ||
|
|
||
| @pytest.mark.single_device | ||
| @pytest.mark.parametrize("c_shape", [(2, 2), (1, 2, 2)]) | ||
| def test_cho_solve_diff_queue(self, c_shape, device): | ||
| c = dpnp.full(c_shape, 2.0, device=device) | ||
|
|
||
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.
If the skip stays:
test_copy_method,test_astype,test_indices,test_tri_diag_indicesandtest_mask_indicesalso pass a newdpctl.SyclQueue(device), but they are not markedsingle_device, so CI skips them. Iftril_indicesignoredsycl_queue=, master's CPU CI would fail and this branch would pass. Could you mark them too? The opendpnp.randomPRs (#3157-#3163) add more such tests.