diff --git a/test/test_algorithm.py b/test/test_algorithm.py index ee32278bbf1c48142eb6dbf78963c03b3a9e313e..57373c7e9c483a85a9b14a4f9d4989872605db8d 100644 --- a/test/test_algorithm.py +++ b/test/test_algorithm.py @@ -40,6 +40,7 @@ from pyopencl.tools import ( # noqa from pyopencl.characterize import has_double_support, has_struct_arg_count_bug from pyopencl.scan import (InclusiveScanKernel, ExclusiveScanKernel, GenericScanKernel, GenericDebugScanKernel) +from pyopencl.characterize import get_pocl_version # {{{ elementwise @@ -933,8 +934,9 @@ def test_bitonic_sort(ctx_factory, size, dtype): pytest.xfail("Bitonic sort won't work on Apple CPU: no workgroup " "parallelism") if (dev.platform.name == "Portable Computing Language" - and dtype == np.float64): - pytest.xfail("Double precision bitonic sort doesn't work on POCL") + and dtype == np.float64 + and get_pocl_version(dev.platform) < (1, 0)): + pytest.xfail("Double precision bitonic sort doesn't work on POCL < 1.0") if dtype == np.float64 and not has_double_support(dev): from pytest import skip @@ -981,8 +983,9 @@ def test_bitonic_argsort(ctx_factory, size, dtype): pytest.xfail("Bitonic sort won't work on Apple CPU: no workgroup " "parallelism") if (dev.platform.name == "Portable Computing Language" - and dtype == np.float64): - pytest.xfail("Double precision bitonic sort doesn't work on POCL") + and dtype == np.float64 + and get_pocl_version(dev.platform) < (1, 0)): + pytest.xfail("Double precision bitonic sort doesn't work on POCL < 1.0") if dtype == np.float64 and not has_double_support(dev): from pytest import skip diff --git a/test/test_wrapper.py b/test/test_wrapper.py index 444b8a93cc94e73b2c3db8b6809703684b852f50..5717524d8e390dd6388931b187c54c16063e6e3b 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -630,7 +630,8 @@ def test_can_build_binary(ctx_factory): def test_enqueue_barrier_marker(ctx_factory): ctx = ctx_factory() # Still relevant on pocl 0.14. - _skip_if_pocl(ctx.devices[0].platform, None, 'pocl crashes on enqueue_barrier') + _skip_if_pocl( + ctx.devices[0].platform, (0, 14), 'pocl crashes on enqueue_barrier') queue = cl.CommandQueue(ctx) cl.enqueue_barrier(queue) evt1 = cl.enqueue_marker(queue) @@ -721,9 +722,9 @@ def test_user_event(ctx_factory): from pytest import skip skip("UserEvent is only available in OpenCL 1.1") - if ctx.devices[0].platform.name == "Portable Computing Language": - # https://github.com/pocl/pocl/issues/201 - pytest.xfail("POCL's user events don't work right") + # https://github.com/pocl/pocl/issues/201 + _skip_if_pocl(ctx.devices[0].platform, (0, 13), + "pocl's user events don't work right") status = {} @@ -943,11 +944,20 @@ def test_coarse_grain_svm(ctx_factory): ctx = ctx_factory() queue = cl.CommandQueue(ctx) - if (ctx._get_cl_version() < (2, 0) or - cl.get_cl_header_version() < (2, 0)): + dev = ctx.devices[0] + + has_svm = (ctx._get_cl_version() >= (2, 0) and + cl.get_cl_header_version() >= (2, 0)) + + if dev.platform.name == "Portable Computing Language": + has_svm = ( + get_pocl_version(dev.platform) >= (1, 0) + and cl.get_cl_header_version() >= (2, 0)) + + if not has_svm: from pytest import skip skip("SVM only available in OpenCL 2.0 and higher") - dev = ctx.devices[0] + if ("AMD" in dev.platform.name and dev.type & cl.device_type.CPU): pytest.xfail("AMD CPU doesn't do coarse-grain SVM") @@ -958,10 +968,7 @@ def test_coarse_grain_svm(ctx_factory): # https://bitbucket.org/pypy/numpy/issues/52 assert isinstance(svm_ary.mem.base, cl.SVMAllocation) - if (dev.platform.name != "Portable Computing Language" - or get_pocl_version(dev.platform) >= (0, 14)): - # pocl 0.13 has a bug misinterpreting the size parameter - cl.enqueue_svm_memfill(queue, svm_ary, np.zeros((), svm_ary.mem.dtype)) + cl.enqueue_svm_memfill(queue, svm_ary, np.zeros((), svm_ary.mem.dtype)) with svm_ary.map_rw(queue) as ary: ary.fill(17) @@ -985,7 +992,7 @@ def test_coarse_grain_svm(ctx_factory): if ctx.devices[0].platform.name != "Portable Computing Language": # "Blocking memcpy is unimplemented (clEnqueueSVMMemcpy.c:61)" - # in pocl 0.13 and 0.14-pre. + # in pocl up to and including 1.0rc1. cl.enqueue_copy(queue, new_ary, svm_ary) assert np.array_equal(orig_ary*2, new_ary)