diff --git a/loopy/auto_test.py b/loopy/auto_test.py index e7e3eb6d2ac3792f18fbc4d193c6d7ad1df82aa1..607d091b98b7a1919dacbe10f0280ea35c666a43 100644 --- a/loopy/auto_test.py +++ b/loopy/auto_test.py @@ -311,19 +311,23 @@ def _default_check_result(result, ref_result): # {{{ find device for reference test -def _enumerate_cl_devices_for_ref_test(): +def _enumerate_cl_devices_for_ref_test(blacklist_ref_vendors): import pyopencl as cl noncpu_devs = [] cpu_devs = [] + if isinstance(blacklist_ref_vendors, str): + blacklist_ref_vendors = blacklist_ref_vendors.split(",") + for pf in cl.get_platforms(): for dev in pf.get_devices(): + if any(bl in dev.platform.vendor + for bl in blacklist_ref_vendors): + print("blacklist", dev, blacklist_ref_vendors) + continue + if dev.type & cl.device_type.CPU: - if "Advanced Micro" in dev.platform.vendor: - # Sorry, AMD, your CPU CL has gotten too crashy of late. - # (Feb 2016) - continue if "Intel" in dev.platform.vendor: # Sorry, Intel, your CPU CL has gotten too crashy of late. # (Feb 2016) @@ -358,7 +362,7 @@ def auto_test_vs_ref( dump_binary=False, fills_entire_output=None, do_check=True, check_result=None, max_test_kernel_count=1, - quiet=False): + quiet=False, blacklist_ref_vendors=[]): """Compare results of `ref_knl` to the kernels generated by scheduling *test_knl*. @@ -413,7 +417,7 @@ def auto_test_vs_ref( ref_errors = [] - for dev in _enumerate_cl_devices_for_ref_test(): + for dev in _enumerate_cl_devices_for_ref_test(blacklist_ref_vendors): ref_ctx = cl.Context([dev]) ref_queue = cl.CommandQueue(ref_ctx, properties=cl.command_queue_properties.PROFILING_ENABLE) @@ -424,6 +428,9 @@ def auto_test_vs_ref( ref_sched_kernel = knl break + logger.info("%s (ref): trying %s for the reference calculation" % ( + ref_knl.name, dev)) + ref_compiled = CompiledKernel(ref_ctx, ref_sched_kernel) if not quiet and print_ref_code: print(75*"-") diff --git a/loopy/codegen/loop.py b/loopy/codegen/loop.py index cc45f95e7548945d83f38ae0e7bc9c08c5d4f013..70530d3a90cbdd5a48395034dd05000f6781b473 100644 --- a/loopy/codegen/loop.py +++ b/loopy/codegen/loop.py @@ -431,7 +431,8 @@ def generate_sequential_loop_dim_code(kernel, sched_index, codegen_state): if (static_ubound - static_lbound).plain_is_zero(): # single-trip, generate just a variable assignment, not a loop result.append(gen_code_block([ - Initializer(Const(POD(kernel.index_dtype, loop_iname)), + Initializer( + Const(POD(kernel.target, kernel.index_dtype, loop_iname)), ecm(aff_to_expr(static_lbound), PREC_NONE, "i")), Line(), inner, diff --git a/test/test_linalg.py b/test/test_linalg.py index 9c6803e93f2e53a0c071e0372bf71256854de38a..6aeec63c49a72c784ad5cccf1ee7acc1fcae0f2a 100644 --- a/test/test_linalg.py +++ b/test/test_linalg.py @@ -30,6 +30,8 @@ import pyopencl as cl import pyopencl.array as cl_array import loopy as lp +import logging + from pyopencl.tools import ( # noqa pytest_generate_tests_for_pyopencl as pytest_generate_tests) @@ -61,12 +63,16 @@ def check_float4(result, ref_result): def test_axpy(ctx_factory): + logging.basicConfig(level="INFO") ctx = ctx_factory() n = 3145182 vec = cl_array.vec + if ctx.devices[0].platform.vendor.startswith("Advanced Micro"): + pytest.skip("crashes on AMD 15.12") + for dtype, check, a, b in [ (np.complex64, None, 5, 7), (vec.float4, check_float4, @@ -111,7 +117,8 @@ def test_axpy(ctx_factory): lp.auto_test_vs_ref(seq_knl, ctx, variant(knl), op_count=[np.dtype(dtype).itemsize*n*3/1e9], op_label=["GBytes"], - parameters={"a": a, "b": b, "n": n}, check_result=check) + parameters={"a": a, "b": b, "n": n}, check_result=check, + blacklist_ref_vendors=["Advanced Micro"]) def test_transpose(ctx_factory): @@ -463,7 +470,7 @@ def test_magma_fermi_matrix_mul(ctx_factory): lp.auto_test_vs_ref(seq_knl, ctx, knl, op_count=[2*n**3/1e9], op_label=["GFlops"], - parameters={}) + parameters={}, blacklist_ref_vendors="pocl") def test_image_matrix_mul(ctx_factory): diff --git a/test/test_loopy.py b/test/test_loopy.py index 667d7365d412d9be6d9a51c8d63c9470ffede2f9..1fed3289aac1c184b2267e3425aed2d8023f9a03 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -529,6 +529,9 @@ def test_fuzz_code_generator(ctx_factory): ctx = ctx_factory() queue = cl.CommandQueue(ctx) + if ctx.devices[0].platform.vendor.startswith("Advanced Micro"): + pytest.skip("crashes on AMD 15.12") + #from expr_fuzz import get_fuzz_examples #for expr, var_values in get_fuzz_examples(): for expr, var_values in generate_random_fuzz_examples(50):