Skip to content

Commit 32effa7

Browse files
adjusted tests per PR feedback
1 parent c0da58b commit 32effa7

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

dppl/tests/dppl_tests/test_sycl_usm.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,30 @@ def test_memory_without_context (self):
4646
def test_memory_cpu_context (self):
4747
mobj = self._create_memory()
4848

49-
# CPU context
49+
# CPU context
5050
with dppl.device_context(dppl.device_type.cpu):
51-
self.assertEqual(mobj._usm_type(), 'shared')
51+
# type respective to the context in which
52+
# memory was created
53+
usm_type = mobj._usm_type()
54+
self.assertEqual(usm_type, 'shared')
55+
56+
current_queue = dppl.get_current_queue()
57+
# type as view from current queue
58+
usm_type = mobj._usm_type(context=current_queue)
59+
# type can be unknown if current queue is
60+
# not in the same SYCL context
61+
self.assertTrue(usm_type in ['unknown', 'shared'])
5262

5363
def test_memory_gpu_context (self):
5464
mobj = self._create_memory()
5565

5666
# GPU context
5767
with dppl.device_context(dppl.device_type.gpu):
58-
self.assertEqual(mobj._usm_type(), 'shared')
68+
usm_type = mobj._usm_type()
69+
self.assertEqual(usm_type, 'shared')
70+
current_queue = dppl.get_current_queue()
71+
usm_type = mobj._usm_type(context=current_queue)
72+
self.assertTrue(usm_type in ['unknown', 'shared'])
5973

6074

6175
class TestMemoryUSMBase:

0 commit comments

Comments
 (0)