Skip to content

Commit 14e21c5

Browse files
committed
limit AdaptiveCpp test skips to AdaptiveCpp builds
Use a skipif marker in _device_attributes_checks, which is imported before the marker is registered.
1 parent fbdae51 commit 14e21c5

3 files changed

Lines changed: 23 additions & 10 deletions

File tree

‎dpctl/tests/_device_attributes_checks.py‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818

1919
import dpctl
2020

21+
from .helper import is_adaptivecpp
22+
23+
# conftest imports this module before it registers unsupported_on_acpp
24+
_unsupported_on_acpp = pytest.mark.skipif(
25+
is_adaptivecpp(), reason="not supported by AdaptiveCpp"
26+
)
27+
2128
list_of_standard_selectors = [
2229
dpctl.select_accelerator_device,
2330
dpctl.select_cpu_device,
@@ -867,9 +874,7 @@ def check_partition_affinity_domains(device):
867874
check_driver_version,
868875
check_name,
869876
# AdaptiveCpp scores the OpenMP host device 0, not a positive value
870-
pytest.param(
871-
check_default_selector_score, marks=pytest.mark.unsupported_on_acpp
872-
),
877+
pytest.param(check_default_selector_score, marks=_unsupported_on_acpp),
873878
check_backend,
874879
check_device_type,
875880
check_global_mem_cache_type,
@@ -886,7 +891,7 @@ def check_partition_affinity_domains(device):
886891
check_error_correction_support,
887892
check_is_available,
888893
check_version,
889-
pytest.param(check_backend_version, marks=pytest.mark.unsupported_on_acpp),
894+
pytest.param(check_backend_version, marks=_unsupported_on_acpp),
890895
check_local_mem_type,
891896
check_partition_type_property,
892897
check_partition_type_affinity_domain,
@@ -895,19 +900,19 @@ def check_partition_affinity_domains(device):
895900
check_double_fp_config,
896901
pytest.param(
897902
check_atomic_memory_order_capabilities,
898-
marks=pytest.mark.unsupported_on_acpp,
903+
marks=_unsupported_on_acpp,
899904
),
900905
pytest.param(
901906
check_atomic_fence_order_capabilities,
902-
marks=pytest.mark.unsupported_on_acpp,
907+
marks=_unsupported_on_acpp,
903908
),
904909
pytest.param(
905910
check_atomic_memory_scope_capabilities,
906-
marks=pytest.mark.unsupported_on_acpp,
911+
marks=_unsupported_on_acpp,
907912
),
908913
pytest.param(
909914
check_atomic_fence_scope_capabilities,
910-
marks=pytest.mark.unsupported_on_acpp,
915+
marks=_unsupported_on_acpp,
911916
),
912917
check_partition_properties,
913918
check_partition_affinity_domains,

‎dpctl/tests/test_sycl_queue.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ def test_queue_memops():
373373
and q.sycl_device.backend == dpctl.backend_type.opencl
374374
and q.sycl_device.has_aspect_cpu
375375
)
376-
if not is_wsl_or_windows() and not acpp_opencl_cpu:
376+
acpp_skip = is_adaptivecpp() and (is_wsl_or_windows() or acpp_opencl_cpu)
377+
if not acpp_skip:
377378
q.prefetch(m1, 512)
378379
with pytest.raises(TypeError):
379380
q.prefetch([], 512)

‎dpctl/tests/test_sycl_usm.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
as_usm_memory,
2828
)
2929

30+
from .helper import is_adaptivecpp
31+
3032

3133
class Dummy(MemoryUSMShared):
3234
"""
@@ -89,7 +91,12 @@ def _skip_if_usm_types_not_reported(q=None):
8991
AdaptiveCpp's OpenMP backend allocates plain host memory, and reports
9092
every allocation as USM-host.
9193
"""
92-
m = MemoryUSMDevice(8) if q is None else MemoryUSMDevice(8, queue=q)
94+
if not is_adaptivecpp():
95+
return
96+
try:
97+
m = MemoryUSMDevice(8) if q is None else MemoryUSMDevice(8, queue=q)
98+
except (dpctl.SyclDeviceCreationError, dpctl.SyclQueueCreationError):
99+
pytest.skip("No SYCL device available")
93100
if m.get_usm_type() != "device":
94101
pytest.skip("Device does not report distinct USM allocation types")
95102

0 commit comments

Comments
 (0)