From f356535b8002a781a4b988d84bb225b78c535784 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 11 Dec 2017 12:26:57 -0600 Subject: [PATCH 1/2] Unskip a few tests for pocl 1.0 --- test/test_algorithm.py | 11 +++++++---- test/test_wrapper.py | 29 +++++++++++++++++------------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/test/test_algorithm.py b/test/test_algorithm.py index ee32278b..57373c7e 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 444b8a93..ff61be2a 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,18 @@ 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) or + cl.get_cl_header_version() < (2, 0)) + + if dev.platform.name == "Portable Computing Language": + has_svm = get_pocl_version(dev.platform) >= (1, 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 +966,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 +990,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) -- GitLab From c819f63f63230b16c98e3716009c2b640c94b6e7 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 11 Dec 2017 12:47:56 -0600 Subject: [PATCH 2/2] Fix SVM test gating --- test/test_wrapper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test_wrapper.py b/test/test_wrapper.py index ff61be2a..5717524d 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -946,11 +946,13 @@ def test_coarse_grain_svm(ctx_factory): dev = ctx.devices[0] - has_svm = (ctx._get_cl_version() < (2, 0) or - cl.get_cl_header_version() < (2, 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) + 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 -- GitLab